new
This commit is contained in:
@@ -1353,8 +1353,21 @@ func (l *QueryServiceLogic) Verify(Name string, IDCard string, Mobile string) er
|
||||
// 缓存
|
||||
func (l *QueryServiceLogic) CacheData(params map[string]interface{}, Product string, userID int64) (string, error) {
|
||||
agentIdentifier, _ := l.ctx.Value("agentIdentifier").(string)
|
||||
secretKey := l.svcCtx.Config.Encrypt.SecretKey
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return "", errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 获取AES密钥失败: %+v", decodeErr)
|
||||
}
|
||||
paramsMarshal, marshalErr := json.Marshal(params)
|
||||
if marshalErr != nil {
|
||||
return "", errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 序列化参数失败: %+v", marshalErr)
|
||||
}
|
||||
encryptParams, aesEncryptErr := crypto.AesEncrypt(paramsMarshal, key)
|
||||
if aesEncryptErr != nil {
|
||||
return "", errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 加密参数失败: %+v", aesEncryptErr)
|
||||
}
|
||||
queryCache := types.QueryCacheLoad{
|
||||
Params: params,
|
||||
Params: encryptParams,
|
||||
Product: Product,
|
||||
AgentIdentifier: agentIdentifier,
|
||||
}
|
||||
@@ -1362,7 +1375,7 @@ func (l *QueryServiceLogic) CacheData(params map[string]interface{}, Product str
|
||||
if marshalErr != nil {
|
||||
return "", errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 序列化参数失败: %+v", marshalErr)
|
||||
}
|
||||
outTradeNo := l.svcCtx.WechatPayService.GenerateOutTradeNo()
|
||||
outTradeNo := l.svcCtx.AlipayService.GenerateOutTradeNo()
|
||||
redisKey := fmt.Sprintf("%d:%s", userID, outTradeNo)
|
||||
cacheErr := l.svcCtx.Redis.SetexCtx(l.ctx, redisKey, string(jsonData), int(2*time.Hour))
|
||||
if cacheErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user