f
This commit is contained in:
@@ -52,7 +52,6 @@ Wxpay:
|
||||
MchPlatformRAS: "PUB_KEY_ID_0111052766902026050900112134001605"
|
||||
NotifyUrl: "https://www.tianyuancha.cn/api/v1/pay/wechat/callback"
|
||||
RefundNotifyUrl: "https://www.tianyuancha.cn/api/v1/wechat/refund_callback"
|
||||
# MchApiv2Key: "Kx9pL2mQ8vR4tY6wE1zA5cD7fH0jN3bS"
|
||||
|
||||
Applepay:
|
||||
ProductionVerifyURL: "https://api.storekit.itunes.apple.com/inApps/v1/transactions/receipt"
|
||||
@@ -71,8 +70,8 @@ WechatH5:
|
||||
AppID: "wxd391e40295bd9dfb"
|
||||
AppSecret: "f0fa74f7ed8c3c9953677465d44a4c0c"
|
||||
WechatMini:
|
||||
AppID: "wx781abb66b3368963" # 小程序的AppID
|
||||
AppSecret: "c7d02cdb0fc23c35c93187af9243b00d" # 小程序的AppSecret
|
||||
AppID: "wx5bacc94add2da981" # 小程序的AppID
|
||||
AppSecret: "48a2c1e8ff1b7d4c0ff82fbefa64d2d0" # 小程序的AppSecret
|
||||
TycAppID: "wxe74617f3dd56c196"
|
||||
TycAppSecret: "c8207e54aef5689b2a7c1f91ed7ae8a0"
|
||||
Query:
|
||||
|
||||
@@ -113,7 +113,8 @@ var productHandlers = map[string]queryHandlerFunc{
|
||||
|
||||
// productHasSmsCode 表示该 product 解密后的请求结构体中是否包含必填短信验证码 Code。
|
||||
// 有 Code 的产品在「获取验证码」时已经做了滑块,这里不再强制要求 CaptchaVerifyParam。
|
||||
// 其他产品(无 Code)在查询时必须传并校验 CaptchaVerifyParam,防止跳过图形验证。
|
||||
// 其他产品(无 Code)在查询时必须传并校验 CaptchaVerifyParam,防止跳过图形验证;
|
||||
// 微信小程序(X-Platform: wxmini,见 ctxdata.GetPlatformFromCtx)不嵌入 H5 滑块,由 PreprocessLogic 跳过图形校验。
|
||||
func productHasSmsCode(product string) bool {
|
||||
switch product {
|
||||
case "marriage",
|
||||
@@ -140,8 +141,14 @@ func productHasSmsCode(product string) bool {
|
||||
}
|
||||
|
||||
func (l *QueryServiceLogic) PreprocessLogic(req *types.QueryServiceReq, product string) (*types.QueryServiceResp, error) {
|
||||
// 无短信验证码 Code 的 product:查询前必须传并校验滑块,否则不允许跳过
|
||||
if !productHasSmsCode(product) {
|
||||
// 无短信验证码 Code 的 product:查询前必须传并校验滑块;微信小程序端跳过(依赖登录态与 X-Platform)
|
||||
requireCaptcha := !productHasSmsCode(product)
|
||||
if requireCaptcha {
|
||||
if plat, platErr := ctxdata.GetPlatformFromCtx(l.ctx); platErr == nil && plat == model.PlatformWxMini {
|
||||
requireCaptcha = false
|
||||
}
|
||||
}
|
||||
if requireCaptcha {
|
||||
if req.CaptchaVerifyParam == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("请完成图形验证"), "product %s requires captcha", product)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func GetPlatformFromCtx(ctx context.Context) (string, error) {
|
||||
}
|
||||
|
||||
switch platform {
|
||||
case model.PlatformWxMini:
|
||||
case model.PlatformWxMini, "mp-weixin": // 兼容旧客户端误传的 uni 平台名
|
||||
return model.PlatformWxMini, nil
|
||||
case model.PlatformWxH5:
|
||||
return model.PlatformWxH5, nil
|
||||
@@ -99,6 +99,6 @@ func GetPlatformFromCtx(ctx context.Context) (string, error) {
|
||||
case model.PlatformH5:
|
||||
return model.PlatformH5, nil
|
||||
default:
|
||||
return "", fmt.Errorf("不支持的支付平台: %s", platform)
|
||||
return "", fmt.Errorf("不支持的客户端平台: %s", platform)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user