提交部分修改

This commit is contained in:
xiaogang 2025-12-19 18:08:19 +08:00
parent be6c10a69f
commit 7a434ce738
3 changed files with 18 additions and 5 deletions

View File

@ -58,3 +58,10 @@ export const queryOrderState = (params) => http({
...params
})
//SM3签名
export const getSM3Sign = (params) => http({
url:'/api/v1/sign',
method:'POST',
...params
})

View File

@ -1,4 +1,5 @@
import md5 from 'js-md5';
import getSM3Sign from '@/api/ycnc'
export default function useCode(){
return new Promise((resolve,reject) => {
const authCallback = (params) => {
@ -6,15 +7,19 @@ export default function useCode(){
const {code} = params
resolve(code)
}
const getNewAuthorization = () => {
const getNewAuthorization = async () => {
let appId = import.meta.env.VITE_YCNC_APPID;
let time = Date.now().toString();
let secret = import.meta.env.VITE_YCNC_SECRET;
let signBefore = appId + time + secret;
let sign = md5(signBefore);//普通md5
//MD5加密
// let secret = import.meta.env.VITE_YCNC_SECRET;
// let signBefore = appId + time + secret;
// let sign = md5(signBefore);
//sm3加密
let {data} = await getSM3Sign({params:{appId,time}})
let param = {
appId: appId,
sign: sign,
// sign: sign,
sign: data.sign,
time: time,
tran_code: "157",
fn: "authCallback",

View File

@ -57,6 +57,7 @@
})
}
provide('custom-events',{
handleBuy,
goDetail