Commit 1433b669 by 郑炬波

feat: 时间配置

parent a9728212
...@@ -157,3 +157,8 @@ test('测试微信浏览器支付方式', () => { ...@@ -157,3 +157,8 @@ test('测试微信浏览器支付方式', () => {
expect(methods.length).toBe(1) expect(methods.length).toBe(1)
expect(methods[0].value).toBe(PayType.WECHAT) expect(methods[0].value).toBe(PayType.WECHAT)
}) })
test('测试时间接口', async () => {
const interval = await Payment.PayCheckIntervaL()
expect(interval).toBe(2000)
})
\ No newline at end of file
{ {
"name": "@ydl-packages/toolkit", "name": "@ydl-packages/toolkit",
"version": "1.0.1-next.24", "version": "1.0.1-next.25",
"description": "", "description": "",
"main": "./dist/index.umd.js", "main": "./dist/index.umd.js",
"scripts": { "scripts": {
......
...@@ -19,3 +19,5 @@ export const COMMIT_ORDER = `${BASE_URL_JAVA}/api/consult/consult/commit-order` ...@@ -19,3 +19,5 @@ export const COMMIT_ORDER = `${BASE_URL_JAVA}/api/consult/consult/commit-order`
export const IS_PAY = `${BASE_URL_JAVA}/api/auth/Order/isPay` export const IS_PAY = `${BASE_URL_JAVA}/api/auth/Order/isPay`
export const MY_BALANCE = `${BASE_GATEWAY}/v3/uc/mybalance` export const MY_BALANCE = `${BASE_GATEWAY}/v3/uc/mybalance`
export const PAY_CHECK_INTERVAL = `${BASE_URL_JAVA}/api/pay/auth/pay/payCheckInterval`
\ No newline at end of file
import {UNIT_PAY, IS_PAY, MY_BALANCE} from "./API"; import {UNIT_PAY, IS_PAY, MY_BALANCE, PAY_CHECK_INTERVAL} from "./API";
import md5 from 'blueimp-md5' import md5 from 'blueimp-md5'
import qs from 'qs' import qs from 'qs'
import {Utils} from "@/Utils/Utils"; import {Utils} from "@/Utils/Utils";
...@@ -364,4 +364,14 @@ export class Payment { ...@@ -364,4 +364,14 @@ export class Payment {
query[BACK_ORDER_ID] = backOrderId.toString() query[BACK_ORDER_ID] = backOrderId.toString()
return `${path}?${qs.stringify(query)}` return `${path}?${qs.stringify(query)}`
} }
static async PayCheckIntervaL(): Promise<number> {
const res = await requestForJava.get<Record<string, string>, DefaultResponse>(PAY_CHECK_INTERVAL)
let interval = 3000;
if(res.code === '200'){
interval = res.data * 1000;
return interval
}
return interval;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment