Browse Source

update

master
dengbiao 5 days ago
parent
commit
483ddf7338
4 changed files with 32 additions and 5 deletions
  1. +2
    -0
      app/e/code.go
  2. +26
    -2
      app/hdl/hdl_wallet.go
  3. +1
    -1
      app/svc/svc_withdraw_apply.go
  4. +3
    -2
      go.mod

+ 2
- 0
app/e/code.go View File

@@ -119,6 +119,7 @@ const (
ERR_PAY_ERR = 500013
ERR_IS_BIND_THIRDOTHER = 500014
ERR_IS_GRPC = 501000
ERR_INIT_RABBITMQ = 500016
)

var MsgFlags = map[int]string{
@@ -235,4 +236,5 @@ var MsgFlags = map[int]string{
ERR_LEVEL_REACH_TOP: "已经是最高等级",
ERR_USER_CHECK_ERR: "校验失败",
ERR_IS_GRPC: "GRPC请求失败",
ERR_INIT_RABBITMQ: "连接mq失败",
}

+ 26
- 2
app/hdl/hdl_wallet.go View File

@@ -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)
}



+ 1
- 1
app/svc/svc_withdraw_apply.go View File

@@ -57,7 +57,7 @@ func CheckWithdraw(c *gin.Context, amount string) (err error, realAmount, fee st
}

//6、 验证小数点
if withdrawSetting.IsSupportDecimalPoint > 0 && strings.Contains(amount, ".") {
if withdrawSetting.IsSupportDecimalPoint == 0 && strings.Contains(amount, ".") {
return errors.New("不支持的提现金额"), realAmount, fee, isAuto, isFirst
}



+ 3
- 2
go.mod View File

@@ -2,11 +2,12 @@ module applet

go 1.19

//replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models
replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models

//replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules
replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules

require (
github.com/jinzhu/copier v0.4.0
github.com/boombuler/barcode v1.0.1
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5
github.com/dgrijalva/jwt-go v3.2.0+incompatible


Loading…
Cancel
Save