Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
jls-weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2026-05-18 11:43:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
67beb7b7dce448ba39ddbb9fadad6c3ca2b545c7
67beb7b7
1 parent
0814f4fe
fix: 补全微信支付请求缺失的client_id参数
导出配置中的CLIENT_ID常量,补充微信支付API的参数说明,并在支付调用时传入该参数
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
src/api/index.js
src/composables/useWechatMiniPay.js
src/utils/config.js
src/api/index.js
View file @
67beb7b
...
...
@@ -23,6 +23,7 @@ export const getHomeContentAPI = () => fn(fetch.get(Api.HOME_CONTENT))
* @description 获取微信支付参数(order_id 主支付链路)
* @param {Object} params 请求参数
* @param {string} params.order_id 支付订单 ID
* @param {string} params.client_id 客户端 ID(当前显式透传给 pay 接口)
* @returns {Promise<{code:number,data:any,msg:string}>}
*/
export
const
getWechatPayParamsAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
PAY_TEST
,
params
))
...
...
src/composables/useWechatMiniPay.js
View file @
67beb7b
...
...
@@ -3,6 +3,7 @@ import Taro from '@tarojs/taro'
import
{
getWechatPayParamsAPI
}
from
'@/api'
import
{
clearSessionId
}
from
'@/utils/request'
import
{
hasAuth
,
silentAuth
}
from
'@/utils/authRedirect'
import
{
CLIENT_ID
}
from
'@/utils/config'
/**
* @description 微信小程序支付能力封装
...
...
@@ -104,7 +105,10 @@ export const useWechatMiniPay = () => {
update_result_text
(
'正在请求支付参数...'
,
options
)
try
{
const
pay_res
=
await
getWechatPayParamsAPI
({
order_id
:
normalized_order_id
})
const
pay_res
=
await
getWechatPayParamsAPI
({
order_id
:
normalized_order_id
,
client_id
:
CLIENT_ID
,
})
if
(
!
pay_res
?.
code
||
!
pay_res
?.
data
)
{
const
message
=
pay_res
?.
msg
||
'获取支付参数失败'
update_result_text
(
message
,
options
)
...
...
src/utils/config.js
View file @
67beb7b
...
...
@@ -4,7 +4,7 @@
*/
const
F
=
'futian_wxamp'
const
CLIENT_ID
=
'358209'
export
const
CLIENT_ID
=
'358209'
export
const
API_ENVIRONMENTS
=
{
production
:
{
...
...
Please
register
or
login
to post a comment