@@ -60,6 +60,7 @@ func GetModuleSetting(c *gin.Context) { | |||
} | |||
var dataMap interface{} | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
scheme, domain := svc.ImageBucket(db.Db, redisConn) | |||
moduleStyle.Data = svc.ImageFormatWithBucketForDataInfo(scheme, domain, moduleStyle.Data) | |||
utils.Unserialize([]byte(moduleStyle.Data), &dataMap) | |||
@@ -8,8 +8,6 @@ import ( | |||
"applet/app/svc" | |||
"applet/app/utils" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||
@@ -40,13 +38,8 @@ func GetOssUrl(c *gin.Context) { | |||
return | |||
} | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err = sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
sysCfgs, err := sysCfgDb.SysCfgGetAll() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
@@ -670,6 +670,7 @@ func MyFansUserList(c *gin.Context) { | |||
} | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
scheme, domain := svc.ImageBucket(db.Db, redisConn) | |||
var data []md.OneLineUserNode | |||
for _, v := range results { | |||
@@ -9,8 +9,6 @@ import ( | |||
"applet/app/svc" | |||
"applet/app/utils" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/aliyun" | |||
@@ -322,13 +320,8 @@ func commReq(c *gin.Context, req md.RegisterReq) { | |||
var parentUser *model.User | |||
var inviteCode string | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err = sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.AppInviteType, enum.AppInviteLength) | |||
inviteCode = svc.ReturnCode(utils.StrToInt(sysCfg[enum.AppInviteLength]), utils.StrToInt(sysCfg[enum.AppInviteType]), 0) | |||
if req.InviteCode != "" { | |||
@@ -9,8 +9,6 @@ import ( | |||
"applet/app/svc" | |||
"applet/app/utils" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"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" | |||
@@ -413,13 +411,8 @@ func LaunchBindAlipayAccount(c *gin.Context) { | |||
scope := "auth_user" | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err = sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
sysCfgs, err := sysCfgDb.SysCfgGetAll() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
@@ -3,21 +3,15 @@ package alipay | |||
import ( | |||
"applet/app/db" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||
"errors" | |||
) | |||
func FacePrepareAlipayCode(method string, params map[string]string) (interface{}, error) { | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err := sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
sysCfgMap := sysCfgDb.SysCfgFindWithDb("alipay_face_url", enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) | |||
// 获取私钥和APPID | |||
@@ -3,8 +3,6 @@ package alipay | |||
import ( | |||
"applet/app/db" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||
"github.com/go-pay/gopay" | |||
@@ -28,13 +26,9 @@ type InitAlipayStruct struct { | |||
// isProd:是否是正式环境,沙箱环境请选择新版沙箱应用。 | |||
func InitAlipay(initData *InitAlipayStruct) (client *alipay.Client, err error) { | |||
if initData == nil { | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err = sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
sysCfgMap := sysCfgDb.SysCfgFindWithDb(enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) | |||
initData = &InitAlipayStruct{ | |||
IsProd: true, | |||
@@ -3,8 +3,6 @@ package svc | |||
import ( | |||
"applet/app/db" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"github.com/gin-gonic/gin" | |||
"github.com/tidwall/gjson" | |||
@@ -12,13 +10,8 @@ import ( | |||
func AliyunCaptchBase(c *gin.Context) (string, string) { | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err := sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
data := sysCfgDb.SysCfgFindWithDb("aliyun_captch_id_android", "aliyun_captch_key_android", "aliyun_captch_id_ios", "aliyun_captch_key_ios", "aliyun_captch_id_h5", "aliyun_captch_key_h5") | |||
if c.GetHeader("platform") == "android" { | |||
return data["aliyun_captch_id_android"], data["aliyun_captch_key_android"] | |||
@@ -33,13 +26,8 @@ func AliyunCaptchBase(c *gin.Context) (string, string) { | |||
} | |||
func AliyunSmsBase(c *gin.Context, types string) map[string]string { | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err := sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
data := sysCfgDb.SysCfgFindWithDb("aliyun_sms_id", "aliyun_sms_secret", "aliyun_sms_code", "aliyun_sms_sign_name") | |||
data["aliyun_sms_code"] = gjson.Get(data["aliyun_sms_code"], types).String() | |||
return data | |||
@@ -5,7 +5,6 @@ import ( | |||
"applet/app/utils" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
"github.com/gin-gonic/gin" | |||
@@ -27,26 +26,16 @@ func UserImg(user *model.User) *model.User { | |||
} | |||
func GetOssDomain() string { | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err := sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
sysCfg := sysCfgDb.SysCfgFindWithDb("oss_domain", "oss_bucket_scheme") | |||
http := sysCfg["oss_bucket_scheme"] | |||
return http + "://" + sysCfg["oss_domain"] + "/" | |||
} | |||
func GetOssUrl(img string) string { | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err := sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
sysCfg := sysCfgDb.SysCfgFindWithDb("oss_domain", "oss_bucket_scheme") | |||
if strings.Contains(img, "http") == false && img != "" { | |||
http := sysCfg["oss_bucket_scheme"] | |||
@@ -63,13 +52,8 @@ func NumFormat(num int) string { | |||
} | |||
func GetSysCfgStr(key string) string { | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
defer func(sysCfgDb dao.SysCfgDao) { | |||
err := sysCfgDb.Close() | |||
if err != nil { | |||
logx.Error("redis close err:" + err.Error()) // 记录错误信息 | |||
} | |||
}(sysCfgDb) | |||
return sysCfgDb.SysCfgGetWithDb(key) | |||
} | |||
@@ -228,6 +228,7 @@ func DetailGrabRedPackage(redPackageId string) (resp []md.RedPackageDetailUserNo | |||
receivedUserAmount := strings.Split(imSendRedPackageOrd.ReceivedUserAmount, ",") | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
scheme, domain := svc.ImageBucket(db.Db, redisConn) | |||
for k, v := range receivedUserIds { | |||
resp = append(resp, md.RedPackageDetailUserNode{ | |||
@@ -342,6 +343,7 @@ func BalancePayForRedPackage(user *model.User, money string, req md.SendRedPacka | |||
} | |||
redisConn := cache.GetPool().Get() | |||
defer redisConn.Close() | |||
scheme, domain := svc.ImageBucket(db.Db, redisConn) | |||
msg := &pb.RED_PACKAGE{ | |||
RedMessageType: pb.RedPacketMessageType_RMT_SEND, | |||
@@ -2,9 +2,9 @@ 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/boombuler/barcode v1.0.1 | |||