@@ -8,6 +8,8 @@ import ( | |||||
"applet/app/svc" | "applet/app/svc" | ||||
"applet/app/utils" | "applet/app/utils" | ||||
"applet/app/utils/cache" | "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/implement" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | ||||
@@ -39,6 +41,12 @@ func GetOssUrl(c *gin.Context) { | |||||
} | } | ||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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() | sysCfgs, err := sysCfgDb.SysCfgGetAll() | ||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
@@ -9,6 +9,8 @@ import ( | |||||
"applet/app/svc" | "applet/app/svc" | ||||
"applet/app/utils" | "applet/app/utils" | ||||
"applet/app/utils/cache" | "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/implement" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/aliyun" | "code.fnuoos.com/EggPlanet/egg_system_rules.git/aliyun" | ||||
@@ -321,6 +323,12 @@ func commReq(c *gin.Context, req md.RegisterReq) { | |||||
var inviteCode string | var inviteCode string | ||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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) | sysCfg := sysCfgDb.SysCfgFindWithDb(enum.AppInviteType, enum.AppInviteLength) | ||||
inviteCode = svc.ReturnCode(utils.StrToInt(sysCfg[enum.AppInviteLength]), utils.StrToInt(sysCfg[enum.AppInviteType]), 0) | inviteCode = svc.ReturnCode(utils.StrToInt(sysCfg[enum.AppInviteLength]), utils.StrToInt(sysCfg[enum.AppInviteType]), 0) | ||||
if req.InviteCode != "" { | if req.InviteCode != "" { | ||||
@@ -9,6 +9,8 @@ import ( | |||||
"applet/app/svc" | "applet/app/svc" | ||||
"applet/app/utils" | "applet/app/utils" | ||||
"applet/app/utils/cache" | "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/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" | rule2 "code.fnuoos.com/EggPlanet/egg_system_rules.git" | ||||
@@ -412,6 +414,12 @@ func LaunchBindAlipayAccount(c *gin.Context) { | |||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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() | sysCfgs, err := sysCfgDb.SysCfgGetAll() | ||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
@@ -3,6 +3,8 @@ package alipay | |||||
import ( | import ( | ||||
"applet/app/db" | "applet/app/db" | ||||
"applet/app/utils/cache" | "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/implement" | ||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | ||||
"errors" | "errors" | ||||
@@ -10,6 +12,12 @@ import ( | |||||
func FacePrepareAlipayCode(method string, params map[string]string) (interface{}, error) { | func FacePrepareAlipayCode(method string, params map[string]string) (interface{}, error) { | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) | 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) | |||||
sysCfgMap := sysCfgDb.SysCfgFindWithDb("alipay_face_url", enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) | sysCfgMap := sysCfgDb.SysCfgFindWithDb("alipay_face_url", enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) | ||||
// 获取私钥和APPID | // 获取私钥和APPID | ||||
@@ -3,6 +3,8 @@ package alipay | |||||
import ( | import ( | ||||
"applet/app/db" | "applet/app/db" | ||||
"applet/app/utils/cache" | "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/implement" | ||||
"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" | ||||
@@ -27,6 +29,12 @@ type InitAlipayStruct struct { | |||||
func InitAlipay(initData *InitAlipayStruct) (client *alipay.Client, err error) { | func InitAlipay(initData *InitAlipayStruct) (client *alipay.Client, err error) { | ||||
if initData == nil { | if initData == nil { | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) | 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) | |||||
sysCfgMap := sysCfgDb.SysCfgFindWithDb(enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) | sysCfgMap := sysCfgDb.SysCfgFindWithDb(enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) | ||||
initData = &InitAlipayStruct{ | initData = &InitAlipayStruct{ | ||||
IsProd: true, | IsProd: true, | ||||
@@ -3,6 +3,8 @@ package svc | |||||
import ( | import ( | ||||
"applet/app/db" | "applet/app/db" | ||||
"applet/app/utils/cache" | "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/implement" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"github.com/tidwall/gjson" | "github.com/tidwall/gjson" | ||||
@@ -11,6 +13,12 @@ import ( | |||||
func AliyunCaptchBase(c *gin.Context) (string, string) { | func AliyunCaptchBase(c *gin.Context) (string, string) { | ||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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") | 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" { | if c.GetHeader("platform") == "android" { | ||||
return data["aliyun_captch_id_android"], data["aliyun_captch_key_android"] | return data["aliyun_captch_id_android"], data["aliyun_captch_key_android"] | ||||
@@ -26,6 +34,12 @@ func AliyunCaptchBase(c *gin.Context) (string, string) { | |||||
func AliyunSmsBase(c *gin.Context, types string) map[string]string { | func AliyunSmsBase(c *gin.Context, types string) map[string]string { | ||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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 := 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() | data["aliyun_sms_code"] = gjson.Get(data["aliyun_sms_code"], types).String() | ||||
return data | return data | ||||
@@ -5,6 +5,7 @@ import ( | |||||
"applet/app/utils" | "applet/app/utils" | ||||
"applet/app/utils/cache" | "applet/app/utils/cache" | ||||
"applet/app/utils/logx" | "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/implement" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
@@ -27,6 +28,12 @@ func UserImg(user *model.User) *model.User { | |||||
func GetOssDomain() string { | func GetOssDomain() string { | ||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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") | sysCfg := sysCfgDb.SysCfgFindWithDb("oss_domain", "oss_bucket_scheme") | ||||
http := sysCfg["oss_bucket_scheme"] | http := sysCfg["oss_bucket_scheme"] | ||||
return http + "://" + sysCfg["oss_domain"] + "/" | return http + "://" + sysCfg["oss_domain"] + "/" | ||||
@@ -34,6 +41,12 @@ func GetOssDomain() string { | |||||
func GetOssUrl(img string) string { | func GetOssUrl(img string) string { | ||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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") | sysCfg := sysCfgDb.SysCfgFindWithDb("oss_domain", "oss_bucket_scheme") | ||||
if strings.Contains(img, "http") == false && img != "" { | if strings.Contains(img, "http") == false && img != "" { | ||||
http := sysCfg["oss_bucket_scheme"] | http := sysCfg["oss_bucket_scheme"] | ||||
@@ -51,6 +64,12 @@ func NumFormat(num int) string { | |||||
func GetSysCfgStr(key string) string { | func GetSysCfgStr(key string) string { | ||||
redisConn := cache.GetPool().Get() | redisConn := cache.GetPool().Get() | ||||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | 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) | return sysCfgDb.SysCfgGetWithDb(key) | ||||
} | } | ||||
@@ -32,7 +32,7 @@ require ( | |||||
) | ) | ||||
require ( | require ( | ||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241210053355-df51eb14c56e | |||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241211055111-7c47b67b46d2 | |||||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241207095445-64c8aa0b486e | code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241207095445-64c8aa0b486e | ||||
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 | ||||