feat:
This commit is contained in:
@ -7,16 +7,22 @@ import store from '@/store';
|
||||
import { setInviteCode } from '@/store/actions/partner';
|
||||
import { IPaginationRequest } from '@/types/common';
|
||||
import {
|
||||
AuthedGroupInfo,
|
||||
DecryptOpenGidBody,
|
||||
GetProfitRequest,
|
||||
GroupAuthCode,
|
||||
InviteUserInfo,
|
||||
PartnerInviteCode,
|
||||
PartnerPagination,
|
||||
PartnerProfitItem,
|
||||
PartnerProfitsState,
|
||||
StaffInfo,
|
||||
UserProfitListItem,
|
||||
WithdrawRecord,
|
||||
WithdrawResponse,
|
||||
} from '@/types/partner';
|
||||
import { requestUserInfo } from '@/utils/user';
|
||||
import { buildUrl } from '@/utils/common';
|
||||
|
||||
export const getInviteCodeFromQuery = (query: Record<string, string>): string | undefined => {
|
||||
if (query) {
|
||||
@ -82,7 +88,7 @@ export const formatMoney = (cents: number) => {
|
||||
const yuan = cents / 100;
|
||||
return yuan.toFixed(2);
|
||||
};
|
||||
export function formatTimestamp(timestamp: string): string {
|
||||
export function formatTimestamp(timestamp: string, dateOnly?: boolean): string {
|
||||
// 创建 Date 对象
|
||||
const date = new Date(/^\d+$/.test(timestamp) ? Number(timestamp) : timestamp);
|
||||
|
||||
@ -94,7 +100,7 @@ export function formatTimestamp(timestamp: string): string {
|
||||
const mm = String(date.getMinutes()).padStart(2, '0');
|
||||
|
||||
// 拼接成所需的格式
|
||||
return `${YYYY}.${MM}.${DD} ${HH}:${mm}`;
|
||||
return dateOnly ? `${YYYY}.${MM}.${DD}` : `${YYYY}.${MM}.${DD} ${HH}:${mm}`;
|
||||
}
|
||||
|
||||
export function formatUserId(input: string): string {
|
||||
@ -127,3 +133,24 @@ export async function getWithdrawList(data: IPaginationRequest) {
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
}
|
||||
export async function getLastProfitList() {
|
||||
const result = await http.get<UserProfitListItem[]>(API.GET_PROFIT_LIST);
|
||||
return Array.isArray(result) ? result : [];
|
||||
}
|
||||
|
||||
export async function generateGroupAuthCode() {
|
||||
return await http.get<GroupAuthCode>(API.GENERATE_GROUP_AUTH_CODE);
|
||||
}
|
||||
|
||||
export async function getAuthedGroupList() {
|
||||
return await http.get<AuthedGroupInfo[]>(API.GET_AUTHED_GROUP_LIST);
|
||||
}
|
||||
export async function decryptOpenGid(data: DecryptOpenGidBody) {
|
||||
return await http.post(API.DECRYPT_OPEN_GID, {
|
||||
data,
|
||||
});
|
||||
}
|
||||
export async function getStaffInfo(cityCode: string) {
|
||||
const result = await http.post<StaffInfo[]>(buildUrl(API.GET_STAFF_CODE, { cityCode }));
|
||||
return Array.isArray(result) && result.length ? result[0] : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user