mcn.go 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. package http
  2. import (
  3. "context"
  4. "net/http"
  5. "strconv"
  6. "go-common/app/admin/main/mcn/model"
  7. "go-common/library/net/http/blademaster"
  8. )
  9. func mcnSignEntry(c *blademaster.Context) {
  10. httpPostJSONCookie(
  11. new(model.MCNSignEntryReq),
  12. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  13. var uids, name *http.Cookie
  14. args := arg.(*model.MCNSignEntryReq)
  15. if name, err = c.Request.Cookie("username"); err == nil {
  16. args.UserName = name.Value
  17. }
  18. if uids, err = c.Request.Cookie("uid"); err == nil {
  19. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  20. return
  21. }
  22. }
  23. return nil, srv.McnSignEntry(cont, arg.(*model.MCNSignEntryReq))
  24. },
  25. "mcnSignEntry")(c)
  26. }
  27. func mcnSignList(c *blademaster.Context) {
  28. httpGetFunCheckCookie(
  29. new(model.MCNSignStateReq),
  30. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  31. return srv.McnSignList(cont, arg.(*model.MCNSignStateReq))
  32. },
  33. "mcnSignList")(c)
  34. }
  35. func mcnSignOP(c *blademaster.Context) {
  36. httpPostJSONCookie(
  37. new(model.MCNSignStateOpReq),
  38. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  39. var uids, name *http.Cookie
  40. args := arg.(*model.MCNSignStateOpReq)
  41. if name, err = c.Request.Cookie("username"); err == nil {
  42. args.UserName = name.Value
  43. }
  44. if uids, err = c.Request.Cookie("uid"); err == nil {
  45. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  46. return
  47. }
  48. }
  49. return nil, srv.McnSignOP(cont, arg.(*model.MCNSignStateOpReq))
  50. },
  51. "mcnSignOP")(c)
  52. }
  53. func mcnUPReviewList(c *blademaster.Context) {
  54. httpGetFunCheckCookie(
  55. new(model.MCNUPStateReq),
  56. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  57. return srv.McnUPReviewList(cont, arg.(*model.MCNUPStateReq))
  58. },
  59. "mcnUPReviewList")(c)
  60. }
  61. func mcnUPOP(c *blademaster.Context) {
  62. httpPostJSONCookie(
  63. new(model.MCNUPStateOpReq),
  64. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  65. var uids, name *http.Cookie
  66. args := arg.(*model.MCNUPStateOpReq)
  67. if name, err = c.Request.Cookie("username"); err == nil {
  68. args.UserName = name.Value
  69. }
  70. if uids, err = c.Request.Cookie("uid"); err == nil {
  71. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  72. return
  73. }
  74. }
  75. return nil, srv.McnUPOP(cont, arg.(*model.MCNUPStateOpReq))
  76. },
  77. "mcnUPOP")(c)
  78. }
  79. func mcnPermitOP(c *blademaster.Context) {
  80. httpPostJSONCookie(
  81. new(model.MCNSignPermissionReq),
  82. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  83. var uids, name *http.Cookie
  84. args := arg.(*model.MCNSignPermissionReq)
  85. if name, err = c.Request.Cookie("username"); err == nil {
  86. args.UserName = name.Value
  87. }
  88. if uids, err = c.Request.Cookie("uid"); err == nil {
  89. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  90. return
  91. }
  92. }
  93. return nil, srv.McnPermitOP(cont, arg.(*model.MCNSignPermissionReq))
  94. },
  95. "McnPermitOP")(c)
  96. }
  97. func mcnUPPermitList(c *blademaster.Context) {
  98. httpGetFunCheckCookie(
  99. new(model.MCNUPPermitStateReq),
  100. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  101. return srv.McnUPPermitList(cont, arg.(*model.MCNUPPermitStateReq))
  102. },
  103. "McnUPPermitList")(c)
  104. }
  105. func mcnUPPermitOP(c *blademaster.Context) {
  106. httpPostJSONCookie(
  107. new(model.MCNUPPermitOPReq),
  108. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  109. var uids, name *http.Cookie
  110. args := arg.(*model.MCNUPPermitOPReq)
  111. if name, err = c.Request.Cookie("username"); err == nil {
  112. args.UserName = name.Value
  113. }
  114. if uids, err = c.Request.Cookie("uid"); err == nil {
  115. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  116. return
  117. }
  118. }
  119. return nil, srv.McnUPPermitOP(cont, arg.(*model.MCNUPPermitOPReq))
  120. },
  121. "McnUPPermitOP")(c)
  122. }
  123. func mcnList(c *blademaster.Context) {
  124. httpGetWriterByExport(
  125. new(model.MCNListReq),
  126. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  127. return srv.MCNList(cont, arg.(*model.MCNListReq))
  128. },
  129. "mcnList")(c)
  130. }
  131. func mcnPayEdit(c *blademaster.Context) {
  132. httpPostJSONCookie(
  133. new(model.MCNPayEditReq),
  134. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  135. var uids, name *http.Cookie
  136. args := arg.(*model.MCNPayEditReq)
  137. if name, err = c.Request.Cookie("username"); err == nil {
  138. args.UserName = name.Value
  139. }
  140. if uids, err = c.Request.Cookie("uid"); err == nil {
  141. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  142. return
  143. }
  144. }
  145. return nil, srv.MCNPayEdit(cont, arg.(*model.MCNPayEditReq))
  146. },
  147. "mcnPayEdit")(c)
  148. }
  149. // func mcnPayEdit(c *blademaster.Context) {
  150. // httpPostFunCheckCookie(
  151. // new(model.MCNPayEditReq),
  152. // func(cont context.Context, arg interface{}) (res interface{}, err error) {
  153. // var uids,name *http.Cookie
  154. // args := arg.(*model.MCNPayEditReq)
  155. // if name, err = c.Request.Cookie("username"); err == nil {
  156. // args.UserName = name.Value
  157. // }
  158. // if uids, err = c.Request.Cookie("uid"); err == nil {
  159. // if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  160. // return
  161. // }
  162. // }
  163. // return nil, srv.MCNPayEdit(cont, arg.(*model.MCNPayEditReq))
  164. // },
  165. // "mcnPayEdit")(c)
  166. // }
  167. func mcnPayStateEdit(c *blademaster.Context) {
  168. httpPostJSONCookie(
  169. new(model.MCNPayStateEditReq),
  170. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  171. var uids, name *http.Cookie
  172. args := arg.(*model.MCNPayStateEditReq)
  173. if name, err = c.Request.Cookie("username"); err == nil {
  174. args.UserName = name.Value
  175. }
  176. if uids, err = c.Request.Cookie("uid"); err == nil {
  177. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  178. return
  179. }
  180. }
  181. return nil, srv.MCNPayStateEdit(cont, arg.(*model.MCNPayStateEditReq))
  182. },
  183. "mcnPayStateEdit")(c)
  184. }
  185. func mcnStateEdit(c *blademaster.Context) {
  186. httpPostJSONCookie(
  187. new(model.MCNStateEditReq),
  188. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  189. var uids, name *http.Cookie
  190. args := arg.(*model.MCNStateEditReq)
  191. if name, err = c.Request.Cookie("username"); err == nil {
  192. args.UserName = name.Value
  193. }
  194. if uids, err = c.Request.Cookie("uid"); err == nil {
  195. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  196. return
  197. }
  198. }
  199. return nil, srv.MCNStateEdit(cont, arg.(*model.MCNStateEditReq))
  200. },
  201. "mcnStateEdit")(c)
  202. }
  203. func mcnRenewal(c *blademaster.Context) {
  204. httpPostJSONCookie(
  205. new(model.MCNRenewalReq),
  206. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  207. var uids, name *http.Cookie
  208. args := arg.(*model.MCNRenewalReq)
  209. if name, err = c.Request.Cookie("username"); err == nil {
  210. args.UserName = name.Value
  211. }
  212. if uids, err = c.Request.Cookie("uid"); err == nil {
  213. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  214. return
  215. }
  216. }
  217. return nil, srv.MCNRenewal(cont, arg.(*model.MCNRenewalReq))
  218. },
  219. "mcnRenewal")(c)
  220. }
  221. func mcnInfo(c *blademaster.Context) {
  222. httpGetFunCheckCookie(
  223. new(model.MCNInfoReq),
  224. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  225. return srv.MCNInfo(cont, arg.(*model.MCNInfoReq))
  226. },
  227. "mcnInfo")(c)
  228. }
  229. func mcnUPList(c *blademaster.Context) {
  230. httpGetWriterByExport(
  231. new(model.MCNUPListReq),
  232. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  233. return srv.MCNUPList(cont, arg.(*model.MCNUPListReq))
  234. },
  235. "mcnUPList")(c)
  236. }
  237. func mcnUPStatEdit(c *blademaster.Context) {
  238. httpPostJSONCookie(
  239. new(model.MCNUPStateEditReq),
  240. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  241. var uids, name *http.Cookie
  242. args := arg.(*model.MCNUPStateEditReq)
  243. if name, err = c.Request.Cookie("username"); err == nil {
  244. args.UserName = name.Value
  245. }
  246. if uids, err = c.Request.Cookie("uid"); err == nil {
  247. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  248. return
  249. }
  250. }
  251. return nil, srv.MCNUPStateEdit(cont, arg.(*model.MCNUPStateEditReq))
  252. },
  253. "mcnUPStatEdit")(c)
  254. }
  255. func mcnCheatList(c *blademaster.Context) {
  256. httpGetFunCheckCookie(
  257. new(model.MCNCheatListReq),
  258. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  259. return srv.MCNCheatList(cont, arg.(*model.MCNCheatListReq))
  260. },
  261. "mcnCheatList")(c)
  262. }
  263. func mcnCheatUPList(c *blademaster.Context) {
  264. httpGetFunCheckCookie(
  265. new(model.MCNCheatUPListReq),
  266. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  267. return srv.MCNCheatUPList(cont, arg.(*model.MCNCheatUPListReq))
  268. },
  269. "mcnCheatUPList")(c)
  270. }
  271. func mcnImportUPInfo(c *blademaster.Context) {
  272. httpGetFunCheckCookie(
  273. new(model.MCNImportUPInfoReq),
  274. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  275. return srv.MCNImportUPInfo(cont, arg.(*model.MCNImportUPInfoReq))
  276. },
  277. "mcnImportUPInfo")(c)
  278. }
  279. func mcnImportUPRewardSign(c *blademaster.Context) {
  280. httpPostJSONCookie(
  281. new(model.MCNImportUPRewardSignReq),
  282. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  283. var uids, name *http.Cookie
  284. args := arg.(*model.MCNImportUPRewardSignReq)
  285. if name, err = c.Request.Cookie("username"); err == nil {
  286. args.UserName = name.Value
  287. }
  288. if uids, err = c.Request.Cookie("uid"); err == nil {
  289. if args.UID, err = strconv.ParseInt(uids.Value, 10, 64); err != nil {
  290. return
  291. }
  292. }
  293. return nil, srv.MCNImportUPRewardSign(cont, arg.(*model.MCNImportUPRewardSignReq))
  294. },
  295. "mcnImportUPRewardSign")(c)
  296. }
  297. func mcnIncreaseList(c *blademaster.Context) {
  298. httpGetFunCheckCookie(
  299. new(model.MCNIncreaseListReq),
  300. func(cont context.Context, arg interface{}) (res interface{}, err error) {
  301. return srv.MCNIncreaseList(cont, arg.(*model.MCNIncreaseListReq))
  302. },
  303. "mcnIncreaseList")(c)
  304. }