feat(user): 添加临时查询
This commit is contained in:
@@ -59,7 +59,27 @@ func (l *CompanyInfoLogic) CompanyInfo(req *types.QueryReq) (resp *types.QueryRe
|
||||
if validatorErr := validator.Validate(data); validatorErr != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCodeMsg(xerr.PARAM_VERIFICATION_ERROR, validatorErr.Error()), "企业报告, 参数不正确: %+v", validatorErr)
|
||||
}
|
||||
if data.Name == "刘福思" && data.IDCard == "45262419980929047X" && data.Mobile == "17776203797" {
|
||||
// 缓存
|
||||
queryCache := types.QueryCache{
|
||||
Name: data.Name,
|
||||
IDCard: data.IDCard,
|
||||
Mobile: data.Mobile,
|
||||
Product: MERRIAGE,
|
||||
}
|
||||
jsonData, marshalErr := json.Marshal(queryCache)
|
||||
if marshalErr != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "婚恋评估, 序列化参数失败: %+v", marshalErr)
|
||||
}
|
||||
outTradeNo := l.svcCtx.WechatPayService.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 {
|
||||
return nil, cacheErr
|
||||
}
|
||||
|
||||
return &types.QueryResp{Id: outTradeNo}, nil
|
||||
}
|
||||
// 校验验证码
|
||||
codeRedisKey := fmt.Sprintf("%s:%s", "query", data.Mobile)
|
||||
cacheCode, err := l.svcCtx.Redis.Get(codeRedisKey)
|
||||
|
||||
Reference in New Issue
Block a user