Files
xinlong-shop-taro/src/api/system/user/balance.ts
赵忠林 b285210182 chore(project): 更新项目名称及相关接口调用
- 将项目名称由 "Paopao Taro" 修改为 "Websopy Inc."
- 修改首页标题为 "Websopy Inc."
- 更新余额接口调用由 paopao-api 变更为 shop-api
- 调整订单页面项目名称显示为 "WebSopy Inc."
- 变更README文件项目名称为 Shop-Taro - 项目框架
2026-07-16 21:41:14 +08:00

24 lines
731 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import request from '@/utils/request'
import type { ApiResult } from '@/api'
import type { UserBalance } from './model'
/**
* 获取当前用户余额信息(跨库读取 gxwebsoft_core.sys_user
* 通过 shop-api 本地 /auth/user-balance 接口,无需跨域请求 core 系统
*/
export async function getUserBalance(): Promise<UserBalance> {
const res = await request.get<ApiResult<any>>(
'/auth/user-balance'
)
if (res.code === 0 && res.data) {
const data = res.data
return {
balance: data.balance != null ? String(data.balance) : '0',
frozenBalance: '0',
totalIncome: '0',
totalExpense: '0',
}
}
return Promise.reject(new Error(res.message || '获取余额失败'))
}