fix: 补全微信支付请求缺失的client_id参数
导出配置中的CLIENT_ID常量,补充微信支付API的参数说明,并在支付调用时传入该参数
Showing
3 changed files
with
7 additions
and
2 deletions
| ... | @@ -23,6 +23,7 @@ export const getHomeContentAPI = () => fn(fetch.get(Api.HOME_CONTENT)) | ... | @@ -23,6 +23,7 @@ export const getHomeContentAPI = () => fn(fetch.get(Api.HOME_CONTENT)) |
| 23 | * @description 获取微信支付参数(order_id 主支付链路) | 23 | * @description 获取微信支付参数(order_id 主支付链路) |
| 24 | * @param {Object} params 请求参数 | 24 | * @param {Object} params 请求参数 |
| 25 | * @param {string} params.order_id 支付订单 ID | 25 | * @param {string} params.order_id 支付订单 ID |
| 26 | + * @param {string} params.client_id 客户端 ID(当前显式透传给 pay 接口) | ||
| 26 | * @returns {Promise<{code:number,data:any,msg:string}>} | 27 | * @returns {Promise<{code:number,data:any,msg:string}>} |
| 27 | */ | 28 | */ |
| 28 | export const getWechatPayParamsAPI = (params) => fn(fetch.post(Api.PAY_TEST, params)) | 29 | export const getWechatPayParamsAPI = (params) => fn(fetch.post(Api.PAY_TEST, params)) | ... | ... |
| ... | @@ -3,6 +3,7 @@ import Taro from '@tarojs/taro' | ... | @@ -3,6 +3,7 @@ import Taro from '@tarojs/taro' |
| 3 | import { getWechatPayParamsAPI } from '@/api' | 3 | import { getWechatPayParamsAPI } from '@/api' |
| 4 | import { clearSessionId } from '@/utils/request' | 4 | import { clearSessionId } from '@/utils/request' |
| 5 | import { hasAuth, silentAuth } from '@/utils/authRedirect' | 5 | import { hasAuth, silentAuth } from '@/utils/authRedirect' |
| 6 | +import { CLIENT_ID } from '@/utils/config' | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * @description 微信小程序支付能力封装 | 9 | * @description 微信小程序支付能力封装 |
| ... | @@ -104,7 +105,10 @@ export const useWechatMiniPay = () => { | ... | @@ -104,7 +105,10 @@ export const useWechatMiniPay = () => { |
| 104 | update_result_text('正在请求支付参数...', options) | 105 | update_result_text('正在请求支付参数...', options) |
| 105 | 106 | ||
| 106 | try { | 107 | try { |
| 107 | - const pay_res = await getWechatPayParamsAPI({ order_id: normalized_order_id }) | 108 | + const pay_res = await getWechatPayParamsAPI({ |
| 109 | + order_id: normalized_order_id, | ||
| 110 | + client_id: CLIENT_ID, | ||
| 111 | + }) | ||
| 108 | if (!pay_res?.code || !pay_res?.data) { | 112 | if (!pay_res?.code || !pay_res?.data) { |
| 109 | const message = pay_res?.msg || '获取支付参数失败' | 113 | const message = pay_res?.msg || '获取支付参数失败' |
| 110 | update_result_text(message, options) | 114 | update_result_text(message, options) | ... | ... |
-
Please register or login to post a comment