fadd
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"tydata-server/app/main/model"
|
||||
"tydata-server/common/ctxdata"
|
||||
"tydata-server/common/xerr"
|
||||
"tydata-server/pkg/captcha"
|
||||
"tydata-server/pkg/lzkit/crypto"
|
||||
"tydata-server/pkg/lzkit/validator"
|
||||
|
||||
@@ -60,8 +61,23 @@ var productProcessors = map[string]func(*QueryServiceLogic, *types.QueryServiceR
|
||||
}
|
||||
|
||||
func (l *QueryServiceLogic) PreprocessLogic(req *types.QueryServiceReq, product string) (*types.QueryServiceResp, error) {
|
||||
if os.Getenv("ENV") != "development" {
|
||||
if req.CaptchaVerifyParam == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("图形验证码校验失败"), "查询服务, 验证码参数为空: %s", req.Product)
|
||||
}
|
||||
captchaCfg := l.svcCtx.Config.Captcha
|
||||
err := captcha.Verify(captcha.Config{
|
||||
AccessKeyID: captchaCfg.AccessKeyID,
|
||||
AccessKeySecret: captchaCfg.AccessKeySecret,
|
||||
EndpointURL: captchaCfg.EndpointURL,
|
||||
SceneID: captchaCfg.SceneID,
|
||||
}, req.CaptchaVerifyParam)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("图形验证码校验失败"), "查询服务, 验证码校验失败: %s", req.Product)
|
||||
}
|
||||
}
|
||||
if processor, exists := productProcessors[product]; exists {
|
||||
return processor(l, req) // 调用对应的处理函数
|
||||
return processor(l, req)
|
||||
}
|
||||
return nil, errors.New("未找到相应的处理程序")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user