38 lines
956 B
JavaScript
38 lines
956 B
JavaScript
import { get, post } from './request.js'
|
|
|
|
/**
|
|
* 获取积分余额
|
|
* @returns {Promise<{success: boolean, data: any}>}
|
|
*/
|
|
export function getBalance() {
|
|
return get('/api/points/balance')
|
|
}
|
|
|
|
/**
|
|
* 获取积分获取记录
|
|
* @param {object} params - 分页参数 { page, pageSize }
|
|
* @returns {Promise<{success: boolean, data: Array}>}
|
|
*/
|
|
export function getEarnRecords(params) {
|
|
return get('/api/points/earn-records', params)
|
|
}
|
|
|
|
/**
|
|
* 获取积分使用记录
|
|
* @param {object} params - 分页参数 { page, pageSize }
|
|
* @returns {Promise<{success: boolean, data: Array}>}
|
|
*/
|
|
export function getSpendRecords(params) {
|
|
return get('/api/points/spend-records', params)
|
|
}
|
|
|
|
/**
|
|
* 赠送积分
|
|
* @param {string} uid - 对方UID
|
|
* @param {number} amount - 赠送积分数量
|
|
* @returns {Promise<{success: boolean, data: any, message: string}>}
|
|
*/
|
|
export function giftPoints(uid, amount) {
|
|
return post('/api/points/gift', { uid, amount })
|
|
}
|