withdraw.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. package dao
  2. import (
  3. "runtime/debug"
  4. "bet24.com/database"
  5. "bet24.com/log"
  6. )
  7. // 提现日志
  8. type (
  9. withdrawLog_in struct {
  10. UserID int // 用户ID
  11. BeginTime string // 开始时间
  12. EndTime string // 截止时间
  13. PageIndex int // 页索引
  14. PageSize int // 页大小
  15. }
  16. withdrawLogInfo struct {
  17. OrderID string // 订单号
  18. TradeID string // 交易号
  19. UserID int // 用户ID
  20. NickName string // 用户昵称
  21. Amount int // 金额
  22. RealAmount int // 实际扣除金额
  23. DfTransactionId string // 平台代付单号,32字符以内
  24. GetStatus int // 状态 (0=下单(无审核) 1=待审核 2=已审核 3=提现成功(审核) 4=提现成功(无审核) 13=Pending(审核) 14=Pending(无审核) 11=拒绝
  25. // 251=提现失败(无审核) 252=提现失败(审核) 255=提现失败)
  26. DfDesc string // 代付状态描述
  27. Balance int // 余额
  28. NotifyTime string // 通知时间
  29. Crdate string // 下单时间
  30. }
  31. withdrawLog_out struct {
  32. RecordCount int //记录数
  33. TotalAmount int //总金币
  34. List []withdrawLogInfo
  35. }
  36. withdrawLog struct {
  37. database.Trans_base
  38. In withdrawLog_in
  39. Out withdrawLog_out
  40. }
  41. )
  42. func NewWithdrawLog() *withdrawLog {
  43. return &withdrawLog{}
  44. }
  45. func (this *withdrawLog) DoAction(ch chan<- interface{}) {
  46. defer func() {
  47. if err := recover(); err != nil {
  48. log.Release("transaction recover fail %v", err)
  49. log.Release("%s", debug.Stack())
  50. }
  51. if ch != nil {
  52. ch <- this
  53. }
  54. }()
  55. statement := database.NewStatement()
  56. statement.SetNeedReturnValue(false)
  57. statement.SetOpenRecordSet(true)
  58. statement.SetProcName("Manage_Withdraw_GetLog")
  59. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  60. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  61. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  62. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  63. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  64. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  65. statement.AddParamter("@TotalAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.TotalAmount)
  66. sqlstring := statement.GenSql()
  67. retRows := CenterDB.ExecSql(sqlstring)
  68. rowLen := len(retRows)
  69. if rowLen <= 0 {
  70. this.State = false
  71. return
  72. }
  73. this.State = true
  74. if rowLen > 1 {
  75. this.Out.List = make([]withdrawLogInfo, rowLen-1)
  76. for i := 0; i < rowLen-1; i++ {
  77. ret := retRows[i]
  78. out := &this.Out.List[i]
  79. out.OrderID = (*ret[0].(*interface{})).(string)
  80. out.TradeID = (*ret[1].(*interface{})).(string)
  81. out.UserID = int((*ret[2].(*interface{})).(int64))
  82. out.NickName = (*ret[3].(*interface{})).(string)
  83. if info := tagMgr.getInfo(out.UserID); info != nil {
  84. out.NickName = info.NickName
  85. }
  86. out.Amount = int((*ret[4].(*interface{})).(int64))
  87. out.RealAmount = int((*ret[5].(*interface{})).(int64))
  88. out.DfTransactionId = (*ret[6].(*interface{})).(string)
  89. out.GetStatus = int((*ret[7].(*interface{})).(int64))
  90. out.DfDesc = (*ret[8].(*interface{})).(string)
  91. out.Balance = int((*ret[9].(*interface{})).(int64))
  92. out.NotifyTime = (*ret[10].(*interface{})).(string)
  93. out.Crdate = (*ret[11].(*interface{})).(string)
  94. }
  95. }
  96. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  97. this.Out.TotalAmount = int((*retRows[rowLen-1][1].(*interface{})).(int64))
  98. }
  99. // 提现统计
  100. type (
  101. withdrawStatList_in struct {
  102. BeginTime string // 开始时间
  103. EndTime string // 截止时间
  104. PageIndex int // 页索引
  105. PageSize int // 页大小
  106. }
  107. withdrawStatListModel struct {
  108. DateFlag string // 日期标识
  109. WithdrawAmount int // 提现金额
  110. SuccessAmount int // 成功提现金额
  111. UserCount int // 提现用户数(除去重复的)
  112. }
  113. withdrawStatList_out struct {
  114. RecordCount int // 记录数
  115. WithdrawAmount int // 提现金额
  116. SuccessAmount int // 成功提现金额
  117. CurrWithdraw int // 今天提现金额
  118. CurrSuccessAmount int // 今天成功提现金额
  119. List []withdrawStatListModel
  120. }
  121. withdrawStatList struct {
  122. database.Trans_base
  123. In withdrawStatList_in
  124. Out withdrawStatList_out
  125. }
  126. )
  127. func NewWithdrawStatList() *withdrawStatList {
  128. return &withdrawStatList{}
  129. }
  130. func (this *withdrawStatList) DoAction(ch chan<- interface{}) {
  131. defer func() {
  132. if err := recover(); err != nil {
  133. log.Release("transaction recover err %v", err)
  134. log.Release("%s", debug.Stack())
  135. }
  136. if ch != nil {
  137. ch <- this
  138. }
  139. }()
  140. statement := database.NewStatement()
  141. statement.SetNeedReturnValue(false)
  142. statement.SetOpenRecordSet(true)
  143. statement.SetProcName("Manage_Withdraw_GetStatList")
  144. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  145. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  146. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  147. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  148. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  149. statement.AddParamter("@WithdrawAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.WithdrawAmount)
  150. statement.AddParamter("@SuccessAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.SuccessAmount)
  151. statement.AddParamter("@CurrWithdraw", database.AdParamOutput, database.AdBigint, 8, this.Out.CurrWithdraw)
  152. statement.AddParamter("@CurrSuccessAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.CurrSuccessAmount)
  153. sqlstring := statement.GenSql()
  154. retRows := CenterDB.ExecSql(sqlstring)
  155. rowLen := len(retRows)
  156. if rowLen <= 0 {
  157. this.State = false
  158. return
  159. }
  160. this.State = true
  161. if rowLen > 1 {
  162. this.Out.List = make([]withdrawStatListModel, rowLen-1)
  163. for i := 0; i < rowLen-1; i++ {
  164. ret := retRows[i]
  165. out := &this.Out.List[i]
  166. out.DateFlag = (*ret[0].(*interface{})).(string)
  167. out.WithdrawAmount = int((*ret[1].(*interface{})).(int64))
  168. out.UserCount = int((*ret[2].(*interface{})).(int64))
  169. out.SuccessAmount = int((*ret[3].(*interface{})).(int64))
  170. }
  171. }
  172. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  173. this.Out.WithdrawAmount = int((*retRows[rowLen-1][1].(*interface{})).(int64))
  174. this.Out.SuccessAmount = int((*retRows[rowLen-1][2].(*interface{})).(int64))
  175. this.Out.CurrWithdraw = int((*retRows[rowLen-1][3].(*interface{})).(int64))
  176. this.Out.CurrSuccessAmount = int((*retRows[rowLen-1][4].(*interface{})).(int64))
  177. }
  178. // 提现排行
  179. type (
  180. withdrawRank_in struct {
  181. BeginTime string // 开始时间
  182. EndTime string // 截止时间
  183. }
  184. withdrawRankInfo struct {
  185. Rid int // 排序
  186. UserID int // 用户ID
  187. NickName string // 昵称
  188. TotalAmount int // 金额
  189. }
  190. withdrawRank_out struct {
  191. RecordCount int // 记录数
  192. List []withdrawRankInfo
  193. }
  194. withdrawRank struct {
  195. database.Trans_base
  196. In withdrawRank_in
  197. Out withdrawRank_out
  198. }
  199. )
  200. func NewWithdrawRank() *withdrawRank {
  201. return &withdrawRank{}
  202. }
  203. func (this *withdrawRank) DoAction(ch chan<- interface{}) {
  204. defer func() {
  205. if err := recover(); err != nil {
  206. log.Release("transaction recover fail %v", err)
  207. log.Release("%s", debug.Stack())
  208. }
  209. if ch != nil {
  210. ch <- this
  211. }
  212. }()
  213. statement := database.NewStatement()
  214. statement.SetNeedReturnValue(false)
  215. statement.SetOpenRecordSet(true)
  216. statement.SetProcName("Manage_Withdraw_GetRank")
  217. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  218. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  219. sqlstring := statement.GenSql()
  220. retRows := CenterDB.ExecSql(sqlstring)
  221. rowLen := len(retRows)
  222. if rowLen <= 0 {
  223. this.State = false
  224. return
  225. }
  226. this.State = true
  227. this.Out.List = make([]withdrawRankInfo, rowLen)
  228. for i := 0; i < rowLen; i++ {
  229. ret := retRows[i]
  230. out := &this.Out.List[i]
  231. out.Rid = int((*ret[0].(*interface{})).(int64))
  232. out.UserID = int((*ret[1].(*interface{})).(int64))
  233. out.NickName = (*ret[2].(*interface{})).(string)
  234. if info := tagMgr.getInfo(out.UserID); info != nil {
  235. out.NickName = info.NickName
  236. }
  237. out.TotalAmount = int((*ret[3].(*interface{})).(int64))
  238. }
  239. }
  240. // 提现审核列表
  241. type (
  242. withdrawAuditList_in struct {
  243. BeginTime string // 起始时间
  244. EndTime string // 截止时间
  245. PageIndex int // 页索引
  246. PageSize int // 页大小
  247. }
  248. withdrawAuditList_out struct {
  249. RecordCount int // 记录数
  250. List []withdrawAuditModel
  251. }
  252. withdrawAuditModel struct {
  253. OrderID string // 订单号
  254. UserID int // 用户ID
  255. NickName string // 昵称
  256. BetAmount int // 流水
  257. WithdrawTimes int // 提现次数
  258. WithdrawAmount int // 提现金额
  259. Amount int // 申请金额
  260. GetStatus int // 状态 (0=下单(无审核) 1=待审核 2=已审核 3=提现成功(审核) 4=提现成功(无审核) 11=拒绝)
  261. Crdate string // 创建时间(申请时间)
  262. NotifyTime string // 提现时间
  263. RealName string // 真实姓名
  264. BankCard string // 银行卡
  265. BankName string // 银行名称
  266. Mobile string // 电话
  267. EMail string // email
  268. Address string // 地址
  269. SourceName string // 源
  270. }
  271. withdrawAuditList struct {
  272. database.Trans_base
  273. In withdrawAuditList_in
  274. Out withdrawAuditList_out
  275. }
  276. )
  277. func NewWithdrawAuditList() *withdrawAuditList {
  278. return &withdrawAuditList{}
  279. }
  280. func (this *withdrawAuditList) DoAction(ch chan<- interface{}) {
  281. defer func() {
  282. if err := recover(); err != nil {
  283. log.Release("transaction recover err %v", err)
  284. log.Release("%s", debug.Stack())
  285. }
  286. if ch != nil {
  287. ch <- this
  288. }
  289. }()
  290. statement := database.NewStatement()
  291. statement.SetNeedReturnValue(false)
  292. statement.SetOpenRecordSet(true)
  293. statement.SetProcName("Manage_Withdraw_GetAuditList")
  294. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  295. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  296. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  297. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  298. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  299. sqlstring := statement.GenSql()
  300. retRow := CenterDB.ExecSql(sqlstring)
  301. rowLen := len(retRow)
  302. if rowLen <= 0 {
  303. this.State = false
  304. return
  305. }
  306. this.State = true
  307. if rowLen > 1 {
  308. this.Out.List = make([]withdrawAuditModel, rowLen-1)
  309. for i := 0; i < rowLen-1; i++ {
  310. ret := retRow[i]
  311. out := &this.Out.List[i]
  312. out.OrderID = (*ret[0].(*interface{})).(string)
  313. out.UserID = int((*ret[1].(*interface{})).(int64))
  314. out.NickName = (*ret[2].(*interface{})).(string)
  315. if info := tagMgr.getInfo(out.UserID); info != nil {
  316. out.NickName = info.NickName
  317. }
  318. out.BetAmount = int((*ret[3].(*interface{})).(int64))
  319. out.WithdrawTimes = int((*ret[4].(*interface{})).(int64))
  320. out.WithdrawAmount = int((*ret[5].(*interface{})).(int64))
  321. out.Amount = int((*ret[6].(*interface{})).(int64))
  322. out.GetStatus = int((*ret[7].(*interface{})).(int64))
  323. out.Crdate = (*ret[8].(*interface{})).(string)
  324. out.NotifyTime = (*ret[9].(*interface{})).(string)
  325. out.RealName = (*ret[10].(*interface{})).(string)
  326. out.BankCard = (*ret[11].(*interface{})).(string)
  327. out.BankName = (*ret[12].(*interface{})).(string)
  328. out.Mobile = (*ret[13].(*interface{})).(string)
  329. out.EMail = (*ret[14].(*interface{})).(string)
  330. out.Address = (*ret[15].(*interface{})).(string)
  331. out.SourceName = (*ret[16].(*interface{})).(string)
  332. }
  333. }
  334. this.Out.RecordCount = int((*retRow[rowLen-1][0].(*interface{})).(int64))
  335. }
  336. // 提现日志
  337. type (
  338. withdrawFlashLog_in struct {
  339. UserID int // 用户ID
  340. BeginTime string // 开始时间
  341. EndTime string // 截止时间
  342. PageIndex int // 页索引
  343. PageSize int // 页大小
  344. }
  345. withdrawFlashLogInfo struct {
  346. OrderID string // 订单号
  347. TradeID string // 交易号
  348. UserID int // 用户ID
  349. NickName string // 用户昵称
  350. Amount int // 金额
  351. RealAmount int // 实际扣除金额
  352. DfTransactionId string // 平台代付单号,32字符以内
  353. GetStatus int // 状态 (0=下单(无审核) 1=待审核 2=已审核 3=提现成功(审核) 4=提现成功(无审核) 13=Pending(审核) 14=Pending(无审核) 11=拒绝
  354. // 251=提现失败(无审核) 252=提现失败(审核) 255=提现失败)
  355. DfDesc string // 代付状态描述
  356. Balance int // 余额
  357. NotifyTime string // 通知时间
  358. Crdate string // 下单时间
  359. }
  360. withdrawFlashLog_out struct {
  361. RecordCount int //记录数
  362. TotalAmount int //总金币
  363. List []withdrawFlashLogInfo
  364. }
  365. withdrawFlashLog struct {
  366. database.Trans_base
  367. In withdrawFlashLog_in
  368. Out withdrawFlashLog_out
  369. }
  370. )
  371. func NewWithdrawFlashLog() *withdrawFlashLog {
  372. return &withdrawFlashLog{}
  373. }
  374. func (this *withdrawFlashLog) DoAction(ch chan<- interface{}) {
  375. defer func() {
  376. if err := recover(); err != nil {
  377. log.Release("transaction recover fail %v", err)
  378. log.Release("%s", debug.Stack())
  379. }
  380. if ch != nil {
  381. ch <- this
  382. }
  383. }()
  384. statement := database.NewStatement()
  385. statement.SetNeedReturnValue(false)
  386. statement.SetOpenRecordSet(true)
  387. statement.SetProcName("Manage_FlashWithdraw_GetLog")
  388. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  389. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  390. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  391. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  392. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  393. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  394. statement.AddParamter("@TotalAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.TotalAmount)
  395. sqlstring := statement.GenSql()
  396. retRows := CenterDB.ExecSql(sqlstring)
  397. rowLen := len(retRows)
  398. if rowLen <= 0 {
  399. this.State = false
  400. return
  401. }
  402. this.State = true
  403. if rowLen > 1 {
  404. this.Out.List = make([]withdrawFlashLogInfo, rowLen-1)
  405. for i := 0; i < rowLen-1; i++ {
  406. ret := retRows[i]
  407. out := &this.Out.List[i]
  408. out.OrderID = (*ret[0].(*interface{})).(string)
  409. out.TradeID = (*ret[1].(*interface{})).(string)
  410. out.UserID = int((*ret[2].(*interface{})).(int64))
  411. out.NickName = (*ret[3].(*interface{})).(string)
  412. if info := tagMgr.getInfo(out.UserID); info != nil {
  413. out.NickName = info.NickName
  414. }
  415. out.Amount = int((*ret[4].(*interface{})).(int64))
  416. out.RealAmount = int((*ret[5].(*interface{})).(int64))
  417. out.DfTransactionId = (*ret[6].(*interface{})).(string)
  418. out.GetStatus = int((*ret[7].(*interface{})).(int64))
  419. out.DfDesc = (*ret[8].(*interface{})).(string)
  420. out.Balance = int((*ret[9].(*interface{})).(int64))
  421. out.NotifyTime = (*ret[10].(*interface{})).(string)
  422. out.Crdate = (*ret[11].(*interface{})).(string)
  423. }
  424. }
  425. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  426. this.Out.TotalAmount = int((*retRows[rowLen-1][1].(*interface{})).(int64))
  427. }