Skip to content

Let's use AI to Earn!

feat: 用户钱包相关

牛文政7f59f555c595
diff --git a/src/api/finance.ts b/src/api/finance.ts
new file mode 100644
index 00000000..1d0512f5
--- /dev/null
+++ b/src/api/finance.ts
@@ -0,0 +1,56 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-22 12:02:55
+ * @LastEditTime: 2025-02-28 13:30:09
+ * @LastEditors: nevin
+ * @Description: 财务
+ */
+import http from './request';
+import {
+ CreateUserWalletAccountParams,
+ UserWalletAccount,
+} from './types/userWalletAccount';
+
+export const financeApi = {
+ // --------- userWalletAccount STR ---------
+
+ /**
+ * 获取验证码
+ */
+ getWalletAccountCode(phone: string) {
+ return http.post<string>(
+ `userWalletAccount/phoneCode/${phone}`,
+ {},
+ {
+ isToken: true,
+ },
+ );
+ },
+
+ /**
+ * 创建用户钱包账户
+ */
+ createUserWalletAccount(data: CreateUserWalletAccountParams) {
+ return http.post<UserWalletAccount>('/userWalletAccount', data, {
+ isToken: true,
+ });
+ },
+
+ /**
+ * 获取用户钱包账户列表
+ * @returns
+ */
+ getUserWalletAccountList() {
+ return http.get<UserWalletAccount>(`/userWalletAccount/list`, {
+ isToken: true,
+ });
+ },
+
+ /**
+ * 删除用户钱包账户
+ */
+ deleteUserWalletAccount(id: string) {
+ return http.delete<boolean>(`/userWalletAccount/delete/${id}`);
+ },
+ // --------- userWalletAccount END ---------
+};
diff --git a/src/api/types/userWalletAccount.ts b/src/api/types/userWalletAccount.ts
new file mode 100644
index 00000000..110a163a
--- /dev/null
+++ b/src/api/types/userWalletAccount.ts
@@ -0,0 +1,20 @@
+export enum WalletAccountType {
+ ZFB = 'ZFB',
+ WX_PAY = 'WX_PAY',
+}
+
+export interface UserWalletAccount {
+ id: string;
+ userId: string;
+ userName: string; // 真实姓名
+ cardNum: string; // 身份证号
+ phone: string; // 绑定的手机号
+ type: WalletAccountType;
+}
+
+export interface CreateUserWalletAccountParams {
+ userName: string; // 真实姓名
+ cardNum: string; // 身份证号
+ phone: string; // 绑定的手机号
+ type: WalletAccountType;
+}