feat(weibo): 增加微博微豆基础自动化
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import api from './client';
|
||||
import type {
|
||||
MessageResponse,
|
||||
PaginatedResponse,
|
||||
WeiboAccountItem,
|
||||
WeiboBindQrResult,
|
||||
WeiboExchangeRecordsResult,
|
||||
WeiboExchangeResult,
|
||||
WeiboMallListResult,
|
||||
WeiboPaymentStatusResult,
|
||||
WeiboPointHistoryResult,
|
||||
WeiboRechargeOrderResult,
|
||||
WeiboImportResult,
|
||||
} from './types';
|
||||
|
||||
export const weiboApi = {
|
||||
listAccounts: (params: {
|
||||
search?: string;
|
||||
bind_status?: string;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}) =>
|
||||
api.get<PaginatedResponse<WeiboAccountItem>, PaginatedResponse<WeiboAccountItem>>(
|
||||
'/weibo/accounts',
|
||||
{ params },
|
||||
),
|
||||
importCookies: (text: string, tag = '') =>
|
||||
api.post<WeiboImportResult, WeiboImportResult>('/weibo/accounts/import-cookies', {
|
||||
text,
|
||||
tag,
|
||||
}),
|
||||
refreshAccount: (accountId: number) =>
|
||||
api.post<WeiboAccountItem, WeiboAccountItem>(
|
||||
`/weibo/accounts/${accountId}/refresh`,
|
||||
),
|
||||
bindQrcodes: (accountId: number) =>
|
||||
api.post<WeiboBindQrResult, WeiboBindQrResult>(
|
||||
`/weibo/accounts/${accountId}/bind-qrcodes`,
|
||||
undefined,
|
||||
{ timeout: 60000 },
|
||||
),
|
||||
mallList: (accountId: number) =>
|
||||
api.post<WeiboMallListResult, WeiboMallListResult>(
|
||||
`/weibo/accounts/${accountId}/mall-list`,
|
||||
undefined,
|
||||
{ timeout: 60000 },
|
||||
),
|
||||
exchangeGoods: (accountId: number, goodsId: number, expectedPrice: number) =>
|
||||
api.post<WeiboExchangeResult, WeiboExchangeResult>(
|
||||
`/weibo/accounts/${accountId}/exchange`,
|
||||
{
|
||||
goods_id: goodsId,
|
||||
expected_price: expectedPrice,
|
||||
confirm: true,
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
),
|
||||
exchangeRecords: (accountId: number, page = 1, pageSize = 20) =>
|
||||
api.post<WeiboExchangeRecordsResult, WeiboExchangeRecordsResult>(
|
||||
`/weibo/accounts/${accountId}/exchange-records`,
|
||||
undefined,
|
||||
{ params: { page, page_size: pageSize }, timeout: 60000 },
|
||||
),
|
||||
pointHistory: (accountId: number, page = 1, pageSize = 20) =>
|
||||
api.post<WeiboPointHistoryResult, WeiboPointHistoryResult>(
|
||||
`/weibo/accounts/${accountId}/point-history`,
|
||||
undefined,
|
||||
{ params: { page, page_size: pageSize }, timeout: 60000 },
|
||||
),
|
||||
createRechargeOrder: (accountId: number, amountYuan: number) =>
|
||||
api.post<WeiboRechargeOrderResult, WeiboRechargeOrderResult>(
|
||||
`/weibo/accounts/${accountId}/recharge/orders`,
|
||||
{ amount_yuan: amountYuan },
|
||||
{ timeout: 120000 },
|
||||
),
|
||||
rechargeStatus: (accountId: number, payId: string) =>
|
||||
api.post<WeiboPaymentStatusResult, WeiboPaymentStatusResult>(
|
||||
`/weibo/accounts/${accountId}/recharge/status`,
|
||||
{ pay_id: payId },
|
||||
{ timeout: 30000 },
|
||||
),
|
||||
deleteAccount: (accountId: number) =>
|
||||
api.delete<MessageResponse, MessageResponse>(`/weibo/accounts/${accountId}`),
|
||||
};
|
||||
Reference in New Issue
Block a user