log.go 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. package dao
  2. import (
  3. "bet24.com/servers/adminserver/ip"
  4. "fmt"
  5. "runtime/debug"
  6. "strconv"
  7. "bet24.com/database"
  8. "bet24.com/log"
  9. )
  10. // 后台日志列表
  11. type (
  12. logList_in struct {
  13. AdminUserID int //管理员ID
  14. StartTime string //开始时间
  15. EndTime string //截止时间
  16. PageIndex int //页索引
  17. PageSize int //页大小
  18. }
  19. logInfo struct {
  20. AdminLogID int //日志ID
  21. AdminUserID int //管理员ID
  22. AdminUserName string //管理员名称
  23. IPAddress string //IP地址
  24. Msg string //消息
  25. Crdate string //时间
  26. }
  27. logList_out struct {
  28. RecordCount int //记录数
  29. List []logInfo
  30. }
  31. logList struct {
  32. database.Trans_base
  33. In logList_in
  34. Out logList_out
  35. }
  36. )
  37. func NewLogList() *logList {
  38. return &logList{}
  39. }
  40. func (this *logList) DoAction(ch chan<- interface{}) {
  41. defer func() {
  42. if err := recover(); err != nil {
  43. log.Release("transaction recover fail %v", err)
  44. log.Release("%s", debug.Stack())
  45. }
  46. if ch != nil {
  47. ch <- this
  48. }
  49. }()
  50. statement := database.NewStatement()
  51. statement.SetNeedReturnValue(false)
  52. statement.SetOpenRecordSet(true)
  53. statement.SetProcName("Manage_AdminUser_GetLogList")
  54. statement.AddParamter("@AdminUserID", database.AdParamInput, database.AdInteger, 4, this.In.AdminUserID)
  55. statement.AddParamter("@StartTime", database.AdParamInput, database.AdVarChar, 20, this.In.StartTime)
  56. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  57. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  58. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  59. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  60. sqlstring := statement.GenSql()
  61. retRows := CenterDB.ExecSql(sqlstring)
  62. rowLen := len(retRows)
  63. if rowLen <= 0 {
  64. this.State = false
  65. return
  66. }
  67. this.State = true
  68. if rowLen > 1 {
  69. this.Out.List = make([]logInfo, rowLen-1)
  70. for i := 0; i < rowLen-1; i++ {
  71. ret := retRows[i]
  72. out := &this.Out.List[i]
  73. out.AdminLogID = int((*ret[0].(*interface{})).(int64))
  74. out.AdminUserID = int((*ret[1].(*interface{})).(int64))
  75. out.AdminUserName = (*ret[2].(*interface{})).(string)
  76. out.IPAddress = (*ret[3].(*interface{})).(string)
  77. out.IPAddress = ip.GetCountryAndRegion(out.IPAddress, false)
  78. out.Msg = (*ret[4].(*interface{})).(string)
  79. out.Crdate = (*ret[5].(*interface{})).(string)
  80. }
  81. }
  82. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  83. }
  84. // 系统日志列表
  85. type (
  86. sysLogList_in struct {
  87. OpUserID int //管理员ID
  88. StartTime string //开始时间
  89. EndTime string //截止时间
  90. PageIndex int //页索引
  91. PageSize int //页大小
  92. }
  93. sysLogInfo struct {
  94. SysLogID int //日志ID
  95. OpUserID int //管理员ID
  96. OpUserName string //管理员名称
  97. IPAddress string //IP地址
  98. Msg string //消息
  99. Crdate string //时间
  100. }
  101. sysLogList_out struct {
  102. RecordCount int //记录数
  103. List []sysLogInfo
  104. }
  105. sysLogList struct {
  106. database.Trans_base
  107. In sysLogList_in
  108. Out sysLogList_out
  109. }
  110. )
  111. func NewSysLogList() *sysLogList {
  112. return &sysLogList{}
  113. }
  114. func (this *sysLogList) DoAction(ch chan<- interface{}) {
  115. defer func() {
  116. if err := recover(); err != nil {
  117. log.Release("transaction recover fail %v", err)
  118. log.Release("%s", debug.Stack())
  119. }
  120. if ch != nil {
  121. ch <- this
  122. }
  123. }()
  124. statement := database.NewStatement()
  125. statement.SetNeedReturnValue(false)
  126. statement.SetOpenRecordSet(true)
  127. statement.SetProcName("Manage_SysLog_GetList")
  128. statement.AddParamter("@OpUserID", database.AdParamInput, database.AdInteger, 4, this.In.OpUserID)
  129. statement.AddParamter("@StartTime", database.AdParamInput, database.AdVarChar, 20, this.In.StartTime)
  130. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  131. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  132. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  133. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  134. sqlstring := statement.GenSql()
  135. retRows := CenterDB.ExecSql(sqlstring)
  136. rowLen := len(retRows)
  137. if rowLen <= 0 {
  138. this.State = false
  139. return
  140. }
  141. this.State = true
  142. if rowLen > 1 {
  143. this.Out.List = make([]sysLogInfo, rowLen-1)
  144. for i := 0; i < rowLen-1; i++ {
  145. ret := retRows[i]
  146. out := &this.Out.List[i]
  147. out.SysLogID = int((*ret[0].(*interface{})).(int64))
  148. out.OpUserID = int((*ret[1].(*interface{})).(int64))
  149. out.OpUserName = (*ret[2].(*interface{})).(string)
  150. out.IPAddress = (*ret[3].(*interface{})).(string)
  151. out.IPAddress = ip.GetCountryAndRegion(out.IPAddress, false)
  152. out.Msg = (*ret[4].(*interface{})).(string)
  153. out.Crdate = (*ret[5].(*interface{})).(string)
  154. }
  155. }
  156. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  157. }
  158. // 登录日志列表
  159. type (
  160. loginLogList_in struct {
  161. UserID int //用户ID
  162. NickName string //昵称
  163. BeginTime string //开始时间
  164. EndTime string //截止时间
  165. PageIndex int //页索引
  166. PageSize int //页大小
  167. }
  168. loginLogInfo struct {
  169. LogID int //标识
  170. UserID int //用户ID
  171. NickName string //昵称
  172. IMei string //IP地址
  173. PartnerName string //渠道
  174. Version int //版本号
  175. LoginType string //登录方式
  176. IPAddress string //IP地址
  177. Crdate string //时间
  178. DeviceName string // 设备名称
  179. }
  180. loginLogList_out struct {
  181. RecordCount int //记录数
  182. List []loginLogInfo
  183. }
  184. loginLogList struct {
  185. database.Trans_base
  186. In loginLogList_in
  187. Out loginLogList_out
  188. }
  189. )
  190. func NewLoginLogList() *loginLogList {
  191. return &loginLogList{}
  192. }
  193. func (this *loginLogList) DoAction(ch chan<- interface{}) {
  194. defer func() {
  195. if err := recover(); err != nil {
  196. log.Release("transaction recover fail %v", err)
  197. log.Release("%s", debug.Stack())
  198. }
  199. if ch != nil {
  200. ch <- this
  201. }
  202. }()
  203. statement := database.NewStatement()
  204. statement.SetNeedReturnValue(false)
  205. statement.SetOpenRecordSet(true)
  206. statement.SetProcName("Manage_UserLoginLog_GetList")
  207. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  208. statement.AddParamter("@NickName", database.AdParamInput, database.AdNVarChar, 32, this.In.NickName)
  209. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  210. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  211. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  212. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  213. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  214. sqlstring := statement.GenSql()
  215. retRows := CenterDB.ExecSql(sqlstring)
  216. rowLen := len(retRows)
  217. if rowLen <= 0 {
  218. this.State = false
  219. return
  220. }
  221. this.State = true
  222. if rowLen > 1 {
  223. this.Out.List = make([]loginLogInfo, rowLen-1)
  224. for i := 0; i < rowLen-1; i++ {
  225. ret := retRows[i]
  226. out := &this.Out.List[i]
  227. out.LogID = int((*ret[0].(*interface{})).(int64))
  228. out.UserID = int((*ret[1].(*interface{})).(int64))
  229. out.NickName = (*ret[2].(*interface{})).(string)
  230. if info := tagMgr.getInfo(out.UserID); info != nil {
  231. out.NickName = info.NickName
  232. }
  233. out.IMei = (*ret[3].(*interface{})).(string)
  234. out.PartnerName = (*ret[4].(*interface{})).(string)
  235. out.Version = int((*ret[5].(*interface{})).(int64))
  236. out.LoginType = (*ret[6].(*interface{})).(string)
  237. out.IPAddress = (*ret[7].(*interface{})).(string)
  238. out.IPAddress = ip.GetCountryAndRegion(out.IPAddress, false)
  239. out.Crdate = (*ret[8].(*interface{})).(string)
  240. out.DeviceName = (*ret[9].(*interface{})).(string)
  241. }
  242. }
  243. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  244. }
  245. // 注册日志列表
  246. type (
  247. registerLogList_in struct {
  248. PartnerIDs string //合作商ID
  249. SourceIDs string
  250. Lv int
  251. Exp int
  252. BeginTime string //开始时间
  253. EndTime string //截止时间
  254. PageIndex int //页索引
  255. PageSize int //页大小
  256. }
  257. registerLogInfo struct {
  258. RowNumber int //标识
  259. PartnerName string //合作商名称
  260. UserID int //用户ID
  261. NickName string //昵称
  262. IMei string //IP地址
  263. RegIP string //注册IP
  264. RegTime string //注册时间
  265. Deviceid string //设备号
  266. Lv int // 等级
  267. Exp int // 经验值
  268. GuideStep int // 完成指引
  269. UTMSource string // 流量渠道
  270. LoginTime string // 登录时间
  271. Amount int // 金币
  272. DeviceName string // 设备型号
  273. PayMoney float64
  274. }
  275. registerLogList_out struct {
  276. RecordCount int //记录数
  277. List []registerLogInfo
  278. }
  279. registerLogList struct {
  280. database.Trans_base
  281. In registerLogList_in
  282. Out registerLogList_out
  283. }
  284. )
  285. func NewRegisterLogList() *registerLogList {
  286. return &registerLogList{}
  287. }
  288. func (this *registerLogList) DoAction(ch chan<- interface{}) {
  289. defer func() {
  290. if err := recover(); err != nil {
  291. log.Release("transaction recover fail %v", err)
  292. log.Release("%s", debug.Stack())
  293. }
  294. if ch != nil {
  295. ch <- this
  296. }
  297. }()
  298. statement := database.NewStatement()
  299. statement.SetNeedReturnValue(false)
  300. statement.SetOpenRecordSet(true)
  301. statement.SetProcName("Manage_AllUser_GetRegLogList")
  302. statement.AddParamter("@PartnerIDs", database.AdParamInput, database.AdVarChar, 256, this.In.PartnerIDs)
  303. statement.AddParamter("@SourceIDs", database.AdParamInput, database.AdVarChar, 256, this.In.SourceIDs)
  304. statement.AddParamter("@Lv", database.AdParamInput, database.AdInteger, 4, this.In.Lv)
  305. statement.AddParamter("@Exp", database.AdParamInput, database.AdInteger, 4, this.In.Exp)
  306. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  307. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  308. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  309. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  310. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  311. sqlstring := statement.GenSql()
  312. retRows := CenterDB.ExecSql(sqlstring)
  313. rowLen := len(retRows)
  314. if rowLen <= 0 {
  315. this.State = false
  316. return
  317. }
  318. this.State = true
  319. if rowLen > 1 {
  320. this.Out.List = make([]registerLogInfo, rowLen-1)
  321. for i := 0; i < rowLen-1; i++ {
  322. ret := retRows[i]
  323. out := &this.Out.List[i]
  324. out.RowNumber = int((*ret[0].(*interface{})).(int64))
  325. out.PartnerName = (*ret[1].(*interface{})).(string)
  326. out.UserID = int((*ret[2].(*interface{})).(int64))
  327. out.NickName = (*ret[3].(*interface{})).(string)
  328. if info := tagMgr.getInfo(out.UserID); info != nil {
  329. out.NickName = info.NickName
  330. }
  331. out.IMei = (*ret[4].(*interface{})).(string)
  332. out.RegIP = (*ret[5].(*interface{})).(string)
  333. out.RegIP = ip.GetCountryAndRegion(out.RegIP, true)
  334. out.RegTime = (*ret[6].(*interface{})).(string)
  335. out.Deviceid = (*ret[7].(*interface{})).(string)
  336. out.Lv = int((*ret[8].(*interface{})).(int64))
  337. out.Exp = int((*ret[9].(*interface{})).(int64))
  338. out.GuideStep = int((*ret[10].(*interface{})).(int64))
  339. out.UTMSource = (*ret[11].(*interface{})).(string)
  340. out.LoginTime = (*ret[12].(*interface{})).(string)
  341. out.Amount = int((*ret[13].(*interface{})).(int64))
  342. out.DeviceName = (*ret[14].(*interface{})).(string)
  343. payMoney := string((*ret[15].(*interface{})).([]byte))
  344. out.PayMoney, _ = strconv.ParseFloat(payMoney, 64)
  345. }
  346. }
  347. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  348. }
  349. // 流水排行
  350. type (
  351. dailyBetRank_in struct {
  352. BeginTime string //开始时间
  353. EndTime string //截止时间
  354. }
  355. dailyBetRankInfo struct {
  356. Rid int //标识
  357. UserID int //用户ID
  358. NickName string //昵称
  359. BetAmount string //流水
  360. }
  361. dailyBetRank_out struct {
  362. RecordCount int //记录数
  363. List []dailyBetRankInfo
  364. }
  365. dailyBetRank struct {
  366. database.Trans_base
  367. In dailyBetRank_in
  368. Out dailyBetRank_out
  369. }
  370. )
  371. func NewDailyBetRank() *dailyBetRank {
  372. return &dailyBetRank{}
  373. }
  374. func (this *dailyBetRank) 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_DailyBet_RankList")
  388. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  389. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  390. sqlstring := statement.GenSql()
  391. retRows := CenterDB.ExecSql(sqlstring)
  392. rowLen := len(retRows)
  393. if rowLen <= 0 {
  394. this.State = false
  395. return
  396. }
  397. this.State = true
  398. this.Out.List = make([]dailyBetRankInfo, rowLen)
  399. for i := 0; i < rowLen; i++ {
  400. ret := retRows[i]
  401. out := &this.Out.List[i]
  402. out.Rid = int((*ret[0].(*interface{})).(int64))
  403. out.UserID = int((*ret[1].(*interface{})).(int64))
  404. out.NickName = (*ret[2].(*interface{})).(string)
  405. if info := tagMgr.getInfo(out.UserID); info != nil {
  406. out.NickName = info.NickName
  407. }
  408. out.BetAmount = string((*ret[3].(*interface{})).([]byte))
  409. }
  410. }
  411. // 玩家流水
  412. type (
  413. dailyBetList_in struct {
  414. UserID int //用户ID
  415. BeginTime string //开始时间
  416. EndTime string //截止时间
  417. }
  418. dailyBetInfo struct {
  419. DateFlag string `json:"dateFlag"` //日期
  420. UserID int `json:"userID"` //用户ID
  421. ChineseName string `json:"chineseName"` //游戏名称
  422. BetAmount string `json:"betAmount"` //流水金额
  423. ResultAmount string `json:"resultAmount"` //结算金额
  424. WinAmount string `json:"winAmount"` //输赢金额
  425. }
  426. dailyBetList_out struct {
  427. RecordCount int //记录数
  428. List []dailyBetInfo
  429. }
  430. dailyBetList struct {
  431. database.Trans_base
  432. In dailyBetList_in
  433. Out dailyBetList_out
  434. }
  435. )
  436. func NewDailyBetList() *dailyBetList {
  437. return &dailyBetList{}
  438. }
  439. func (this *dailyBetList) DoAction(ch chan<- interface{}) {
  440. defer func() {
  441. if err := recover(); err != nil {
  442. log.Release("transaction recover fail %v", err)
  443. log.Release("%s", debug.Stack())
  444. }
  445. if ch != nil {
  446. ch <- this
  447. }
  448. }()
  449. statement := database.NewStatement()
  450. statement.SetNeedReturnValue(false)
  451. statement.SetOpenRecordSet(true)
  452. statement.SetProcName("Manage_DailyBet_GetList")
  453. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  454. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  455. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  456. sqlstring := statement.GenSql()
  457. retRows := CenterDB.ExecSql(sqlstring)
  458. rowLen := len(retRows)
  459. if rowLen <= 0 {
  460. this.State = false
  461. return
  462. }
  463. this.State = true
  464. this.Out.List = make([]dailyBetInfo, rowLen)
  465. for i := 0; i < rowLen; i++ {
  466. ret := retRows[i]
  467. out := &this.Out.List[i]
  468. out.DateFlag = (*ret[0].(*interface{})).(string)
  469. out.UserID = int((*ret[1].(*interface{})).(int64))
  470. out.ChineseName = (*ret[2].(*interface{})).(string)
  471. out.BetAmount = string((*ret[3].(*interface{})).([]byte))
  472. out.ResultAmount = string((*ret[4].(*interface{})).([]byte))
  473. out.WinAmount = string((*ret[5].(*interface{})).([]byte))
  474. }
  475. }
  476. // 充值日志
  477. type (
  478. payLog_in struct {
  479. PayID int //支付渠道ID
  480. UserID int //用户ID
  481. BeginTime string //开始时间
  482. EndTime string //截止时间
  483. PageIndex int //页索引
  484. PageSize int //页大小
  485. }
  486. payLogInfo struct {
  487. OrderID string //订单
  488. PayChannel string //支付渠道
  489. UserID int //用户ID
  490. NickName string //昵称
  491. ProductID string //产品ID
  492. ProductName string //产品名称
  493. Price string //价格
  494. Crdate string //时间
  495. IpAddress string //IP地址
  496. }
  497. payLog_out struct {
  498. RecordCount int //记录数
  499. TotalAmount float64 //充值总金币
  500. List []payLogInfo
  501. }
  502. payLog struct {
  503. database.Trans_base
  504. In payLog_in
  505. Out payLog_out
  506. }
  507. )
  508. func NewPayLog() *payLog {
  509. return &payLog{}
  510. }
  511. func (this *payLog) DoAction(ch chan<- interface{}) {
  512. defer func() {
  513. if err := recover(); err != nil {
  514. log.Release("transaction recover fail %v", err)
  515. log.Release("%s", debug.Stack())
  516. }
  517. if ch != nil {
  518. ch <- this
  519. }
  520. }()
  521. statement := database.NewStatement()
  522. statement.SetNeedReturnValue(false)
  523. statement.SetOpenRecordSet(true)
  524. statement.SetProcName("Manage_Pay_GetLog")
  525. statement.AddParamter("@PayID", database.AdParamInput, database.AdInteger, 4, this.In.PayID)
  526. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  527. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  528. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  529. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  530. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  531. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  532. statement.AddParamter("@TotalAmount", database.AdParamOutput, database.AdFloat, 20, this.Out.TotalAmount)
  533. sqlstring := statement.GenSql()
  534. retRows := CenterDB.ExecSql(sqlstring)
  535. rowLen := len(retRows)
  536. if rowLen <= 0 {
  537. this.State = false
  538. return
  539. }
  540. this.State = true
  541. if rowLen > 1 {
  542. this.Out.List = make([]payLogInfo, rowLen-1)
  543. for i := 0; i < rowLen-1; i++ {
  544. ret := retRows[i]
  545. out := &this.Out.List[i]
  546. out.OrderID = (*ret[0].(*interface{})).(string)
  547. out.PayChannel = (*ret[1].(*interface{})).(string)
  548. out.UserID = int((*ret[2].(*interface{})).(int64))
  549. out.NickName = (*ret[3].(*interface{})).(string)
  550. if info := tagMgr.getInfo(out.UserID); info != nil {
  551. out.NickName = info.NickName
  552. }
  553. out.ProductID = (*ret[4].(*interface{})).(string)
  554. price := string((*ret[5].(*interface{})).([]byte))
  555. fPrice, _ := strconv.ParseFloat(price, 64)
  556. out.Price = fmt.Sprintf("%.2f", fPrice)
  557. out.Crdate = (*ret[6].(*interface{})).(string)
  558. out.IpAddress = (*ret[7].(*interface{})).(string)
  559. out.IpAddress = ip.GetCountryAndRegion(out.IpAddress, false)
  560. out.ProductName = out.ProductID
  561. }
  562. }
  563. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  564. totalAmount := string((*retRows[rowLen-1][1].(*interface{})).([]byte))
  565. this.Out.TotalAmount, _ = strconv.ParseFloat(totalAmount, 64)
  566. }
  567. // 充值排行
  568. type (
  569. payRank_in struct {
  570. BeginTime string //开始时间
  571. EndTime string //截止时间
  572. PageIndex int // 页索引
  573. PageSize int // 页大小
  574. }
  575. payRankInfo struct {
  576. Rid int //排序
  577. UserID int //用户ID
  578. NickName string //昵称
  579. TotalAmount string //金额
  580. }
  581. payRank_out struct {
  582. RecordCount int //记录数
  583. List []payRankInfo
  584. }
  585. payRank struct {
  586. database.Trans_base
  587. In payRank_in
  588. Out payRank_out
  589. }
  590. )
  591. func NewPayRank() *payRank {
  592. return &payRank{}
  593. }
  594. func (this *payRank) DoAction(ch chan<- interface{}) {
  595. defer func() {
  596. if err := recover(); err != nil {
  597. log.Release("transaction recover fail %v", err)
  598. log.Release("%s", debug.Stack())
  599. }
  600. if ch != nil {
  601. ch <- this
  602. }
  603. }()
  604. statement := database.NewStatement()
  605. statement.SetNeedReturnValue(false)
  606. statement.SetOpenRecordSet(true)
  607. statement.SetProcName("Manage_Pay_GetRank")
  608. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  609. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  610. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  611. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  612. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  613. sqlstring := statement.GenSql()
  614. retRows := CenterDB.ExecSql(sqlstring)
  615. rowLen := len(retRows)
  616. if rowLen <= 0 {
  617. this.State = false
  618. return
  619. }
  620. this.State = true
  621. if rowLen > 1 {
  622. this.Out.List = make([]payRankInfo, rowLen-1)
  623. for i := 0; i < rowLen-1; i++ {
  624. ret := retRows[i]
  625. out := &this.Out.List[i]
  626. out.Rid = int((*ret[0].(*interface{})).(int64))
  627. out.UserID = int((*ret[1].(*interface{})).(int64))
  628. out.NickName = (*ret[2].(*interface{})).(string)
  629. if info := tagMgr.getInfo(out.UserID); info != nil {
  630. out.NickName = info.NickName
  631. }
  632. totalAmount := string((*ret[3].(*interface{})).([]byte))
  633. fTotalAmount, _ := strconv.ParseFloat(totalAmount, 64)
  634. out.TotalAmount = fmt.Sprintf("%.2f", fTotalAmount)
  635. }
  636. }
  637. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  638. }
  639. // 贈送日誌
  640. type (
  641. sendLog_in struct {
  642. UserID int //用戶ID
  643. IpAddress string //IP地址
  644. BeginTime string //開始時間
  645. EndTime string //截止時間
  646. PageIndex int //頁索引
  647. PageSize int //頁大小
  648. }
  649. sendLogModel struct {
  650. Rid int //標識
  651. UserID int //用戶ID
  652. NickName string //暱稱
  653. IpAddress string //IP
  654. Crdate string //時間
  655. }
  656. sendLog_out struct {
  657. RecordCount int //記錄數
  658. List []sendLogModel
  659. }
  660. sendLog struct {
  661. database.Trans_base
  662. In sendLog_in
  663. Out sendLog_out
  664. }
  665. )
  666. func NewSendLog() *sendLog {
  667. return &sendLog{}
  668. }
  669. func (this *sendLog) DoAction(ch chan<- interface{}) {
  670. defer func() {
  671. if err := recover(); err != nil {
  672. log.Release("transaction recover err %v", err)
  673. log.Release("%s", debug.Stack())
  674. }
  675. if ch != nil {
  676. ch <- this
  677. }
  678. }()
  679. statement := database.NewStatement()
  680. statement.SetNeedReturnValue(false)
  681. statement.SetOpenRecordSet(true)
  682. statement.SetProcName("Game_UserSendLog_GetList")
  683. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  684. statement.AddParamter("@IPAddress", database.AdParamInput, database.AdVarChar, 16, this.In.IpAddress)
  685. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  686. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  687. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  688. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  689. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  690. sqlstring := statement.GenSql()
  691. retRows := CenterDB.ExecSql(sqlstring)
  692. rowsLen := len(retRows)
  693. if rowsLen <= 0 {
  694. this.State = false
  695. return
  696. }
  697. this.State = true
  698. if rowsLen > 1 {
  699. this.Out.List = make([]sendLogModel, rowsLen-1)
  700. for i := 0; i < rowsLen-1; i++ {
  701. ret := retRows[i]
  702. out := &this.Out.List[i]
  703. out.Rid = int((*ret[0].(*interface{})).(int64))
  704. out.UserID = int((*ret[1].(*interface{})).(int64))
  705. out.NickName = (*ret[2].(*interface{})).(string)
  706. if info := tagMgr.getInfo(out.UserID); info != nil {
  707. out.NickName = info.NickName
  708. }
  709. out.IpAddress = (*ret[3].(*interface{})).(string)
  710. out.IpAddress = ip.GetCountryAndRegion(out.IpAddress, false)
  711. out.Crdate = (*ret[4].(*interface{})).(string)
  712. }
  713. }
  714. this.Out.RecordCount = int((*retRows[rowsLen-1][0].(*interface{})).(int64))
  715. }
  716. // 充值日志
  717. type (
  718. payChipLog_in struct {
  719. PayID int //支付渠道ID
  720. UserID int //用户ID
  721. BeginTime string //开始时间
  722. EndTime string //截止时间
  723. PageIndex int //页索引
  724. PageSize int //页大小
  725. }
  726. payChipLogInfo struct {
  727. OrderID string //订单
  728. PayChannel string //支付渠道
  729. UserID int //用户ID
  730. NickName string //昵称
  731. ProductID string //产品ID
  732. ProductName string //产品名称
  733. Price int //价格
  734. Crdate string //时间
  735. IpAddress string //IP地址
  736. }
  737. payChipLog_out struct {
  738. RecordCount int //记录数
  739. TotalAmount int //充值总金币
  740. List []payChipLogInfo
  741. }
  742. payChipLog struct {
  743. database.Trans_base
  744. In payChipLog_in
  745. Out payChipLog_out
  746. }
  747. )
  748. func NewPayChipLog() *payChipLog {
  749. return &payChipLog{}
  750. }
  751. func (this *payChipLog) DoAction(ch chan<- interface{}) {
  752. defer func() {
  753. if err := recover(); err != nil {
  754. log.Release("transaction recover fail %v", err)
  755. log.Release("%s", debug.Stack())
  756. }
  757. if ch != nil {
  758. ch <- this
  759. }
  760. }()
  761. statement := database.NewStatement()
  762. statement.SetNeedReturnValue(false)
  763. statement.SetOpenRecordSet(true)
  764. statement.SetProcName("Manage_Pay_GetChipLog")
  765. statement.AddParamter("@PayID", database.AdParamInput, database.AdInteger, 4, this.In.PayID)
  766. statement.AddParamter("@UserID", database.AdParamInput, database.AdInteger, 4, this.In.UserID)
  767. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  768. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  769. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  770. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  771. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  772. statement.AddParamter("@TotalAmount", database.AdParamOutput, database.AdBigint, 8, this.Out.TotalAmount)
  773. sqlstring := statement.GenSql()
  774. retRows := CenterDB.ExecSql(sqlstring)
  775. rowLen := len(retRows)
  776. if rowLen <= 0 {
  777. this.State = false
  778. return
  779. }
  780. this.State = true
  781. if rowLen > 1 {
  782. this.Out.List = make([]payChipLogInfo, rowLen-1)
  783. for i := 0; i < rowLen-1; i++ {
  784. ret := retRows[i]
  785. out := &this.Out.List[i]
  786. out.OrderID = (*ret[0].(*interface{})).(string)
  787. out.PayChannel = (*ret[1].(*interface{})).(string)
  788. out.UserID = int((*ret[2].(*interface{})).(int64))
  789. out.NickName = (*ret[3].(*interface{})).(string)
  790. if info := tagMgr.getInfo(out.UserID); info != nil {
  791. out.NickName = info.NickName
  792. }
  793. out.ProductID = (*ret[4].(*interface{})).(string)
  794. out.Price = int((*ret[5].(*interface{})).(int64))
  795. out.Crdate = (*ret[6].(*interface{})).(string)
  796. out.IpAddress = (*ret[7].(*interface{})).(string)
  797. out.IpAddress = ip.GetCountryAndRegion(out.IpAddress, false)
  798. out.ProductName = out.ProductID
  799. }
  800. }
  801. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  802. this.Out.TotalAmount = int((*retRows[rowLen-1][1].(*interface{})).(int64))
  803. }
  804. // 注册日志列表
  805. type (
  806. registerLogList_v2_in struct {
  807. UTMSources string //渠道源ID
  808. Lv int
  809. Exp int
  810. BeginTime string //开始时间
  811. EndTime string //截止时间
  812. PageIndex int //页索引
  813. PageSize int //页大小
  814. }
  815. registerLogInfo_v2 struct {
  816. RowNumber int //标识
  817. PartnerName string //合作商名称
  818. UserID int //用户ID
  819. NickName string //昵称
  820. IMei string //IP地址
  821. RegIP string //注册IP
  822. RegTime string //注册时间
  823. Deviceid string //设备号
  824. Lv int // 等级
  825. Exp int // 经验值
  826. GuideStep int // 完成指引
  827. UTMSource string // 流量渠道
  828. DeviceName string // 设备型号
  829. PayMoney float64
  830. LoginTime string // 登录时间
  831. Amount int // 金币
  832. Version int // 版本号
  833. }
  834. registerLogList_v2_out struct {
  835. RecordCount int //记录数
  836. List []registerLogInfo_v2
  837. }
  838. registerLogList_v2 struct {
  839. database.Trans_base
  840. In registerLogList_v2_in
  841. Out registerLogList_v2_out
  842. }
  843. )
  844. func NewRegisterLogList_v2() *registerLogList_v2 {
  845. return &registerLogList_v2{}
  846. }
  847. func (this *registerLogList_v2) DoAction(ch chan<- interface{}) {
  848. defer func() {
  849. if err := recover(); err != nil {
  850. log.Release("transaction recover fail %v", err)
  851. log.Release("%s", debug.Stack())
  852. }
  853. if ch != nil {
  854. ch <- this
  855. }
  856. }()
  857. statement := database.NewStatement()
  858. statement.SetNeedReturnValue(false)
  859. statement.SetOpenRecordSet(true)
  860. statement.SetProcName("Manage_AllUser_GetRegLogList_V2")
  861. statement.AddParamter("@UTMSources", database.AdParamInput, database.AdVarChar, 256, this.In.UTMSources)
  862. statement.AddParamter("@Lv", database.AdParamInput, database.AdInteger, 4, this.In.Lv)
  863. statement.AddParamter("@Exp", database.AdParamInput, database.AdInteger, 4, this.In.Exp)
  864. statement.AddParamter("@BeginTime", database.AdParamInput, database.AdVarChar, 20, this.In.BeginTime)
  865. statement.AddParamter("@EndTime", database.AdParamInput, database.AdVarChar, 20, this.In.EndTime)
  866. statement.AddParamter("@PageIndex", database.AdParamInput, database.AdInteger, 4, this.In.PageIndex)
  867. statement.AddParamter("@PageSize", database.AdParamInput, database.AdInteger, 4, this.In.PageSize)
  868. statement.AddParamter("@RecordCount", database.AdParamOutput, database.AdInteger, 4, this.Out.RecordCount)
  869. sqlstring := statement.GenSql()
  870. retRows := CenterDB.ExecSql(sqlstring)
  871. rowLen := len(retRows)
  872. if rowLen <= 0 {
  873. this.State = false
  874. return
  875. }
  876. this.State = true
  877. if rowLen > 1 {
  878. this.Out.List = make([]registerLogInfo_v2, rowLen-1)
  879. for i := 0; i < rowLen-1; i++ {
  880. ret := retRows[i]
  881. out := &this.Out.List[i]
  882. out.RowNumber = int((*ret[0].(*interface{})).(int64))
  883. out.PartnerName = (*ret[1].(*interface{})).(string)
  884. out.UserID = int((*ret[2].(*interface{})).(int64))
  885. out.NickName = (*ret[3].(*interface{})).(string)
  886. if info := tagMgr.getInfo(out.UserID); info != nil {
  887. out.NickName = info.NickName
  888. }
  889. out.IMei = (*ret[4].(*interface{})).(string)
  890. out.RegIP = (*ret[5].(*interface{})).(string)
  891. out.RegIP = ip.GetCountryAndRegion(out.RegIP, true)
  892. out.RegTime = (*ret[6].(*interface{})).(string)
  893. out.Deviceid = (*ret[7].(*interface{})).(string)
  894. out.Lv = int((*ret[8].(*interface{})).(int64))
  895. out.Exp = int((*ret[9].(*interface{})).(int64))
  896. out.GuideStep = int((*ret[10].(*interface{})).(int64))
  897. out.UTMSource = (*ret[11].(*interface{})).(string)
  898. out.DeviceName = (*ret[12].(*interface{})).(string)
  899. payMoney := string((*ret[13].(*interface{})).([]byte))
  900. out.PayMoney, _ = strconv.ParseFloat(payMoney, 64)
  901. out.LoginTime = (*ret[14].(*interface{})).(string)
  902. out.Amount = int((*ret[15].(*interface{})).(int64))
  903. out.Version = int((*ret[16].(*interface{})).(int64))
  904. }
  905. }
  906. this.Out.RecordCount = int((*retRows[rowLen-1][0].(*interface{})).(int64))
  907. }