platforminfo.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. package dao
  2. import (
  3. "runtime/debug"
  4. "bet24.com/database"
  5. "bet24.com/log"
  6. )
  7. // 平台信息列表
  8. type (
  9. platformInfoList_in struct {
  10. PartnerID int //渠道ID
  11. }
  12. platformInfo struct {
  13. PartnerID int //合作商ID
  14. Version string //版本
  15. Download string //下载
  16. }
  17. platformInfoList_out struct {
  18. RecordCount int //记录数
  19. List []platformInfo
  20. }
  21. platformInfoList struct {
  22. database.Trans_base
  23. In platformInfoList_in
  24. Out platformInfoList_out
  25. }
  26. )
  27. func NewPlatformInfoList() *platformInfoList {
  28. return &platformInfoList{}
  29. }
  30. func (this *platformInfoList) DoAction(ch chan<- interface{}) {
  31. defer func() {
  32. if err := recover(); err != nil {
  33. log.Release("transaction recover fail %v", err)
  34. log.Release("%s", debug.Stack())
  35. }
  36. if ch != nil {
  37. ch <- this
  38. }
  39. }()
  40. statement := database.NewStatement()
  41. statement.SetNeedReturnValue(false)
  42. statement.SetOpenRecordSet(true)
  43. statement.SetProcName("Manage_PlatformInfo_GetList")
  44. statement.AddParamter("@PartnerID", database.AdParamInput, database.AdInteger, 4, this.In.PartnerID)
  45. sqlstring := statement.GenSql()
  46. retRows := CenterDB.ExecSql(sqlstring)
  47. rowLen := len(retRows)
  48. if rowLen <= 0 {
  49. this.State = false
  50. return
  51. }
  52. this.State = true
  53. this.Out.List = make([]platformInfo, rowLen)
  54. for i := 0; i < rowLen; i++ {
  55. ret := retRows[i]
  56. out := &this.Out.List[i]
  57. out.PartnerID = int((*ret[0].(*interface{})).(int64))
  58. out.Version = (*ret[1].(*interface{})).(string)
  59. out.Download = (*ret[2].(*interface{})).(string)
  60. }
  61. }
  62. // 平台信息修改
  63. type (
  64. platformInfoUp_in struct {
  65. OpUserID int //操作员ID
  66. OpUserName string //操作员名称
  67. PartnerID int //渠道ID
  68. Version string //本版
  69. IpAddress string //IP地址
  70. Download string //下注地址
  71. }
  72. platformInfoUp_out struct {
  73. RetCode int //操作结果
  74. ErrorMsg string //操作描述
  75. }
  76. platformInfoUp struct {
  77. database.Trans_base
  78. In platformInfoUp_in
  79. Out platformInfoUp_out
  80. }
  81. )
  82. func NewPlatformInfoUp() *platformInfoUp {
  83. return &platformInfoUp{}
  84. }
  85. func (this *platformInfoUp) DoAction(ch chan<- interface{}) {
  86. defer func() {
  87. if err := recover(); err != nil {
  88. log.Release("transaction recover fail %v", err)
  89. log.Release("%s", debug.Stack())
  90. }
  91. if ch != nil {
  92. ch <- this
  93. }
  94. }()
  95. statement := database.NewStatement()
  96. statement.SetNeedReturnValue(false)
  97. statement.SetOpenRecordSet(true)
  98. statement.SetProcName("Manage_PlatformInfo_Update")
  99. statement.AddParamter("@OpUserID", database.AdParamInput, database.AdInteger, 4, this.In.OpUserID)
  100. statement.AddParamter("@OpUserName", database.AdParamInput, database.AdVarChar, 32, this.In.OpUserName)
  101. statement.AddParamter("@PartnerID", database.AdParamInput, database.AdInteger, 4, this.In.PartnerID)
  102. statement.AddParamter("@Version", database.AdParamInput, database.AdVarChar, 16, this.In.Version)
  103. statement.AddParamter("@IPAddress", database.AdParamInput, database.AdVarChar, 16, this.In.IpAddress)
  104. statement.AddParamter("@Download", database.AdParamInput, database.AdVarChar, 128, this.In.Download)
  105. sqlstring := statement.GenSql()
  106. retRows := CenterDB.ExecSql(sqlstring)
  107. rowLen := len(retRows)
  108. if rowLen <= 0 {
  109. this.State = false
  110. return
  111. }
  112. this.Out.RetCode = 1
  113. }
  114. // 平台配置信息
  115. type (
  116. platformConfig_out struct {
  117. RegGoldSend int // 注册赠送金币
  118. DailyTransferAmount int // 日转账限额
  119. BindFacebook int // 绑定Facebook
  120. BindMobile int // 绑定手机号
  121. IsCouponTask int // 是否开启红包券任务
  122. UpgradeAPK int // 升级APK
  123. SurchargeRate int // 提现手续费比率
  124. FreeSurchargeTimes int // 免手续费提取次数
  125. TotalAmount int // 可提取总金额
  126. DailyNoAuditAmount int // 日无审核提现金额
  127. DailyNoAuditTimes int // 日无审核提现次数
  128. DailyMaxTimes int // 日最多提现次数
  129. MinWithdrawAmount int // 提现最小金额
  130. }
  131. platformConfig struct {
  132. database.Trans_base
  133. Out platformConfig_out
  134. }
  135. )
  136. func NewPlatformConfig() *platformConfig {
  137. return &platformConfig{}
  138. }
  139. func (this *platformConfig) DoAction(ch chan<- interface{}) {
  140. defer func() {
  141. if err := recover(); err != nil {
  142. log.Error("transaction recover err %v", err)
  143. log.Error("%s", debug.Stack())
  144. }
  145. if ch != nil {
  146. ch <- this
  147. }
  148. }()
  149. statement := database.NewStatement()
  150. statement.SetNeedReturnValue(false)
  151. statement.SetOpenRecordSet(true)
  152. statement.SetProcName("Manage_PlatformConfig_GetInfo")
  153. sqlstring := statement.GenSql()
  154. retRows := CenterDB.ExecSql(sqlstring)
  155. if len(retRows) <= 0 {
  156. this.State = false
  157. return
  158. }
  159. this.State = true
  160. ret := retRows[0]
  161. this.Out.RegGoldSend = int((*ret[0].(*interface{})).(int64))
  162. this.Out.DailyTransferAmount = int((*ret[1].(*interface{})).(int64))
  163. this.Out.BindFacebook = int((*ret[2].(*interface{})).(int64))
  164. this.Out.BindMobile = int((*ret[3].(*interface{})).(int64))
  165. this.Out.UpgradeAPK = int((*ret[4].(*interface{})).(int64))
  166. this.Out.IsCouponTask = int((*ret[5].(*interface{})).(int64))
  167. }
  168. // 修改平台配置
  169. type (
  170. platformConfigUp_in struct {
  171. OpUserID int // 操作员ID
  172. OpUserName string // 操作员名称
  173. RegGoldSend int // 注册赠送金币
  174. DailyTransferAmount int // 日转账限额
  175. BindFacebook int // 绑定Facebook
  176. BindMobile int // 绑定手机号
  177. UpgradeAPK int // 升级APK
  178. IpAddress string
  179. }
  180. platformConfigUp_out struct {
  181. RetCode int
  182. ErrorMsg string
  183. }
  184. platformConfigUp struct {
  185. database.Trans_base
  186. In platformConfigUp_in
  187. Out platformConfigUp_out
  188. }
  189. )
  190. func NewPlatformConfigUp() *platformConfigUp {
  191. return &platformConfigUp{}
  192. }
  193. func (this *platformConfigUp) DoAction(ch chan<- interface{}) {
  194. defer func() {
  195. if err := recover(); err != nil {
  196. log.Error("transaction recover err %v", err)
  197. log.Error("%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_PlatformConfig_Update")
  207. statement.AddParamter("@OpUserID", database.AdParamInput, database.AdInteger, 4, this.In.OpUserID)
  208. statement.AddParamter("@OpUserName", database.AdParamInput, database.AdVarChar, 32, this.In.OpUserName)
  209. statement.AddParamter("@RegGoldSend", database.AdParamInput, database.AdInteger, 4, this.In.RegGoldSend)
  210. statement.AddParamter("@DailyTransferAmount", database.AdParamInput, database.AdInteger, 4, this.In.DailyTransferAmount)
  211. statement.AddParamter("@BindFacebook", database.AdParamInput, database.AdInteger, 4, this.In.BindFacebook)
  212. statement.AddParamter("@BindMobile", database.AdParamInput, database.AdInteger, 4, this.In.BindMobile)
  213. statement.AddParamter("@UpgradeAPK", database.AdParamInput, database.AdInteger, 4, this.In.UpgradeAPK)
  214. statement.AddParamter("@IPAddress", database.AdParamInput, database.AdVarChar, 16, this.In.IpAddress)
  215. statement.AddParamter("@RetCode", database.AdParamOutput, database.AdInteger, 4, this.Out.RetCode)
  216. sqlstring := statement.GenSql()
  217. retRows := CenterDB.ExecSql(sqlstring)
  218. if len(retRows) <= 0 {
  219. this.State = false
  220. return
  221. }
  222. this.State = true
  223. this.Out.RetCode = int((*retRows[0][0].(*interface{})).(int64))
  224. if this.Out.RetCode == 1 {
  225. this.Out.ErrorMsg = "修改配置成功"
  226. } else {
  227. this.Out.ErrorMsg = "修改配置失败"
  228. }
  229. }
  230. // 添加平台配置log操作记录
  231. type (
  232. addLog_in struct {
  233. OpUserID int // 管理员用户ID(AdminUserID)
  234. OpUserName string // 管理员名称(AdminUserName)
  235. Memo string // 管理员备注(Memo)
  236. IPAddress string // IP地址(IPAddress)
  237. KeyName string // 配置的key
  238. Eq int // 修改的下标位置(Eq)
  239. }
  240. platformConfigLog struct {
  241. database.Trans_base
  242. In addLog_in
  243. }
  244. )
  245. func NewPlatformConfigLog() *platformConfigLog {
  246. return &platformConfigLog{}
  247. }
  248. func (this *platformConfigLog) DoAction(ch chan<- interface{}) {
  249. defer func() {
  250. if err := recover(); err != nil {
  251. log.Error("PlatformConfig.addLog transaction recover err %v", err)
  252. log.Error("%s", debug.Stack())
  253. }
  254. if ch != nil {
  255. ch <- this
  256. }
  257. }()
  258. statement := database.NewStatement()
  259. statement.SetNeedReturnValue(false)
  260. statement.SetOpenRecordSet(false)
  261. statement.SetProcName("Manage_PlatformConfig_Log")
  262. statement.AddParamter("@OpUserID", database.AdParamInput, database.AdInteger, 4, this.In.OpUserID)
  263. statement.AddParamter("@OpUserName", database.AdParamInput, database.AdVarChar, 32, this.In.OpUserName)
  264. statement.AddParamter("@Memo", database.AdParamInput, database.AdNVarChar, 128, this.In.Memo)
  265. statement.AddParamter("@IPAddress", database.AdParamInput, database.AdVarChar, 15, this.In.IPAddress)
  266. statement.AddParamter("@KeyName", database.AdParamInput, database.AdVarChar, 64, this.In.KeyName)
  267. statement.AddParamter("@Eq", database.AdParamInput, database.AdInteger, 4, this.In.Eq)
  268. sqlstring := statement.GenSql()
  269. //log.Debug(sqlstring)
  270. CenterDB.ExecSql(sqlstring)
  271. this.State = true
  272. }
  273. // 获取平台配置的操作记录列表
  274. type (
  275. getList_in struct {
  276. OpUserID int // 操作用户ID
  277. KeyName string // 配置的key
  278. }
  279. getList_out struct {
  280. AdminUserName string // 管理员名称(AdminUserName)
  281. Memo string // 管理员备注(Memo)
  282. KeyName string // 配置的key
  283. Eq int // 修改的下标位置(Eq)
  284. Crdate string // 创建时间(Crdate)
  285. }
  286. platformConfigGetList struct {
  287. database.Trans_base
  288. In getList_in
  289. Out []getList_out
  290. }
  291. )
  292. func NewPlatformConfigGetList() *platformConfigGetList {
  293. return &platformConfigGetList{}
  294. }
  295. func (this *platformConfigGetList) DoAction(ch chan<- interface{}) {
  296. defer func() {
  297. if err := recover(); err != nil {
  298. log.Error("PlatformConfig.GetList transaction recover err %v", err)
  299. log.Error("%s", debug.Stack())
  300. }
  301. if ch != nil {
  302. ch <- this
  303. }
  304. }()
  305. statement := database.NewStatement()
  306. statement.SetNeedReturnValue(false)
  307. statement.SetOpenRecordSet(false)
  308. statement.SetProcName("Manage_PlatformConfig_GetList")
  309. statement.AddParamter("@OpUserID", database.AdParamInput, database.AdInteger, 4, this.In.OpUserID)
  310. statement.AddParamter("@KeyName", database.AdParamInput, database.AdVarChar, 64, this.In.KeyName)
  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. this.Out = make([]getList_out, rowLen)
  320. for i := 0; i < rowLen; i++ {
  321. ret := retRows[i]
  322. out := &this.Out[i]
  323. out.AdminUserName = (*ret[0].(*interface{})).(string)
  324. out.Memo = (*ret[1].(*interface{})).(string)
  325. out.KeyName = (*ret[2].(*interface{})).(string)
  326. out.Eq = int((*ret[3].(*interface{})).(int64))
  327. out.Crdate = (*ret[4].(*interface{})).(string)
  328. }
  329. }