hookehuyr

refactor(api): 重构API模块结构,分离支付和核销接口

将微信支付和义工核销相关接口从index.js分离到独立模块
更新相关文件引用路径,优化代码组织结构
添加项目规则说明,限制小程序环境变量使用
...@@ -9,3 +9,4 @@ description: 项目基于 Taro4, 文档参考: https://docs.taro.zone/docs/. ...@@ -9,3 +9,4 @@ description: 项目基于 Taro4, 文档参考: https://docs.taro.zone/docs/.
9 5. CSS使用 Tailwindcss. 9 5. CSS使用 Tailwindcss.
10 6. 单位统一使用 rpx. 10 6. 单位统一使用 rpx.
11 7. 生成代码时, 生成相应的中文注释, 方便后续维护. 11 7. 生成代码时, 生成相应的中文注释, 方便后续维护.
12 +8. 这是一个小程序项目, 不要使用其他环境才有的变量或者方法.
......
1 /* 1 /*
2 * @Date: 2023-08-24 09:42:27 2 * @Date: 2023-08-24 09:42:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2026-01-20 11:08:06 4 + * @LastEditTime: 2026-01-20 11:40:31
5 * @FilePath: /xyxBooking-weapp/src/api/index.js 5 * @FilePath: /xyxBooking-weapp/src/api/index.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -27,29 +27,9 @@ const Api = { ...@@ -27,29 +27,9 @@ const Api = {
27 // BILL_PAY_STATUS: '/srv/?a=api&t=bill_pay_status', 27 // BILL_PAY_STATUS: '/srv/?a=api&t=bill_pay_status',
28 QUERY_QR_CODE: '/srv/?a=api&t=id_number_query_qr_code', 28 QUERY_QR_CODE: '/srv/?a=api&t=id_number_query_qr_code',
29 ICBC_ORDER_QRY: '/srv/?a=icbc_orderqry', 29 ICBC_ORDER_QRY: '/srv/?a=icbc_orderqry',
30 - WX_PAY: '/srv/?a=icbc_pay_wxamp',
31 - REDEEM_LOGIN: '/srv/?f=reserve_admin&a=login',
32 - REDEEM_CHECK_AUTH: '/srv/?f=reserve_admin&a=user&t=check_auth',
33 - REDEEM_REDEEM: '/srv/?f=reserve_admin&a=bill&t=redeem',
34 }; 30 };
35 31
36 /** 32 /**
37 - * @description: 义工登录
38 - */
39 -export const volunteerLoginAPI = (params) => fn(fetch.post(Api.REDEEM_LOGIN, params));
40 -
41 -/**
42 - * @description: 检查核销权限
43 - * @returns {Object} { data.can_redeem: Boolean, msg: String}
44 - */
45 -export const checkRedeemPermissionAPI = (params) => fn(fetch.get(Api.REDEEM_CHECK_AUTH, params));
46 -
47 -/**
48 - * @description: 核销
49 - */
50 -export const verifyTicketAPI = (params) => fn(fetch.post(Api.REDEEM_REDEEM, params));
51 -
52 -/**
53 * @description: 可预约日期列表 33 * @description: 可预约日期列表
54 * @param {Array} month 月份,格式yyyy-mm 34 * @param {Array} month 月份,格式yyyy-mm
55 * @returns 35 * @returns
...@@ -202,10 +182,3 @@ export const queryQrCodeAPI = (params) => fn(fetch.get(Api.QUERY_QR_CODE, params ...@@ -202,10 +182,3 @@ export const queryQrCodeAPI = (params) => fn(fetch.get(Api.QUERY_QR_CODE, params
202 * @returns {String} 182 * @returns {String}
203 */ 183 */
204 export const icbcOrderQryAPI = (params) => fn(fetch.get(Api.ICBC_ORDER_QRY, params)); 184 export const icbcOrderQryAPI = (params) => fn(fetch.get(Api.ICBC_ORDER_QRY, params));
205 -
206 -/**
207 - * @description: 微信支付接口
208 - * @param {*} pay_id 预约单支付凭证
209 - * @returns {*} 微信支付参数
210 - */
211 -export const wxPayAPI = (params) => fn(fetch.post(Api.WX_PAY, params));
......
1 +/*
2 + * @Date: 2026-01-20 11:38:20
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2026-01-20 11:41:37
5 + * @FilePath: /xyxBooking-weapp/src/api/redeem.js
6 + * @Description: 义工核销端接口
7 + */
8 +import { fn, fetch } from '@/api/fn';
9 +
10 +const Api = {
11 + REDEEM_LOGIN: '/srv/?f=reserve_admin&a=login',
12 + REDEEM_CHECK_AUTH: '/srv/?f=reserve_admin&a=user&t=check_auth',
13 + REDEEM_REDEEM: '/srv/?f=reserve_admin&a=bill&t=redeem',
14 +}
15 +
16 +/**
17 + * @description: 义工登录
18 + */
19 +export const volunteerLoginAPI = (params) => fn(fetch.post(Api.REDEEM_LOGIN, params));
20 +
21 +/**
22 + * @description: 检查核销权限
23 + * @returns {Object} { data.can_redeem: Boolean, msg: String}
24 + */
25 +export const checkRedeemPermissionAPI = (params) => fn(fetch.get(Api.REDEEM_CHECK_AUTH, params));
26 +
27 +/**
28 + * @description: 核销
29 + */
30 +export const verifyTicketAPI = (params) => fn(fetch.post(Api.REDEEM_REDEEM, params));
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
9 import { fn, fetch } from '@/api/fn'; 9 import { fn, fetch } from '@/api/fn';
10 10
11 const Api = { 11 const Api = {
12 - WX_PAY: 'c/bill_paymentForBill.do', 12 + WX_PAY: '/srv/?a=icbc_pay_wxamp',
13 } 13 }
14 14
15 /** 15 /**
16 - * @description 微信支付接口 16 + * @description: 微信支付接口
17 - * @param {*} 17 + * @param {*} pay_id 预约单支付凭证
18 - * @returns {*} 18 + * @returns {*} 微信支付参数
19 */ 19 */
20 -export const wxPayAPI = (params) => fn(fetch.get(Api.WX_PAY, params)); 20 +export const wxPayAPI = (params) => fn(fetch.post(Api.WX_PAY, params));
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
49 <script setup> 49 <script setup>
50 import { ref, computed } from 'vue' 50 import { ref, computed } from 'vue'
51 import { useRouter } from '@tarojs/taro' 51 import { useRouter } from '@tarojs/taro'
52 -import { verifyTicketAPI, checkRedeemPermissionAPI } from '@/api/index' 52 +import { verifyTicketAPI, checkRedeemPermissionAPI } from '@/api/redeem'
53 import Taro, { useDidShow } from '@tarojs/taro' 53 import Taro, { useDidShow } from '@tarojs/taro'
54 import { mainStore } from '@/stores/main' 54 import { mainStore } from '@/stores/main'
55 import { useReplace } from '@/hooks/useGo' 55 import { useReplace } from '@/hooks/useGo'
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
35 import { ref } from 'vue' 35 import { ref } from 'vue'
36 import Taro, { useDidShow } from '@tarojs/taro' 36 import Taro, { useDidShow } from '@tarojs/taro'
37 import { mainStore } from '@/stores/main' 37 import { mainStore } from '@/stores/main'
38 -import { volunteerLoginAPI, checkRedeemPermissionAPI } from '@/api/index' 38 +import { volunteerLoginAPI, checkRedeemPermissionAPI } from '@/api/redeem'
39 import { useReplace } from '@/hooks/useGo' 39 import { useReplace } from '@/hooks/useGo'
40 import logo from '@/assets/images/logo.png' 40 import logo from '@/assets/images/logo.png'
41 41
......
1 /* 1 /*
2 * @Date: 2026-01-16 19:41:09 2 * @Date: 2026-01-16 19:41:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2026-01-16 19:56:36 4 + * @LastEditTime: 2026-01-20 11:40:46
5 * @FilePath: /xyxBooking-weapp/src/utils/wechatPay.js 5 * @FilePath: /xyxBooking-weapp/src/utils/wechatPay.js
6 * @Description: 微信支付工具函数 6 * @Description: 微信支付工具函数
7 */ 7 */
8 import Taro from '@tarojs/taro' 8 import Taro from '@tarojs/taro'
9 -import { wxPayAPI } from '@/api/index' 9 +import { wxPayAPI } from '@/api/wx/pay'
10 10
11 /** 11 /**
12 * @description 微信支付 12 * @description 微信支付
......