diff --git a/app/hdl/hdl_wallet.go b/app/hdl/hdl_wallet.go index 32761d4..623af6a 100644 --- a/app/hdl/hdl_wallet.go +++ b/app/hdl/hdl_wallet.go @@ -1,6 +1,7 @@ package hdl import ( + "applet/app/cfg" "applet/app/db" "applet/app/e" alipay "applet/app/lib/gopay" @@ -10,6 +11,7 @@ import ( "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + rule2 "code.fnuoos.com/EggPlanet/egg_system_rules.git" "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" @@ -164,25 +166,6 @@ func WithdrawApply(c *gin.Context) { return } user := svc.GetUser(c) - //1. 判断是否为第一次提现 - isFirst := false - has, err := db.Db.Where("uid = ?", user.Id). - Get(model.FinWithdrawApply{}) - if !has { //第一次提现 - isFirst = true - } - settingDb := implement.NewFinWithdrawSettingDb(db.Db) - setting, err := settingDb.FinWithdrawSettingGetOne() - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err) - return - } - resp := svc.GetWithdrawCondition(user, setting, isFirst) - //判断实名 - if user.IsRealName != 1 && resp.IsNeedRealName { - e.OutErr(c, 400, e.NewErr(400, "请先前往实名认证")) - return - } var userId, openId string var kind int //sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) @@ -259,6 +242,7 @@ func WithdrawApply(c *gin.Context) { Uid: user.Id, Amount: utils.StrToFloat64(req.Amount), } + rule2.Init(cfg.RedisAddr) err = rule.DealUserWallet(session, dealUserWalletReq) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) diff --git a/app/lib/auth/auth.go b/app/lib/auth/auth.go index 2a8b793..34b8c43 100644 --- a/app/lib/auth/auth.go +++ b/app/lib/auth/auth.go @@ -52,10 +52,12 @@ func ParseToken(tokenString string) (*JWTUser, string, error) { //TODO::单设备验证 cacheKey := fmt.Sprintf(TokenKey, claims.Uid) cJwt, err1 := cache.GetString(cacheKey) - if err != nil { + if err1 != nil { return nil, "", err1 } if cJwt != tokenString && cJwt != "" { + fmt.Println(cJwt) + fmt.Println(tokenString) return nil, "", errors.New("token expired") } diff --git a/app/lib/gopay/init_alipay.go b/app/lib/gopay/init_alipay.go index 97c755d..2d98696 100644 --- a/app/lib/gopay/init_alipay.go +++ b/app/lib/gopay/init_alipay.go @@ -7,7 +7,7 @@ import ( "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" "github.com/go-pay/gopay" "github.com/go-pay/gopay/alipay" - "github.com/go-pay/gopay/pkg/xlog" + "github.com/go-pay/xlog" ) type InitAlipayStruct struct { diff --git a/app/lib/gopay/utils_test.go b/app/lib/gopay/utils_test.go index 3a3b073..d794dc0 100644 --- a/app/lib/gopay/utils_test.go +++ b/app/lib/gopay/utils_test.go @@ -3,7 +3,7 @@ package alipay import ( "context" "github.com/go-pay/gopay" - "github.com/go-pay/gopay/pkg/xlog" + "github.com/go-pay/xlog" "testing" ) diff --git a/app/svc/svc_withdraw_apply.go b/app/svc/svc_withdraw_apply.go index da7d5e3..35c300c 100644 --- a/app/svc/svc_withdraw_apply.go +++ b/app/svc/svc_withdraw_apply.go @@ -32,7 +32,7 @@ func CheckWithdraw(c *gin.Context, amount string) (err error, realAmount, fee st //2、判断是否为第一次提现 var isCompleteFirstWithdraw bool - has, err := db.Db.Where("uid =?", user.Id).Get(model.FinWithdrawApply{}) + has, err := db.Db.Where("uid =?", user.Id).Get(&model.FinWithdrawApply{}) if !has { //第一次提现 isFirst = true var firstWithdrawSet md.FirstWithdrawSet diff --git a/go.mod b/go.mod index ae0ee02..98922b3 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module applet -go 1.21 - -toolchain go1.23.2 +go 1.19 //replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models @@ -17,7 +15,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.20.0 github.com/go-redis/redis v6.15.9+incompatible - github.com/gomodule/redigo v1.9.2 + github.com/gomodule/redigo v2.0.0+incompatible github.com/jinzhu/copier v0.4.0 github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 github.com/qiniu/api.v7/v7 v7.8.2 @@ -35,12 +33,14 @@ require ( require ( code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241203152302-b6aa8333c67e - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241204064333-9ce6762e478f + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241204070258-4712985349b4 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible + github.com/gin-contrib/sessions v1.0.1 github.com/go-pay/crypto v0.0.1 - github.com/go-pay/gopay v1.5.106 + github.com/go-pay/gopay v1.5.101 + github.com/go-pay/xlog v0.0.2 github.com/go-pay/xtime v0.0.2 github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0 @@ -116,7 +116,7 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/arch v0.7.0 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.23.0 // indirect golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..d39e38f Binary files /dev/null and b/test.txt differ