Initial commit: Monisuo - 虚拟货币模拟交易平台
功能模块: - 用户注册/登录/KYC - 资金账户/交易账户 - 实时行情/币种管理 - 即时交易/充提审核 - 管理后台 技术栈: - 后端: SpringBoot 2.2.4 + MyBatis Plus - 前端: uni-app x (Vue3 + UTS) - 数据库: MySQL Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
39
app/api/trade.uts
Normal file
39
app/api/trade.uts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 交易API
|
||||
*/
|
||||
import { get, post } from './request.uts'
|
||||
|
||||
/**
|
||||
* 买入
|
||||
*/
|
||||
export func buy (coinCode: string, price: string, quantity: string): Promise<any> {
|
||||
return post('/api/trade/buy', { coinCode, price, quantity } as UTSJSONObject)
|
||||
}
|
||||
|
||||
/**
|
||||
* 卖出
|
||||
*/
|
||||
export func sell (coinCode: string, price: string, quantity: string): Promise<any> {
|
||||
return post('/api/trade/sell', { coinCode, price, quantity } as UTSJSONObject)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交易记录
|
||||
*/
|
||||
export func getOrders (coinCode: string | null, direction: number | null, pageNum: number, pageSize: number): Promise<any> {
|
||||
const params: UTSJSONObject = { pageNum: pageNum, pageSize: pageSize }
|
||||
if (coinCode !== null) {
|
||||
params['coinCode'] = coinCode
|
||||
}
|
||||
if (direction !== null) {
|
||||
params['direction'] = direction
|
||||
}
|
||||
return get('/api/trade/orders', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
export func getOrderDetail (orderNo: string): Promise<any> {
|
||||
return get('/api/trade/order/detail', { orderNo } as UTSJSONObject)
|
||||
}
|
||||
Reference in New Issue
Block a user