|
|
@@ -12,9 +12,12 @@ import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" |
|
|
|
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule" |
|
|
|
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" |
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"github.com/jinzhu/copier" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
@@ -240,7 +243,7 @@ func WithdrawApply(c *gin.Context) { |
|
|
|
//4、新增提现记录 |
|
|
|
now := time.Now() |
|
|
|
finWithdrawApplyDb := implement.NewFinWithdrawApplyDb(db.Db) |
|
|
|
insertAffected, err := finWithdrawApplyDb.FinWithdrawApplyInsertOneBySession(session, &model.FinWithdrawApply{ |
|
|
|
finWithdrawApply := &model.FinWithdrawApply{ |
|
|
|
Uid: user.Id, |
|
|
|
AdmId: 0, |
|
|
|
Amount: req.Amount, |
|
|
@@ -267,7 +270,8 @@ func WithdrawApply(c *gin.Context) { |
|
|
|
Memo: "", |
|
|
|
UpdateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
CreateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
}) |
|
|
|
} |
|
|
|
insertAffected, err := finWithdrawApplyDb.FinWithdrawApplyInsertOneBySession(session, finWithdrawApply) |
|
|
|
if err != nil { |
|
|
|
session.Rollback() |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err) |
|
|
@@ -284,11 +288,31 @@ func WithdrawApply(c *gin.Context) { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err) |
|
|
|
return |
|
|
|
} |
|
|
|
err = session.Commit() |
|
|
|
if err != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//5、推入mq |
|
|
|
if isAuto { |
|
|
|
ch, err1 := rabbit.Cfg.Pool.GetChannel() |
|
|
|
if err1 != nil { |
|
|
|
e.OutErr(c, e.ERR_INIT_RABBITMQ, err1.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
defer ch.Release() |
|
|
|
var data md3.EggFinWithdrawApplyData |
|
|
|
err = copier.Copy(&data, &finWithdrawApply) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
ch.Publish(md3.EggAppExchange, utils.SerializeStr(data), md3.EggFinWithdrawApply) |
|
|
|
} |
|
|
|
|
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
} |
|
|
|
|
|
|
|