chip.go 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. package dao
  2. import (
  3. "bet24.com/servers/adminserver/ip"
  4. "runtime/debug"
  5. "strconv"
  6. "bet24.com/database"
  7. "bet24.com/log"
  8. )
  9. // 金币日志
  10. type (
  11. getChipLog_in struct {
  12. UserID int // 用户ID
  13. PartnerID int // 渠道ID
  14. SourceName string // 应用名称
  15. BeginTime string // 开始时间
  16. EndTime string // 截止时间
  17. PageIndex int // 页索引
  18. PageSize int // 页大小
  19. }
  20. getChipLogInfo struct {
  21. LogID int // 标识
  22. SourceName string // 源名称
  23. MoneyType string // 货币类型
  24. UserID int // 用户ID
  25. NickName string // 昵称
  26. CurrentAmount int // 当前金额
  27. ModifyAmount int // 修改金额
  28. StillAmount int // 剩余金额
  29. Remark string // 备注
  30. IPAddress string // IP地址
  31. Crdate string // 时间
  32. PartnerName string // 渠道名称
  33. TaxAmount int // 台费
  34. }
  35. getChipLog_out struct {
  36. RecordCount int // 记录数
  37. List []getChipLogInfo
  38. }
  39. getChipLog struct {
  40. database.Trans_base
  41. In getChipLog_in
  42. Out getChipLog_out
  43. }
  44. )
  45. func NewGetChipLog() *getChipLog {
  46. return &getChipLog{}
  47. }
  48. func (this *getChipLog) DoAction(ch chan<- interface{}) {
  49. defer func() {
  50. if err := recover(); err != nil {
  51. log.Release("transaction recover fail %v", err)
  52. log.Release("%s", debug.Stack())
  53. }
  54. if ch != nil {
  55. ch <- this
  56. }
  57. }()
  58. statement := database.NewStatement()
  59. statement.SetNeedReturnValue(false)
  60. statement.SetOpenRecordSet(true)
  61. statement.SetProcName("Manage_Chip_GetCashLog")
  62. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  63. statement.AddParamter("@PartnerID", database.AdParamInput, database.AdInteger, 4, this.In.PartnerID)
  64. statement.AddParamter("@SourceName", database.AdParamInput, database.AdNVarChar, 32, this.In.SourceName)
  65. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  66. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  67. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  68. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  69. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  70. sqlstring := statement.GenSql()
  71. retRows := CenterDB.ExecSql(sqlstring)
  72. rowLen := len(retRows)
  73. if rowLen <= 0 {
  74. this.State = false
  75. return
  76. }
  77. this.State = true
  78. if rowLen > 1 {
  79. this.Out.List = make([]getChipLogInfo, rowLen-1)
  80. for i := 0; i < rowLen-1; i++ {
  81. ret := retRows[i]
  82. out := &this.Out.List[i]
  83. out.LogID = int((*ret[0].(*interface{})).(int64))
  84. out.SourceName = (*ret[1].(*interface{})).(string)
  85. out.MoneyType = (*ret[2].(*interface{})).(string)
  86. out.UserID = int((*ret[3].(*interface{})).(int64))
  87. out.NickName = (*ret[4].(*interface{})).(string)
  88. if info := tagMgr.getInfo(out.UserID); info != nil {
  89. out.NickName = info.NickName
  90. }
  91. out.CurrentAmount = int((*ret[5].(*interface{})).(int64))
  92. out.ModifyAmount = int((*ret[6].(*interface{})).(int64))
  93. out.StillAmount = int((*ret[7].(*interface{})).(int64))
  94. out.Remark = (*ret[8].(*interface{})).(string)
  95. out.IPAddress = (*ret[9].(*interface{})).(string)
  96. out.IPAddress = ip.GetCountryAndRegion(out.IPAddress, false)
  97. out.Crdate = (*ret[10].(*interface{})).(string)
  98. out.PartnerName = (*ret[11].(*interface{})).(string)
  99. out.TaxAmount = int((*ret[12].(*interface{})).(int64))
  100. }
  101. }
  102. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  103. }
  104. // 加金
  105. type (
  106. chipSend_in struct {
  107. OpUserID int // 操作员ID
  108. OpUserName string // 操作员名称
  109. UserID int // 用户ID
  110. SourceName string // 应用名称
  111. Reason string // 原因
  112. WantAmount int // 操作金额
  113. WantBank int // 操作保险柜
  114. IpAddress string // IP地址
  115. }
  116. chipSend_out struct {
  117. RetCode int // 操作结果
  118. ErrorMsg string // 操作描述
  119. }
  120. chipSend struct {
  121. database.Trans_base
  122. In chipSend_in
  123. Out chipSend_out
  124. }
  125. )
  126. func NewChipSend() *chipSend {
  127. return &chipSend{}
  128. }
  129. func (this *chipSend) DoAction(ch chan<- interface{}) {
  130. defer func() {
  131. if err := recover(); err != nil {
  132. log.Release("transaction recover fail %v", err)
  133. log.Release("%s", debug.Stack())
  134. }
  135. if ch != nil {
  136. ch <- this
  137. }
  138. }()
  139. statement := database.NewStatement()
  140. statement.SetNeedReturnValue(false)
  141. statement.SetOpenRecordSet(true)
  142. statement.SetProcName("Manage_Chip_SendCoin")
  143. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  144. statement.AddParamter("@SourceName", database.AdParamInput, database.AdNVarChar, 32, this.In.SourceName)
  145. statement.AddParamter("@Reason", database.AdParamInput, database.AdNVarChar, 128, this.In.Reason)
  146. statement.AddParamter("@WantAmount", database.AdParamInput, database.AdBigint, 8, this.In.WantAmount)
  147. statement.AddParamter("@IPAddress", database.AdParamInput, database.AdVarChar, 16, this.In.IpAddress)
  148. statement.AddParamter("@OpUserID", database.AdParamInput, database.AdInteger, 4, this.In.OpUserID)
  149. statement.AddParamter("@OpUserName", database.AdParamInput, database.AdVarChar, 32, this.In.OpUserName)
  150. statement.AddParamter("@RetCode", database.AdParamOutput, database.AdInteger, 4, this.Out.RetCode)
  151. statement.AddParamter("@ErrorMsg", database.AdParamOutput, database.AdNVarChar, 64, this.Out.ErrorMsg)
  152. sqlstring := statement.GenSql()
  153. retRows := CenterDB.ExecSql(sqlstring)
  154. rowLen := len(retRows)
  155. if rowLen <= 0 {
  156. this.State = false
  157. return
  158. }
  159. this.State = true
  160. this.Out.RetCode = int((*retRows[0][0].(*interface{})).(int64))
  161. this.Out.ErrorMsg = (*retRows[0][1].(*interface{})).(string)
  162. }
  163. // 扣金
  164. type (
  165. chipDel_in struct {
  166. OpUserID int // 操作员ID
  167. OpUserName string // 操作员名称
  168. UserID int // 用户ID
  169. SourceName string // 应用名称
  170. Reason string // 原因
  171. WantAmount int // 操作金额
  172. WantBank int // 操作保险柜
  173. IpAddress string // IP地址
  174. }
  175. chipDel_out struct {
  176. RetCode int // 操作结果
  177. ErrorMsg string // 操作描述
  178. }
  179. chipDel struct {
  180. database.Trans_base
  181. In chipDel_in
  182. Out chipDel_out
  183. }
  184. )
  185. func NewChipDel() *chipDel {
  186. return &chipDel{}
  187. }
  188. func (this *chipDel) DoAction(ch chan<- interface{}) {
  189. defer func() {
  190. if err := recover(); err != nil {
  191. log.Release("transaction recover fail %v", err)
  192. log.Release("%s", debug.Stack())
  193. }
  194. if ch != nil {
  195. ch <- this
  196. }
  197. }()
  198. statement := database.NewStatement()
  199. statement.SetNeedReturnValue(false)
  200. statement.SetOpenRecordSet(true)
  201. statement.SetProcName("Manage_Chip_DelCoin")
  202. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  203. statement.AddParamter("@SourceName", database.AdParamInput, database.AdVarChar, 32, this.In.SourceName)
  204. statement.AddParamter("@Reason", database.AdParamInput, database.AdVarChar, 128, this.In.Reason)
  205. statement.AddParamter("@WantAmount", database.AdParamInput, database.AdBigint, 8, this.In.WantAmount)
  206. statement.AddParamter("@WantBank", database.AdParamInput, database.AdBigint, 8, this.In.WantBank)
  207. statement.AddParamter("@IPAddress", database.AdParamInput, database.AdVarChar, 16, this.In.IpAddress)
  208. statement.AddParamter("@OpUserID", database.AdParamInput, database.AdInteger, 4, this.In.OpUserID)
  209. statement.AddParamter("@OpUserName", database.AdParamInput, database.AdVarChar, 32, this.In.OpUserName)
  210. statement.AddParamter("@RetCode", database.AdParamOutput, database.AdInteger, 4, this.Out.RetCode)
  211. statement.AddParamter("@ErrorMsg", database.AdParamOutput, database.AdNVarChar, 128, this.Out.ErrorMsg)
  212. sqlstring := statement.GenSql()
  213. retRows := CenterDB.ExecSql(sqlstring)
  214. rowLen := len(retRows)
  215. if rowLen <= 0 {
  216. this.State = false
  217. return
  218. }
  219. this.State = true
  220. this.Out.RetCode = int((*retRows[0][0].(*interface{})).(int64))
  221. this.Out.ErrorMsg = (*retRows[0][1].(*interface{})).(string)
  222. }
  223. // 筹码统计
  224. type (
  225. chipStat_in struct {
  226. BeginTime string // 开始时间
  227. EndTime string // 截止时间
  228. }
  229. chipStatInfo struct {
  230. LogType int // 日志类型
  231. LogTypeName string // 日志类型名称
  232. GameID int // 游戏ID
  233. ChineseName string // 游戏名
  234. Amount int // 金额
  235. SendAmount int // 发行金额
  236. DelAmount int // 消耗金额
  237. DiffAmount int // 差额
  238. }
  239. chipStat_out struct {
  240. Send int // 总发行
  241. Consume int // 总消耗
  242. GameSend int // 游戏发行
  243. GameConsume int // 游戏消耗
  244. GameDiff int // 游戏差额
  245. Cash int // 金币总额
  246. Bank int // 保险柜总额
  247. YesterdayAmount int // 前日总额
  248. CurrAmount int // 当前总额
  249. List []chipStatInfo
  250. }
  251. chipStat struct {
  252. database.Trans_base
  253. In chipStat_in
  254. Out chipStat_out
  255. }
  256. )
  257. func NewChipStat() *chipStat {
  258. return &chipStat{}
  259. }
  260. func (this *chipStat) DoAction(ch chan<- interface{}) {
  261. defer func() {
  262. if err := recover(); err != nil {
  263. log.Release("transaction recover fail %v", err)
  264. log.Release("%s", debug.Stack())
  265. }
  266. if ch != nil {
  267. ch <- this
  268. }
  269. }()
  270. statement := database.NewStatement()
  271. statement.SetNeedReturnValue(false)
  272. statement.SetOpenRecordSet(true)
  273. statement.SetProcName("Manage_ChipStat_GetList")
  274. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  275. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  276. statement.AddParamter("@Send", database.AdParamOutput, database.AdBigint, 8, this.Out.Send)
  277. statement.AddParamter("@Consume", database.AdParamOutput, database.AdBigint, 8, this.Out.Consume)
  278. statement.AddParamter("@GameSend", database.AdParamOutput, database.AdBigint, 8, this.Out.GameSend)
  279. statement.AddParamter("@GameConsume", database.AdParamOutput, database.AdBigint, 8, this.Out.GameConsume)
  280. statement.AddParamter("@GameDiff", database.AdParamOutput, database.AdBigint, 8, this.Out.GameDiff)
  281. statement.AddParamter("@Cash", database.AdParamOutput, database.AdBigint, 8, this.Out.Cash)
  282. statement.AddParamter("@Bank", database.AdParamOutput, database.AdBigint, 8, this.Out.Bank)
  283. statement.AddParamter("@YesterdayAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.YesterdayAmount)
  284. statement.AddParamter("@CurrAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.CurrAmount)
  285. sqlstring := statement.GenSql()
  286. retRows := CenterDB.ExecSql(sqlstring)
  287. rowLen := len(retRows)
  288. if rowLen <= 0 {
  289. this.State = false
  290. return
  291. }
  292. this.State = true
  293. if rowLen > 1 {
  294. this.Out.List = make([]chipStatInfo, rowLen-1)
  295. for i := 0; i < rowLen-1; i++ {
  296. ret := retRows[i]
  297. out := &this.Out.List[i]
  298. out.LogType = int((*ret[0].(*interface{})).(int64))
  299. out.LogTypeName = (*ret[1].(*interface{})).(string)
  300. out.GameID = int((*ret[2].(*interface{})).(int64))
  301. out.Amount = int((*ret[3].(*interface{})).(int64))
  302. out.ChineseName = (*ret[4].(*interface{})).(string)
  303. out.SendAmount = int((*ret[5].(*interface{})).(int64))
  304. out.DelAmount = int((*ret[6].(*interface{})).(int64))
  305. out.DiffAmount = int((*ret[7].(*interface{})).(int64))
  306. }
  307. }
  308. ret := retRows[rowLen-1]
  309. this.Out.Send = int((*ret[0].(*interface{})).(int64))
  310. this.Out.Consume = int((*ret[1].(*interface{})).(int64))
  311. this.Out.GameSend = int((*ret[2].(*interface{})).(int64))
  312. this.Out.GameConsume = int((*ret[3].(*interface{})).(int64))
  313. this.Out.GameDiff = int((*ret[4].(*interface{})).(int64))
  314. this.Out.Cash = int((*ret[5].(*interface{})).(int64))
  315. this.Out.Bank = int((*ret[6].(*interface{})).(int64))
  316. this.Out.YesterdayAmount = int((*ret[7].(*interface{})).(int64))
  317. this.Out.CurrAmount = int((*ret[8].(*interface{})).(int64))
  318. }
  319. // 筹码变化
  320. type (
  321. getUserChipStatList_in struct {
  322. UserID int // 用户ID
  323. IsGameWin int // 是否输赢
  324. BeginTime string // 起始时间
  325. EndTime string // 截止时间
  326. PageIndex int // 页索引
  327. PageSize int // 页大小
  328. }
  329. getUserChipStatListModel struct {
  330. RowNumber int // 行号
  331. UserID int // UserID
  332. NickName string // 昵称
  333. MoneySum int // 金币变化
  334. }
  335. getUserChipStatList_out struct {
  336. RecordCount int // 记录数
  337. TotalAmount int // 总计
  338. List []getUserChipStatListModel
  339. }
  340. getUserChipStatList struct {
  341. database.Trans_base
  342. In getUserChipStatList_in
  343. Out getUserChipStatList_out
  344. }
  345. )
  346. func NewGetUserChipStatList() *getUserChipStatList {
  347. return &getUserChipStatList{}
  348. }
  349. func (this *getUserChipStatList) DoAction(ch chan<- interface{}) {
  350. defer func() {
  351. if err := recover(); err != nil {
  352. log.Release("transaction recover err %v", err)
  353. log.Release("%s", debug.Stack())
  354. }
  355. if ch != nil {
  356. ch <- this
  357. }
  358. }()
  359. statement := database.NewStatement()
  360. statement.SetNeedReturnValue(false)
  361. statement.SetOpenRecordSet(true)
  362. statement.SetProcName("Manage_AllUser_GetChipStatList")
  363. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  364. statement.AddParamter("@IsGameWin", database.AdParamInput, database.AdInteger, 4, this.In.IsGameWin)
  365. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  366. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  367. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  368. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  369. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  370. statement.AddParamter("@TotalAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.TotalAmount)
  371. sqlstring := statement.GenSql()
  372. //log.Debug(sqlstring)
  373. retRows := CenterDB.ExecSql(sqlstring)
  374. rowLen := len(retRows)
  375. if rowLen <= 0 {
  376. this.State = false
  377. return
  378. }
  379. this.State = true
  380. if rowLen > 1 {
  381. this.Out.List = make([]getUserChipStatListModel, rowLen-1)
  382. for i := 0; i < rowLen-1; i++ {
  383. ret := retRows[i]
  384. out := &this.Out.List[i]
  385. out.RowNumber = int((*ret[0].(*interface{})).(int64))
  386. out.UserID = int((*ret[1].(*interface{})).(int64))
  387. out.NickName = (*ret[2].(*interface{})).(string)
  388. if info := tagMgr.getInfo(out.UserID); info != nil {
  389. out.NickName = info.NickName
  390. }
  391. out.MoneySum = int((*ret[3].(*interface{})).(int64))
  392. }
  393. }
  394. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  395. this.Out.TotalAmount = int((*retRows[rowLen-1][1].(*interface{})).(int64))
  396. }
  397. // 用户筹码变化详情
  398. type (
  399. getChipStatDetail_in struct {
  400. UserID int // 用户ID
  401. StartTime string // 开始时间
  402. EndTime string // 截止时间
  403. IsGameWin int // 是否游戏输入
  404. }
  405. getChipStatDetailModel struct {
  406. DataFlag string `json:"dateFlag"` // 日期
  407. ChineseName string `json:"chineseName"` // 游戏名
  408. LogTypeName string `json:"logTypeName"` // 日志类型
  409. MoneySum string `json:"moneySum"` // 数量
  410. UserID int `json:"userID"` // 用户ID
  411. NickName string `json:"nickName"` // 昵称
  412. }
  413. getChipStatDetail_out struct {
  414. RecordCount int
  415. List []getChipStatDetailModel
  416. }
  417. getChipStatDetail struct {
  418. database.Trans_base
  419. In getChipStatDetail_in
  420. Out getChipStatDetail_out
  421. }
  422. )
  423. func NewGetChipStatDetail() *getChipStatDetail {
  424. return &getChipStatDetail{}
  425. }
  426. func (this *getChipStatDetail) DoAction(ch chan<- interface{}) {
  427. defer func() {
  428. if err := recover(); err != nil {
  429. log.Release("transaction recover err %v", err)
  430. log.Release("%s", debug.Stack())
  431. }
  432. if ch != nil {
  433. ch <- this
  434. }
  435. }()
  436. statement := database.NewStatement()
  437. statement.SetNeedReturnValue(false)
  438. statement.SetOpenRecordSet(true)
  439. statement.SetProcName("Manage_AllUser_GetChipStatDetail")
  440. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  441. statement.AddParamter("@StartTime", database.AdParamInput, database.AdVarChar, 20, this.In.StartTime)
  442. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  443. statement.AddParamter("@IsGameWin", database.AdParamInput, database.AdInteger, 4, this.In.IsGameWin)
  444. sqlstring := statement.GenSql()
  445. retRows := CenterDB.ExecSql(sqlstring)
  446. rowLen := len(retRows)
  447. if rowLen <= 0 {
  448. this.State = false
  449. return
  450. }
  451. this.State = true
  452. this.Out.List = make([]getChipStatDetailModel, rowLen)
  453. for i := 0; i < rowLen; i++ {
  454. ret := retRows[i]
  455. out := &this.Out.List[i]
  456. out.DataFlag = (*ret[0].(*interface{})).(string)
  457. out.ChineseName = (*ret[1].(*interface{})).(string)
  458. out.LogTypeName = (*ret[2].(*interface{})).(string)
  459. moneySum := int((*ret[3].(*interface{})).(int64))
  460. out.MoneySum = strconv.Itoa(moneySum)
  461. out.UserID = int((*ret[4].(*interface{})).(int64))
  462. out.NickName = (*ret[5].(*interface{})).(string)
  463. if info := tagMgr.getInfo(out.UserID); info != nil {
  464. out.NickName = info.NickName
  465. }
  466. }
  467. }
  468. // 后台管理--导出金币变化
  469. type (
  470. chipStatExport_in struct {
  471. BeginTime string // 开始时间
  472. EndTime string // 截止时间
  473. }
  474. chipStatExportModel struct {
  475. UserID int // 用户ID
  476. NickName string // 昵称
  477. PartnerName string // 渠道名称
  478. InvestAmount int // 投注金额
  479. WinAmount int // 赢金额
  480. SubAmount int // 变化金额
  481. }
  482. chipStatExport_out struct {
  483. RecordCount int // 记录数
  484. List []chipStatExportModel
  485. }
  486. chipStatExport struct {
  487. database.Trans_base
  488. In chipStatExport_in
  489. Out chipStatExport_out
  490. }
  491. )
  492. func NewChipStatExport() *chipStatExport {
  493. return &chipStatExport{}
  494. }
  495. func (this *chipStatExport) DoAction() {
  496. defer func() {
  497. if err := recover(); err != nil {
  498. log.Error("transaction recover err %v", err)
  499. log.Error("%s", debug.Stack())
  500. }
  501. }()
  502. statement := database.NewStatement()
  503. statement.SetNeedReturnValue(false)
  504. statement.SetOpenRecordSet(true)
  505. statement.SetProcName("Manage_AllUser_ExportChipStat")
  506. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  507. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  508. sqlstring := statement.GenSql()
  509. retRows := CenterDB.ExecSql(sqlstring)
  510. rowLen := len(retRows)
  511. if rowLen <= 0 {
  512. return
  513. }
  514. this.Out.List = make([]chipStatExportModel, rowLen)
  515. for i := 0; i < rowLen; i++ {
  516. ret := retRows[i]
  517. out := &this.Out.List[i]
  518. out.UserID = int((*ret[0].(*interface{})).(int64))
  519. out.NickName = (*ret[1].(*interface{})).(string)
  520. if info := tagMgr.getInfo(out.UserID); info != nil {
  521. out.NickName = info.NickName
  522. }
  523. out.PartnerName = (*ret[2].(*interface{})).(string)
  524. out.InvestAmount = int((*ret[3].(*interface{})).(int64))
  525. out.WinAmount = int((*ret[4].(*interface{})).(int64))
  526. out.SubAmount = out.InvestAmount + out.WinAmount
  527. }
  528. }
  529. // 税收总计
  530. type (
  531. chipTaxStatList_in struct {
  532. BeginTime string
  533. EndTime string
  534. }
  535. chipTaxStatListModel struct {
  536. ServerName string
  537. TaxSum int
  538. }
  539. chipTaxStatList_out struct {
  540. TotalTaxAmount int
  541. List []chipTaxStatListModel
  542. }
  543. chipTaxStatList struct {
  544. database.Trans_base
  545. In chipTaxStatList_in
  546. Out chipTaxStatList_out
  547. }
  548. )
  549. func NewChipTaxStatList() *chipTaxStatList {
  550. return &chipTaxStatList{}
  551. }
  552. func (this *chipTaxStatList) DoAction() {
  553. defer func() {
  554. if err := recover(); err != nil {
  555. log.Error("transaction recover err %v", err)
  556. log.Error("%s", debug.Stack())
  557. }
  558. }()
  559. statement := database.NewStatement()
  560. statement.SetNeedReturnValue(false)
  561. statement.SetOpenRecordSet(true)
  562. statement.SetProcName("Manage_ChipTaxStatTotal_GetList")
  563. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  564. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  565. statement.AddParamter("@TotalTaxAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.TotalTaxAmount)
  566. sqlstring := statement.GenSql()
  567. retRows := CenterDB.ExecSql(sqlstring)
  568. rowLen := len(retRows)
  569. if rowLen <= 0 {
  570. return
  571. }
  572. if rowLen > 1 {
  573. this.Out.List = make([]chipTaxStatListModel, rowLen-1)
  574. for i := 0; i < rowLen-1; i++ {
  575. ret := retRows[i]
  576. out := &this.Out.List[i]
  577. out.ServerName = (*ret[0].(*interface{})).(string)
  578. out.TaxSum = int((*ret[1].(*interface{})).(int64))
  579. }
  580. }
  581. this.Out.TotalTaxAmount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  582. }
  583. // 投注日志
  584. type (
  585. getChipBetLog_in struct {
  586. UserID int // 用户ID
  587. GameID int // 游戏ID
  588. BeginTime string // 开始时间
  589. EndTime string // 截止时间
  590. PageIndex int // 页索引
  591. PageSize int // 页大小
  592. }
  593. getChipBetLogInfo struct {
  594. RecordID string // 标识
  595. UserID int // 用户ID
  596. NickName string // 昵称
  597. ChineseName string // 游戏名
  598. BetAmount int // 下注金额
  599. BetTime string // 下注时间
  600. BetZone string // 下注区域
  601. Odds string // 赔率
  602. ResultAmount int // 结算金额
  603. ResultTime string // 结算时间
  604. ResultZone string // 结算区域
  605. WinAmount int // 输赢金额
  606. StillAmount int // 剩余金额
  607. Status int // 状态 0=下注 1=结算
  608. Tax int // 台费
  609. SubSeconds int // 时间差
  610. }
  611. getChipBetLog_out struct {
  612. RecordCount int // 记录数
  613. WinAmount int // 输赢金额
  614. List []getChipBetLogInfo
  615. }
  616. getChipBetLog struct {
  617. database.Trans_base
  618. In getChipBetLog_in
  619. Out getChipBetLog_out
  620. }
  621. )
  622. func NewGetChipBetLog() *getChipBetLog {
  623. return &getChipBetLog{}
  624. }
  625. func (this *getChipBetLog) DoAction(ch chan<- interface{}) {
  626. defer func() {
  627. if err := recover(); err != nil {
  628. log.Release("transaction recover fail %v", err)
  629. log.Release("%s", debug.Stack())
  630. }
  631. if ch != nil {
  632. ch <- this
  633. }
  634. }()
  635. statement := database.NewStatement()
  636. statement.SetNeedReturnValue(false)
  637. statement.SetOpenRecordSet(true)
  638. statement.SetProcName("Manage_Game_GetChipBetLog")
  639. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  640. statement.AddParamter("@GameID", database.AdParamInput, database.AdInteger, 4, this.In.GameID)
  641. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  642. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  643. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  644. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  645. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  646. statement.AddParamter("@WinAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.WinAmount)
  647. sqlstring := statement.GenSql()
  648. retRows := CenterDB.ExecSql(sqlstring)
  649. rowLen := len(retRows)
  650. if rowLen <= 0 {
  651. this.State = false
  652. return
  653. }
  654. this.State = true
  655. if rowLen > 1 {
  656. this.Out.List = make([]getChipBetLogInfo, rowLen-1)
  657. for i := 0; i < rowLen-1; i++ {
  658. ret := retRows[i]
  659. out := &this.Out.List[i]
  660. out.RecordID = (*ret[0].(*interface{})).(string)
  661. out.UserID = int((*ret[1].(*interface{})).(int64))
  662. out.NickName = (*ret[2].(*interface{})).(string)
  663. if info := tagMgr.getInfo(out.UserID); info != nil {
  664. out.NickName = info.NickName
  665. }
  666. out.ChineseName = (*ret[3].(*interface{})).(string)
  667. out.BetAmount = int((*ret[4].(*interface{})).(int64))
  668. out.BetTime = (*ret[5].(*interface{})).(string)
  669. out.BetZone = (*ret[6].(*interface{})).(string)
  670. out.Odds = string((*ret[7].(*interface{})).([]byte))
  671. out.ResultAmount = int((*ret[8].(*interface{})).(int64))
  672. out.ResultTime = (*ret[9].(*interface{})).(string)
  673. out.ResultZone = (*ret[10].(*interface{})).(string)
  674. out.WinAmount = int((*ret[11].(*interface{})).(int64))
  675. out.StillAmount = int((*ret[12].(*interface{})).(int64))
  676. out.Status = int((*ret[13].(*interface{})).(int64))
  677. out.Tax = int((*ret[14].(*interface{})).(int64))
  678. out.SubSeconds = int((*ret[15].(*interface{})).(int64))
  679. }
  680. }
  681. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  682. this.Out.WinAmount = int((*retRows[rowLen-1][1].(*interface{})).(int64))
  683. }
  684. // 筹码排行
  685. type (
  686. chipTop_in struct {
  687. PartnerID int // 渠道ID
  688. PageIndex int // 页索引
  689. PageSize int // 页大小
  690. }
  691. chipTopInfo struct {
  692. Rank int // 名次
  693. PartnerName string // 渠道名称
  694. UserID int // 用户ID
  695. NickName string // 昵称
  696. GoldAmount int // 金币
  697. BankAmount int // 保险柜
  698. PayMoney float64 // 充值金额
  699. }
  700. chipTop_out struct {
  701. RecordCount int // 总记录数
  702. List []chipTopInfo
  703. }
  704. chipTop struct {
  705. database.Trans_base
  706. In chipTop_in
  707. Out chipTop_out
  708. }
  709. )
  710. func NewChipTop() *chipTop {
  711. return &chipTop{}
  712. }
  713. func (this *chipTop) DoAction(ch chan<- interface{}) {
  714. defer func() {
  715. if err := recover(); err != nil {
  716. log.Release("transaction recover fail %v", err)
  717. log.Release("%s", debug.Stack())
  718. }
  719. if ch != nil {
  720. ch <- this
  721. }
  722. }()
  723. statement := database.NewStatement()
  724. statement.SetNeedReturnValue(false)
  725. statement.SetOpenRecordSet(true)
  726. statement.SetProcName("Manage_Chip_GetTop")
  727. statement.AddParamter("@PartnerID", database.AdParamInput, database.AdInteger, 4, this.In.PartnerID)
  728. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  729. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  730. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  731. sqlstring := statement.GenSql()
  732. retRows := CenterDB.ExecSql(sqlstring)
  733. rowLen := len(retRows)
  734. if rowLen <= 0 {
  735. this.State = false
  736. return
  737. }
  738. this.State = true
  739. if rowLen > 1 {
  740. this.Out.List = make([]chipTopInfo, rowLen-1)
  741. for i := 0; i < rowLen-1; i++ {
  742. ret := retRows[i]
  743. out := &this.Out.List[i]
  744. out.Rank = int((*ret[0].(*interface{})).(int64))
  745. out.PartnerName = (*ret[1].(*interface{})).(string)
  746. out.UserID = int((*ret[2].(*interface{})).(int64))
  747. out.NickName = (*ret[3].(*interface{})).(string)
  748. if info := tagMgr.getInfo(out.UserID); info != nil {
  749. out.NickName = info.NickName
  750. }
  751. out.GoldAmount = int((*ret[4].(*interface{})).(int64))
  752. out.BankAmount = int((*ret[5].(*interface{})).(int64))
  753. payMoney := string((*ret[6].(*interface{})).([]byte))
  754. out.PayMoney, _ = strconv.ParseFloat(payMoney, 64)
  755. }
  756. }
  757. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  758. }
  759. // 存量统计
  760. type (
  761. chipStatTotalList_in struct {
  762. BeginTime string // 开始时间
  763. EndTime string // 截止时间
  764. PageIndex int // 页索引
  765. PageSize int // 页大小
  766. }
  767. chipStatTotalInfo struct {
  768. RowNumber int // 序号
  769. Crdate string // 时间
  770. TotalCurrentAmount int64 // 金币存量
  771. TotalBankAmount int64 // 保险柜存量
  772. TotalAmount int64 // 总存量
  773. }
  774. chipStatTotalList_out struct {
  775. RecordCount int // 总记录数
  776. List []chipStatTotalInfo
  777. }
  778. chipStatTotalList struct {
  779. database.Trans_base
  780. In chipStatTotalList_in
  781. Out chipStatTotalList_out
  782. }
  783. )
  784. func NewChipStatTotalList() *chipStatTotalList {
  785. return &chipStatTotalList{}
  786. }
  787. func (this *chipStatTotalList) DoAction(ch chan<- interface{}) {
  788. defer func() {
  789. if err := recover(); err != nil {
  790. log.Release("transaction recover fail %v", err)
  791. log.Release("%s", debug.Stack())
  792. }
  793. if ch != nil {
  794. ch <- this
  795. }
  796. }()
  797. statement := database.NewStatement()
  798. statement.SetNeedReturnValue(false)
  799. statement.SetOpenRecordSet(true)
  800. statement.SetProcName("Manage_ChipStatTotal_GetList")
  801. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  802. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  803. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  804. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  805. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  806. sqlstring := statement.GenSql()
  807. retRows := CenterDB.ExecSql(sqlstring)
  808. rowLen := len(retRows)
  809. if rowLen <= 0 {
  810. this.State = false
  811. return
  812. }
  813. this.State = true
  814. if rowLen > 1 {
  815. this.Out.List = make([]chipStatTotalInfo, rowLen-1)
  816. for i := 0; i < rowLen-1; i++ {
  817. ret := retRows[i]
  818. out := &this.Out.List[i]
  819. out.RowNumber = int((*ret[0].(*interface{})).(int64))
  820. out.Crdate = (*ret[1].(*interface{})).(string)
  821. out.TotalCurrentAmount = (*ret[2].(*interface{})).(int64)
  822. out.TotalBankAmount = (*ret[3].(*interface{})).(int64)
  823. out.TotalAmount = out.TotalCurrentAmount + out.TotalBankAmount
  824. }
  825. }
  826. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  827. }
  828. // 存量统计(每天)
  829. type (
  830. chipStatTotalListByDay_in struct {
  831. BeginTime string // 开始时间
  832. EndTime string // 截止时间
  833. PageIndex int // 页索引
  834. PageSize int // 页大小
  835. }
  836. chipStatTotalByDayInfo struct {
  837. RowNumber int // 序号
  838. Crdate string // 时间
  839. TotalAmount int64 // 总存量
  840. TotalBankAmount int64 // 保险柜存量
  841. TotalCurrentAmount int64 // 金币存量
  842. }
  843. chipStatTotalListByDay_out struct {
  844. RecordCount int // 总记录数
  845. List []chipStatTotalByDayInfo
  846. }
  847. chipStatTotalListByDay struct {
  848. database.Trans_base
  849. In chipStatTotalListByDay_in
  850. Out chipStatTotalListByDay_out
  851. }
  852. )
  853. func NewChipStatTotalListByDay() *chipStatTotalListByDay {
  854. return &chipStatTotalListByDay{}
  855. }
  856. func (this *chipStatTotalListByDay) DoAction(ch chan<- interface{}) {
  857. defer func() {
  858. if err := recover(); err != nil {
  859. log.Release("transaction recover fail %v", err)
  860. log.Release("%s", debug.Stack())
  861. }
  862. if ch != nil {
  863. ch <- this
  864. }
  865. }()
  866. statement := database.NewStatement()
  867. statement.SetNeedReturnValue(false)
  868. statement.SetOpenRecordSet(true)
  869. statement.SetProcName("Manage_ChipStatTotal_GetListByDay")
  870. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  871. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  872. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  873. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  874. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  875. sqlstring := statement.GenSql()
  876. retRows := CenterDB.ExecSql(sqlstring)
  877. rowLen := len(retRows)
  878. if rowLen <= 0 {
  879. this.State = false
  880. return
  881. }
  882. this.State = true
  883. if rowLen > 1 {
  884. this.Out.List = make([]chipStatTotalByDayInfo, rowLen-1)
  885. for i := 0; i < rowLen-1; i++ {
  886. ret := retRows[i]
  887. out := &this.Out.List[i]
  888. out.RowNumber = int((*ret[0].(*interface{})).(int64))
  889. out.Crdate = (*ret[1].(*interface{})).(string)
  890. out.TotalAmount = (*ret[2].(*interface{})).(int64)
  891. out.TotalBankAmount = (*ret[3].(*interface{})).(int64)
  892. out.TotalCurrentAmount = (*ret[4].(*interface{})).(int64)
  893. }
  894. }
  895. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  896. }
  897. // 赠送日志
  898. type (
  899. transferLog_in struct {
  900. UserID int // 账号ID
  901. BeginTime string // 开始时间
  902. EndTime string // 截止时间
  903. PageIndex int // 页索引
  904. PageSize int // 页大小
  905. AcceptUserID int // 接受账号ID
  906. }
  907. transferLogModel struct {
  908. Rid int // 标识
  909. UserID int // 用户ID
  910. NickName string // 昵称
  911. CurrAmount int // 操作前
  912. ModifyAmount int // 操作
  913. StillAmount int // 剩余
  914. Action string // 1=转入 -1=转出
  915. AcceptUserID int // 接收方ID
  916. AcceptNickName string // 接收方昵称
  917. AcceptCurrAmount int // 接收方操作前
  918. AcceptModifyAmount int // 接收方操作
  919. AcceptStillAmount int // 接收方剩余
  920. TaxAmount int // 台费
  921. Remark string // 备注
  922. IPAddress string // IP地址
  923. Crdate string // 时间
  924. }
  925. transferLog_out struct {
  926. RecordCount int // 记录数
  927. OutTotalAmount int // 总转出
  928. InTotalAmount int // 总转入
  929. TotalTaxAmount int // 总台费
  930. List []transferLogModel
  931. }
  932. transferLog struct {
  933. database.Trans_base
  934. In transferLog_in
  935. Out transferLog_out
  936. }
  937. )
  938. func NewTransferLog() *transferLog {
  939. return &transferLog{}
  940. }
  941. func (this *transferLog) DoAction() {
  942. defer func() {
  943. if err := recover(); err != nil {
  944. log.Error("transaction recover err %v", err)
  945. log.Error("%s", debug.Stack())
  946. }
  947. }()
  948. statement := database.NewStatement()
  949. statement.SetNeedReturnValue(false)
  950. statement.SetOpenRecordSet(true)
  951. statement.SetProcName("Manage_Chip_GetTransferLog")
  952. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  953. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  954. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  955. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  956. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  957. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  958. statement.AddParamter("@OutTotalAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.OutTotalAmount)
  959. statement.AddParamter("@InTotalAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.InTotalAmount)
  960. statement.AddParamter("@TotalTaxAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.TotalTaxAmount)
  961. statement.AddParamter("@AcceptUserID", database.AdParamInput, database.AdInteger, 4, this.In.AcceptUserID)
  962. sqlstring := statement.GenSql()
  963. retRows := CenterDB.ExecSql(sqlstring)
  964. rowLen := len(retRows)
  965. if rowLen <= 0 {
  966. return
  967. }
  968. if rowLen > 1 {
  969. this.Out.List = make([]transferLogModel, rowLen-1)
  970. for i := 0; i < rowLen-1; i++ {
  971. ret := retRows[i]
  972. out := &this.Out.List[i]
  973. out.Rid = int((*ret[0].(*interface{})).(int64))
  974. out.UserID = int((*ret[1].(*interface{})).(int64))
  975. out.NickName = (*ret[2].(*interface{})).(string)
  976. if info := tagMgr.getInfo(out.UserID); info != nil {
  977. out.NickName = info.NickName
  978. }
  979. out.CurrAmount = int((*ret[3].(*interface{})).(int64))
  980. out.ModifyAmount = int((*ret[4].(*interface{})).(int64))
  981. out.StillAmount = int((*ret[5].(*interface{})).(int64))
  982. out.Action = (*ret[6].(*interface{})).(string)
  983. out.AcceptUserID = int((*ret[7].(*interface{})).(int64))
  984. out.AcceptNickName = (*ret[8].(*interface{})).(string)
  985. out.AcceptCurrAmount = int((*ret[9].(*interface{})).(int64))
  986. out.AcceptModifyAmount = int((*ret[10].(*interface{})).(int64))
  987. out.AcceptStillAmount = int((*ret[11].(*interface{})).(int64))
  988. out.TaxAmount = int((*ret[12].(*interface{})).(int64))
  989. out.Remark = (*ret[13].(*interface{})).(string)
  990. out.IPAddress = (*ret[14].(*interface{})).(string)
  991. out.IPAddress = ip.GetCountryAndRegion(out.IPAddress, false)
  992. out.Crdate = (*ret[15].(*interface{})).(string)
  993. }
  994. }
  995. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  996. this.Out.OutTotalAmount = int((*retRows[rowLen-1][1].(*interface{})).(int64))
  997. this.Out.InTotalAmount = int((*retRows[rowLen-1][2].(*interface{})).(int64))
  998. this.Out.TotalTaxAmount = int((*retRows[rowLen-1][3].(*interface{})).(int64))
  999. }
  1000. type (
  1001. chipLoginStat_in struct {
  1002. BeginTime string
  1003. EndTime string
  1004. }
  1005. chipLoginStatItem struct {
  1006. DateFlag string
  1007. LoginCount int
  1008. }
  1009. chipLoginStat_out struct {
  1010. RecordCount int
  1011. List []chipLoginStatItem
  1012. }
  1013. chipLoginStat struct {
  1014. database.Trans_base
  1015. In chipLoginStat_in
  1016. Out chipLoginStat_out
  1017. }
  1018. )
  1019. func NewChipLoginStat() *chipLoginStat {
  1020. return &chipLoginStat{}
  1021. }
  1022. func (this *chipLoginStat) DoAction() {
  1023. defer func() {
  1024. if err := recover(); err != nil {
  1025. log.Error("transaction recover err %v", err)
  1026. log.Error("%s", debug.Stack())
  1027. }
  1028. }()
  1029. statement := database.NewStatement()
  1030. statement.SetNeedReturnValue(false)
  1031. statement.SetOpenRecordSet(true)
  1032. statement.SetProcName("Game_ChipLoginStat_GetList")
  1033. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  1034. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  1035. sqlstring := statement.GenSql()
  1036. retRows := CenterDB.ExecSql(sqlstring)
  1037. rowLen := len(retRows)
  1038. if rowLen <= 0 {
  1039. return
  1040. }
  1041. this.Out.List = make([]chipLoginStatItem, rowLen)
  1042. for i := 0; i < rowLen; i++ {
  1043. ret := retRows[i]
  1044. out := &this.Out.List[i]
  1045. out.DateFlag = (*ret[0].(*interface{})).(string)
  1046. out.LoginCount = int((*ret[1].(*interface{})).(int64))
  1047. }
  1048. }
  1049. type (
  1050. behaviorList_in struct {
  1051. UserID int
  1052. BeginTime string
  1053. EndTime string
  1054. PageIndex int
  1055. PageSize int
  1056. }
  1057. behaviorListModel struct {
  1058. UserID int
  1059. SceneName string
  1060. ActTime string
  1061. Amount int
  1062. EndTime string
  1063. StaySeconds int
  1064. StillAmount int
  1065. WinAmount int
  1066. GameCount int
  1067. Status int
  1068. }
  1069. behaviorList_out struct {
  1070. RecordCount int
  1071. List []behaviorListModel
  1072. }
  1073. behaviorList struct {
  1074. database.Trans_base
  1075. In behaviorList_in
  1076. Out behaviorList_out
  1077. }
  1078. )
  1079. func NewBehaviorList() *behaviorList {
  1080. return &behaviorList{}
  1081. }
  1082. func (this *behaviorList) DoAction() {
  1083. defer func() {
  1084. if err := recover(); err != nil {
  1085. log.Error("transaction recover err %v", err)
  1086. log.Error("%s", debug.Stack())
  1087. }
  1088. }()
  1089. statement := database.NewStatement()
  1090. statement.SetNeedReturnValue(false)
  1091. statement.SetOpenRecordSet(true)
  1092. statement.SetProcName("Manage_UserBehavior_GetList")
  1093. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  1094. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  1095. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  1096. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  1097. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  1098. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdParamInput, 4, this.Out.RecordCount)
  1099. sqlstring := statement.GenSql()
  1100. retRows := CenterDB.ExecSql(sqlstring)
  1101. rowLen := len(retRows)
  1102. if rowLen <= 0 {
  1103. return
  1104. }
  1105. if rowLen > 1 {
  1106. this.Out.List = make([]behaviorListModel, rowLen-1)
  1107. for i := 0; i < rowLen-1; i++ {
  1108. ret := retRows[i]
  1109. out := &this.Out.List[i]
  1110. out.UserID = int((*ret[0].(*interface{})).(int64))
  1111. out.SceneName = (*ret[1].(*interface{})).(string)
  1112. out.ActTime = (*ret[2].(*interface{})).(string)
  1113. out.Amount = int((*ret[3].(*interface{})).(int64))
  1114. out.EndTime = (*ret[4].(*interface{})).(string)
  1115. out.StaySeconds = int((*ret[5].(*interface{})).(int64))
  1116. out.StillAmount = int((*ret[6].(*interface{})).(int64))
  1117. out.WinAmount = int((*ret[7].(*interface{})).(int64))
  1118. out.GameCount = int((*ret[8].(*interface{})).(int64))
  1119. out.Status = int((*ret[9].(*interface{})).(int64))
  1120. }
  1121. }
  1122. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  1123. }