蛋蛋星球 后台端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hdl_withdraw.go 16 KiB

3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
2 weeks ago
2 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
3 weeks ago
2 weeks ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. package financial_center
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. md "applet/app/md/financial_center"
  6. svc "applet/app/svc/financial_center"
  7. "applet/app/utils"
  8. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  9. "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
  10. "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum"
  11. md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
  12. "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule"
  13. md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
  14. "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
  15. "errors"
  16. "github.com/gin-gonic/gin"
  17. "github.com/jinzhu/copier"
  18. "strings"
  19. "time"
  20. )
  21. // GetWithdrawSetting
  22. // @Summary 财务中心-提现-基础设置(获取)
  23. // @Tags 提现
  24. // @Description 基础设置(获取)
  25. // @Accept json
  26. // @Produce json
  27. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  28. // @Success 200 {object} md.GetWithdrawSettingResp "具体数据"
  29. // @Failure 400 {object} md.Response "具体错误"
  30. // @Router /api/financialCenter/withdraw/setting [get]
  31. func GetWithdrawSetting(c *gin.Context) {
  32. // 等级列表
  33. levelDb := implement.NewUserLevelDb(db.Db)
  34. levels, err1 := levelDb.UserLevelAllByAsc()
  35. if err1 != nil {
  36. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  37. return
  38. }
  39. levelsList := make([]map[string]interface{}, 0)
  40. levelsMap := make(map[int]string)
  41. for _, level := range levels {
  42. levelsList = append(levelsList, map[string]interface{}{
  43. "id": level.Id,
  44. "name": level.LevelName,
  45. })
  46. levelsMap[level.Id] = level.LevelName
  47. }
  48. settingDb := implement.NewFinWithdrawSettingDb(db.Db)
  49. setting, err := settingDb.FinWithdrawSettingGetOne()
  50. if err != nil {
  51. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  52. return
  53. }
  54. // 不存在则初始化
  55. var emptyNum []string
  56. if setting == nil {
  57. now := time.Now()
  58. frequency := md2.WithdrawFrequencySettingStruct{
  59. Duration: 1,
  60. Num: emptyNum,
  61. }
  62. withdrawFeeSet := md2.WithdrawFeeSetStruct{
  63. Kind: 1,
  64. Value: 0,
  65. }
  66. firstWithdrawSet := md2.FirstWithdrawSet{
  67. IsNeedRealName: 0,
  68. FirstWithdrawAmountLimit: "",
  69. }
  70. frequencyStr := utils.SerializeStr(frequency)
  71. withdrawFeeSetStr := utils.SerializeStr(withdrawFeeSet)
  72. firstWithdrawSetStr := utils.SerializeStr(firstWithdrawSet)
  73. m := model.FinWithdrawSetting{
  74. FrequencySet: frequencyStr,
  75. WithdrawType: 1,
  76. VipLevelLimit: 0,
  77. IsRealName: 0,
  78. WithdrawNumsLimit: 0,
  79. WithdrawAmountLimit: "",
  80. WithdrawMultipleLimit: "",
  81. IsSupportDecimalPoint: 0,
  82. IsAuto: 0,
  83. WithdrawTimeInterval: "00:00-00:00",
  84. WithdrawFeeSet: withdrawFeeSetStr,
  85. PendingOrdersIsCanApply: 0,
  86. ConditionIsOpen: 0,
  87. FirstWithdrawSet: firstWithdrawSetStr,
  88. CreateAt: now.Format("2006-01-02 15:04:05"),
  89. }
  90. _, err2 := settingDb.FinWithdrawSettingInsert(&m)
  91. if err2 != nil {
  92. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  93. return
  94. }
  95. setting, err = settingDb.FinWithdrawSettingGetOne()
  96. if err != nil {
  97. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  98. return
  99. }
  100. }
  101. var frequency md2.WithdrawFrequencySettingStruct
  102. var withdrawFeeSet md2.WithdrawFeeSetStruct
  103. var firstWithdrawSet md2.FirstWithdrawSet
  104. utils.Unserialize([]byte(setting.FrequencySet), &frequency)
  105. utils.Unserialize([]byte(setting.WithdrawFeeSet), &withdrawFeeSet)
  106. utils.Unserialize([]byte(setting.FirstWithdrawSet), &firstWithdrawSet)
  107. withdrawTimeIntervals := strings.Split(setting.WithdrawTimeInterval, "-")
  108. withdrawTimeInterval := md2.WithdrawTimeIntervalStruct{
  109. StartAt: withdrawTimeIntervals[0],
  110. EndAt: withdrawTimeIntervals[1],
  111. }
  112. resp := md.GetWithdrawSettingResp{
  113. Id: setting.Id,
  114. FrequencySet: frequency,
  115. WithdrawType: setting.WithdrawType,
  116. VipLevelLimit: setting.VipLevelLimit,
  117. IsRealName: setting.IsRealName,
  118. WithdrawNumsLimit: setting.WithdrawNumsLimit,
  119. WithdrawAmountLimit: setting.WithdrawAmountLimit,
  120. WithdrawMultipleLimit: setting.WithdrawMultipleLimit,
  121. IsSupportDecimalPoint: setting.IsSupportDecimalPoint,
  122. IsAuto: setting.IsAuto,
  123. IsAutoAmountLimit: setting.IsAutoAmountLimit,
  124. WithdrawTimeInterval: withdrawTimeInterval,
  125. WithdrawFeeSet: withdrawFeeSet,
  126. FirstWithdrawSet: firstWithdrawSet,
  127. PendingOrdersIsCanApply: setting.PendingOrdersIsCanApply,
  128. ConditionIsOpen: setting.ConditionIsOpen,
  129. LevelList: levelsList,
  130. }
  131. e.OutSuc(c, resp, nil)
  132. }
  133. // UpdateWithdrawSetting
  134. // @Summary 财务中心-提现-基础设置(更新)
  135. // @Tags 提现
  136. // @Description 基础设置(更新)
  137. // @Accept json
  138. // @Produce json
  139. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  140. // @Param req body md.UpdateWithdrawSettingReq true "id 必填"
  141. // @Success 200 {int} "修改数据条数"
  142. // @Failure 400 {object} md.Response "具体错误"
  143. // @Router /api/financialCenter/withdraw/updateWithdrawSetting [POST]
  144. func UpdateWithdrawSetting(c *gin.Context) {
  145. var req *md.UpdateWithdrawSettingReq
  146. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  147. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  148. return
  149. }
  150. if req.WithdrawTimeInterval.StartAt != "" {
  151. res := utils.IsTimeFormat(req.WithdrawTimeInterval.StartAt)
  152. if req.WithdrawTimeInterval.StartAt > "23:59" {
  153. res = false
  154. }
  155. if !res {
  156. e.OutErr(c, e.ERR_INVALID_ARGS, errors.New("开始时间应为 xx:xx 且不超过 23:59").Error())
  157. return
  158. }
  159. }
  160. if req.WithdrawTimeInterval.EndAt != "" {
  161. res := utils.IsTimeFormat(req.WithdrawTimeInterval.EndAt)
  162. if req.WithdrawTimeInterval.EndAt > "23:59" {
  163. res = false
  164. }
  165. if !res {
  166. e.OutErr(c, e.ERR_INVALID_ARGS, errors.New("结束时间应为 xx:xx 且不超过 23:59").Error())
  167. return
  168. }
  169. }
  170. frequencyStr := utils.SerializeStr(req.FrequencySet)
  171. withdrawFeeSetStr := utils.SerializeStr(req.WithdrawFeeSet)
  172. firstWithdrawSetStr := utils.SerializeStr(req.FirstWithdrawSet)
  173. var withdrawTimeInterval []string
  174. withdrawTimeInterval = append(withdrawTimeInterval, req.WithdrawTimeInterval.StartAt)
  175. withdrawTimeInterval = append(withdrawTimeInterval, req.WithdrawTimeInterval.EndAt)
  176. withdrawTimeIntervalStr := strings.Join(withdrawTimeInterval, "-")
  177. m := model.FinWithdrawSetting{
  178. Id: req.Id,
  179. FrequencySet: frequencyStr,
  180. WithdrawType: req.WithdrawType,
  181. VipLevelLimit: req.VipLevelLimit,
  182. IsRealName: req.IsRealName,
  183. WithdrawNumsLimit: req.WithdrawNumsLimit,
  184. WithdrawAmountLimit: req.WithdrawAmountLimit,
  185. WithdrawMultipleLimit: req.WithdrawMultipleLimit,
  186. IsSupportDecimalPoint: req.IsSupportDecimalPoint,
  187. IsAuto: req.IsAuto,
  188. IsAutoAmountLimit: req.IsAutoAmountLimit,
  189. WithdrawTimeInterval: withdrawTimeIntervalStr,
  190. WithdrawFeeSet: withdrawFeeSetStr,
  191. PendingOrdersIsCanApply: req.PendingOrdersIsCanApply,
  192. ConditionIsOpen: req.ConditionIsOpen,
  193. FirstWithdrawSet: firstWithdrawSetStr,
  194. }
  195. forceColumns := []string{"withdraw_type", "is_real_name", "withdraw_nums_limit",
  196. "withdraw_amount_limit", "withdraw_multiple_limit", "is_support_decimal_point",
  197. "is_auto", "first_withdraw_set", "is_auto_amount_limit", "pending_orders_is_can_apply",
  198. "condition_is_open",
  199. }
  200. settingDb := implement.NewFinWithdrawSettingDb(db.Db)
  201. affected, err := settingDb.FinWithdrawSettingUpdate(req.Id, &m, forceColumns...)
  202. if err != nil {
  203. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  204. return
  205. }
  206. e.OutSuc(c, affected, nil)
  207. }
  208. // GetWithdrawApplyList
  209. // @Summary 财务中心-提现-提现申请列表(获取)
  210. // @Tags 提现
  211. // @Description 提现申请列表(获取)
  212. // @Accept json
  213. // @Produce json
  214. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  215. // @Param req body md.GetWithdrawApplyListReq false "筛选条件"
  216. // @Success 200 {object} md.GetWithdrawApplyListResp "具体数据"
  217. // @Failure 400 {object} md.Response "具体错误"
  218. // @Router /api/financialCenter/withdraw/applyList [POST]
  219. func GetWithdrawApplyList(c *gin.Context) {
  220. var req *md.GetWithdrawApplyListReq
  221. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  222. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  223. return
  224. }
  225. levelDb := implement.NewUserLevelDb(db.Db)
  226. levels, err1 := levelDb.UserLevelAllByAsc()
  227. if err1 != nil {
  228. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  229. return
  230. }
  231. levelsList := make([]map[string]interface{}, 0)
  232. levelsMap := make(map[int]string)
  233. for _, level := range levels {
  234. levelsList = append(levelsList, map[string]interface{}{
  235. "id": level.Id,
  236. "name": level.LevelName,
  237. })
  238. levelsMap[level.Id] = level.LevelName
  239. }
  240. tagDb := implement.NewUserTagDb(db.Db)
  241. tags, err2 := tagDb.UserTagAllByAsc()
  242. if err2 != nil {
  243. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  244. return
  245. }
  246. tagsList := make([]map[string]interface{}, 0)
  247. tagsMap := make(map[int]string)
  248. for _, tag := range tags {
  249. tagsList = append(tagsList, map[string]interface{}{
  250. "id": tag.Id,
  251. "name": tag.TagName,
  252. })
  253. tagsMap[tag.Id] = tag.TagName
  254. }
  255. applies, total, err3 := svc.WithDrawManagementGetApply(db.Db, req)
  256. if err3 != nil {
  257. e.OutErr(c, e.ERR_DB_ORM, err3.Error())
  258. return
  259. }
  260. list := make([]md.GetWithdrawApplyListNode, len(*applies))
  261. parentIDs := make([]int64, len(*applies))
  262. UserIDs := make([]int64, len(*applies))
  263. for _, apply := range *applies {
  264. parentIDs = append(parentIDs, apply.ParentID)
  265. UserIDs = append(UserIDs, apply.UserID)
  266. }
  267. // 查询上级
  268. userDb := implement.NewUserDb(db.Db)
  269. parents, err := userDb.UserFindByParams(map[string]interface{}{
  270. "key": "id",
  271. "value": parentIDs,
  272. })
  273. if err != nil {
  274. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  275. return
  276. }
  277. parentsMap := make(map[int64]model.User)
  278. for _, parent := range parents {
  279. parentsMap[parent.Id] = parent
  280. }
  281. // 查询标签
  282. recordsDb := implement.NewUserTagRecordsDb(db.Db)
  283. records, err := recordsDb.UserTagRecordsFindByParams(map[string]interface{}{
  284. "key": "uid",
  285. "value": UserIDs,
  286. })
  287. if err != nil {
  288. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  289. return
  290. }
  291. recordsMap := make(map[int64][]md.TagNode)
  292. for _, record := range *records {
  293. temp := md.TagNode{
  294. TagID: record.TagId,
  295. TagName: "",
  296. }
  297. tagName, ok := tagsMap[record.TagId]
  298. temp.TagName = tagName
  299. v, ok := recordsMap[record.Uid]
  300. if ok {
  301. v = append(v, temp)
  302. } else {
  303. recordsMap[record.Uid] = []md.TagNode{temp}
  304. }
  305. }
  306. for i, apply := range *applies {
  307. list[i] = md.GetWithdrawApplyListNode{
  308. WithdrawApplyId: apply.WithdrawApplyId,
  309. UserID: apply.UserID,
  310. Nickname: apply.Nickname,
  311. ParentID: apply.ParentID,
  312. AliPayName: apply.AliPayName,
  313. WechatPayName: apply.WxPayName,
  314. AliPayAccount: apply.AliPayAccount,
  315. WechatPayAccount: apply.WxPayAccount,
  316. WithdrawType: apply.WithdrawType,
  317. InviteCode: apply.InviteCode,
  318. Amount: apply.Amount,
  319. ActualReceipt: apply.RealAmount,
  320. SysFee: apply.SysFee,
  321. State: apply.State,
  322. ApplyAt: apply.ApplyAt,
  323. PayAt: apply.PayAt,
  324. Memo: apply.Memo,
  325. }
  326. if apply.Amount != "" && apply.SysFee != "" {
  327. actualReceipt := utils.StrToFloat64(apply.Amount) - utils.StrToFloat64(apply.SysFee)
  328. list[i].ActualReceipt = utils.Float64ToStr(actualReceipt)
  329. }
  330. if apply.ParentID != 0 {
  331. v, ok := parentsMap[apply.ParentID]
  332. if ok {
  333. list[i].ParentPhone = v.Phone
  334. }
  335. }
  336. tagList, ok := recordsMap[apply.UserID]
  337. if ok {
  338. list[i].Tag = tagList
  339. }
  340. }
  341. applyDb := implement.NewFinWithdrawApplyDb(db.Db)
  342. underReviewAmount, err := applyDb.FinWithdrawApplyAmountGetByParams(map[string]interface{}{
  343. "key": "state",
  344. "value": 0,
  345. })
  346. if err != nil {
  347. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  348. return
  349. }
  350. pendingAmount, err := applyDb.FinWithdrawApplyAmountGetByParams(map[string]interface{}{
  351. "key": "state",
  352. "value": 4,
  353. })
  354. if err != nil {
  355. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  356. return
  357. }
  358. paySucceedAmount, err := applyDb.FinWithdrawApplyAmountGetByParams(map[string]interface{}{
  359. "key": "state",
  360. "value": 2,
  361. })
  362. if err != nil {
  363. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  364. return
  365. }
  366. payFailedAmount, err := applyDb.FinWithdrawApplyAmountGetByParams(map[string]interface{}{
  367. "key": "state",
  368. "value": 3,
  369. })
  370. if err != nil {
  371. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  372. return
  373. }
  374. resp := md.GetWithdrawApplyListResp{
  375. ReasonList: []map[string]interface{}{
  376. {
  377. "value": enum.FinWithdrawApplyReasonForNotRule,
  378. "name": enum.FinWithdrawApplyReasonForNotRule.String(),
  379. },
  380. {
  381. "value": enum.FinWithdrawApplyReasonForAccountAbnormal,
  382. "name": enum.FinWithdrawApplyReasonForAccountAbnormal.String(),
  383. },
  384. {
  385. "value": enum.FinWithdrawApplyReasonForFundAbnormal,
  386. "name": enum.FinWithdrawApplyReasonForFundAbnormal.String(),
  387. },
  388. },
  389. LevelsList: levelsList,
  390. TagsList: tagsList,
  391. PendingAmount: utils.Float64ToStr(pendingAmount),
  392. PaySucceedAmount: utils.Float64ToStr(paySucceedAmount),
  393. PayFailedAmount: utils.Float64ToStr(payFailedAmount),
  394. UnderReviewAmount: utils.Float64ToStr(underReviewAmount),
  395. List: list,
  396. Paginate: md.Paginate{
  397. Limit: req.Limit,
  398. Page: req.Page,
  399. Total: total,
  400. },
  401. }
  402. e.OutSuc(c, resp, nil)
  403. }
  404. // WithdrawApplyAudit
  405. // @Summary 财务中心-提现-审核
  406. // @Tags 提现
  407. // @Description 提现审核
  408. // @Accept json
  409. // @Produce json
  410. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  411. // @Param req body md.WithdrawApplyAuditReq false "筛选条件"
  412. // @Success 200 {string} "success"
  413. // @Failure 400 {object} md.Response "具体错误"
  414. // @Router /api/financialCenter/withdraw/applyList [POST]
  415. func WithdrawApplyAudit(c *gin.Context) {
  416. var req *md.WithdrawApplyAuditReq
  417. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  418. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  419. return
  420. }
  421. //1、查找对应提现申请单
  422. finWithdrawApplyDb := implement.NewFinWithdrawApplyDb(db.Db)
  423. finWithdrawApply, err := finWithdrawApplyDb.FinWithdrawApplyGet(req.WithdrawApplyId)
  424. if err != nil {
  425. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  426. return
  427. }
  428. if finWithdrawApply == nil {
  429. e.OutErr(c, e.ERR_NOT_FAN, "提现记录不存在")
  430. return
  431. }
  432. //2、判断审核状态
  433. if req.AuditState == 1 {
  434. //通过(推mq、修改提现单成功)
  435. finWithdrawApply.State = int(enum.FinWithdrawApplyStateForIng)
  436. updateAffected, err1 := finWithdrawApplyDb.UpdateFinWithdrawApply(finWithdrawApply, "state")
  437. if err1 != nil {
  438. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  439. return
  440. }
  441. if updateAffected <= 0 {
  442. e.OutErr(c, e.ERR_DB_ORM, "更新提现单状态失败")
  443. return
  444. }
  445. ch, err1 := rabbit.Cfg.Pool.GetChannel()
  446. if err1 != nil {
  447. e.OutErr(c, e.ERR_INIT_RABBITMQ, err1.Error())
  448. return
  449. }
  450. defer ch.Release()
  451. var data md2.EggFinWithdrawApplyData
  452. err = copier.Copy(&data, &finWithdrawApply)
  453. if err != nil {
  454. e.OutErr(c, e.ERR, err.Error())
  455. return
  456. }
  457. ch.Publish(md2.EggAppExchange, utils.SerializeStr(data), md2.EggFinWithdrawApply)
  458. } else {
  459. //拒绝(退余额、修改提现单失败)
  460. session := db.Db.NewSession()
  461. defer session.Close()
  462. session.Begin()
  463. finWithdrawApply.State = int(enum.FinWithdrawApplyStateForBad)
  464. updateAffected, err1 := finWithdrawApplyDb.UpdateFinWithdrawApplyBySession(session, finWithdrawApply, "state")
  465. if err1 != nil {
  466. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  467. return
  468. }
  469. if updateAffected <= 0 {
  470. e.OutErr(c, e.ERR_DB_ORM, "更新提现单状态失败")
  471. return
  472. }
  473. dealUserWalletReq := md3.DealUserWalletReq{
  474. Direction: "sub",
  475. Kind: int(enum.UserWithdrawBad),
  476. Title: enum.UserWithdrawBad.String(),
  477. Uid: finWithdrawApply.Uid,
  478. Amount: utils.StrToFloat64(finWithdrawApply.Amount),
  479. }
  480. err = rule.DealUserWallet(session, dealUserWalletReq)
  481. if err != nil {
  482. session.Rollback()
  483. e.OutErr(c, e.ERR, err.Error())
  484. return
  485. }
  486. err = session.Commit()
  487. if err != nil {
  488. _ = session.Rollback()
  489. e.OutErr(c, e.ERR_DB_ORM, err)
  490. return
  491. }
  492. }
  493. e.OutSuc(c, "success", nil)
  494. }