@@ -1,6 +1,7 @@ | |||||
package hdl | package hdl | ||||
import ( | import ( | ||||
"applet/app/cfg" | |||||
"applet/app/db" | "applet/app/db" | ||||
"applet/app/e" | "applet/app/e" | ||||
alipay "applet/app/lib/gopay" | alipay "applet/app/lib/gopay" | ||||
@@ -10,6 +11,7 @@ import ( | |||||
"applet/app/utils/cache" | "applet/app/utils/cache" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "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" | "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | ||||
enum2 "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" | md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" | ||||
@@ -164,25 +166,6 @@ func WithdrawApply(c *gin.Context) { | |||||
return | return | ||||
} | } | ||||
user := svc.GetUser(c) | 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 userId, openId string | ||||
var kind int | var kind int | ||||
//sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) | //sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) | ||||
@@ -259,6 +242,7 @@ func WithdrawApply(c *gin.Context) { | |||||
Uid: user.Id, | Uid: user.Id, | ||||
Amount: utils.StrToFloat64(req.Amount), | Amount: utils.StrToFloat64(req.Amount), | ||||
} | } | ||||
rule2.Init(cfg.RedisAddr) | |||||
err = rule.DealUserWallet(session, dealUserWalletReq) | err = rule.DealUserWallet(session, dealUserWalletReq) | ||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
@@ -52,10 +52,12 @@ func ParseToken(tokenString string) (*JWTUser, string, error) { | |||||
//TODO::单设备验证 | //TODO::单设备验证 | ||||
cacheKey := fmt.Sprintf(TokenKey, claims.Uid) | cacheKey := fmt.Sprintf(TokenKey, claims.Uid) | ||||
cJwt, err1 := cache.GetString(cacheKey) | cJwt, err1 := cache.GetString(cacheKey) | ||||
if err != nil { | |||||
if err1 != nil { | |||||
return nil, "", err1 | return nil, "", err1 | ||||
} | } | ||||
if cJwt != tokenString && cJwt != "" { | if cJwt != tokenString && cJwt != "" { | ||||
fmt.Println(cJwt) | |||||
fmt.Println(tokenString) | |||||
return nil, "", errors.New("token expired") | return nil, "", errors.New("token expired") | ||||
} | } | ||||
@@ -7,7 +7,7 @@ import ( | |||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | ||||
"github.com/go-pay/gopay" | "github.com/go-pay/gopay" | ||||
"github.com/go-pay/gopay/alipay" | "github.com/go-pay/gopay/alipay" | ||||
"github.com/go-pay/gopay/pkg/xlog" | |||||
"github.com/go-pay/xlog" | |||||
) | ) | ||||
type InitAlipayStruct struct { | type InitAlipayStruct struct { | ||||
@@ -3,7 +3,7 @@ package alipay | |||||
import ( | import ( | ||||
"context" | "context" | ||||
"github.com/go-pay/gopay" | "github.com/go-pay/gopay" | ||||
"github.com/go-pay/gopay/pkg/xlog" | |||||
"github.com/go-pay/xlog" | |||||
"testing" | "testing" | ||||
) | ) | ||||
@@ -32,7 +32,7 @@ func CheckWithdraw(c *gin.Context, amount string) (err error, realAmount, fee st | |||||
//2、判断是否为第一次提现 | //2、判断是否为第一次提现 | ||||
var isCompleteFirstWithdraw bool | 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 { //第一次提现 | if !has { //第一次提现 | ||||
isFirst = true | isFirst = true | ||||
var firstWithdrawSet md.FirstWithdrawSet | var firstWithdrawSet md.FirstWithdrawSet | ||||
@@ -1,8 +1,6 @@ | |||||
module applet | 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 | //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/universal-translator v0.18.1 | ||||
github.com/go-playground/validator/v10 v10.20.0 | github.com/go-playground/validator/v10 v10.20.0 | ||||
github.com/go-redis/redis v6.15.9+incompatible | 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/jinzhu/copier v0.4.0 | ||||
github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 | github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 | ||||
github.com/qiniu/api.v7/v7 v7.8.2 | github.com/qiniu/api.v7/v7 v7.8.2 | ||||
@@ -35,12 +33,14 @@ require ( | |||||
require ( | require ( | ||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241203152302-b6aa8333c67e | 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_es.git v1.0.1-0.20241118083738-0f22da9ba0be | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | 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/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/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-pay/xtime v0.0.2 | ||||
github.com/go-sql-driver/mysql v1.8.1 | github.com/go-sql-driver/mysql v1.8.1 | ||||
github.com/gocolly/colly v1.2.0 | github.com/gocolly/colly v1.2.0 | ||||
@@ -116,7 +116,7 @@ require ( | |||||
go.uber.org/atomic v1.7.0 // indirect | go.uber.org/atomic v1.7.0 // indirect | ||||
go.uber.org/multierr v1.6.0 // indirect | go.uber.org/multierr v1.6.0 // indirect | ||||
golang.org/x/arch v0.7.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/lint v0.0.0-20200302205851-738671d3881b // indirect | ||||
golang.org/x/net v0.25.0 // indirect | golang.org/x/net v0.25.0 // indirect | ||||
golang.org/x/sync v0.8.0 // indirect | golang.org/x/sync v0.8.0 // indirect | ||||