mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
@@ -8,7 +8,6 @@ import {
|
||||
UpdateTeamMemberProps,
|
||||
UpdateTeamProps
|
||||
} from '@fastgpt/global/support/user/team/controller.d';
|
||||
import type { TeamTagsSchema } from '@fastgpt/global/support/user/team/type';
|
||||
import {
|
||||
TeamItemType,
|
||||
TeamMemberItemType,
|
||||
@@ -24,14 +23,6 @@ export const putUpdateTeam = (data: UpdateTeamProps) =>
|
||||
PUT(`/proApi/support/user/team/update`, data);
|
||||
export const putSwitchTeam = (teamId: string) =>
|
||||
PUT<string>(`/proApi/support/user/team/switch`, { teamId });
|
||||
export const updateTags = (teamId: string, tagsUrl: string) =>
|
||||
POST<TeamTagsSchema[]>(`/proApi/support/user/team/tags/asyncTags`, { teamId, tagsUrl });
|
||||
export const getTeamsTags = (teamId: string) =>
|
||||
GET(`/proApi/support/user/team/tags/list`, { teamId });
|
||||
export const putUpdateTeamTags = (data: any) =>
|
||||
PUT(`/proApi/support/user/team/tags/updateUrl`, data);
|
||||
export const insertTeamsTags = (tags: Array<any>) =>
|
||||
POST(`/proApi/support/user/team/tags/create`, tags);
|
||||
|
||||
/* --------------- team member ---------------- */
|
||||
export const getTeamMembers = (teamId: string) =>
|
||||
|
@@ -3,17 +3,14 @@ import { devtools, persist } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
import type { UserUpdateParams } from '@/types/user';
|
||||
import type { UserType } from '@fastgpt/global/support/user/type.d';
|
||||
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
import { getTokenLogin, putUserInfo } from '@/web/support/user/api';
|
||||
import { FeTeamPlanStatusType } from '@fastgpt/global/support/wallet/sub/type';
|
||||
import { getTeamPlanStatus } from '@/web/support/wallet/sub/api';
|
||||
|
||||
type State = {
|
||||
userInfo: UserType | null;
|
||||
initUserInfo: () => Promise<UserType>;
|
||||
setUserInfo: (user: UserType | null) => void;
|
||||
updateUserInfo: (user: UserUpdateParams) => Promise<void>;
|
||||
teamPlanStatus: FeTeamPlanStatusType | null;
|
||||
initTeamPlanStatus: () => Promise<any>;
|
||||
};
|
||||
|
||||
export const useUserStore = create<State>()(
|
||||
@@ -22,22 +19,19 @@ export const useUserStore = create<State>()(
|
||||
immer((set, get) => ({
|
||||
userInfo: null,
|
||||
async initUserInfo() {
|
||||
get().initTeamPlanStatus();
|
||||
|
||||
const res = await getTokenLogin();
|
||||
get().setUserInfo(res);
|
||||
|
||||
//设置html的fontsize
|
||||
const html = document?.querySelector('html');
|
||||
if (html) {
|
||||
// html.style.fontSize = '16px';
|
||||
}
|
||||
|
||||
return res;
|
||||
},
|
||||
setUserInfo(user: UserType | null) {
|
||||
set((state) => {
|
||||
state.userInfo = user ? user : null;
|
||||
state.userInfo = user
|
||||
? {
|
||||
...user,
|
||||
balance: formatStorePrice2Read(user.balance)
|
||||
}
|
||||
: null;
|
||||
});
|
||||
},
|
||||
async updateUserInfo(user: UserUpdateParams) {
|
||||
@@ -57,15 +51,6 @@ export const useUserStore = create<State>()(
|
||||
});
|
||||
return Promise.reject(error);
|
||||
}
|
||||
},
|
||||
teamPlanStatus: null,
|
||||
initTeamPlanStatus() {
|
||||
return getTeamPlanStatus().then((res) => {
|
||||
set((state) => {
|
||||
state.teamPlanStatus = res;
|
||||
});
|
||||
return res;
|
||||
});
|
||||
}
|
||||
})),
|
||||
{
|
||||
|
@@ -1,22 +1,10 @@
|
||||
import { RequestPaging } from '@/types';
|
||||
import { GET, POST } from '@/web/common/api/request';
|
||||
import { CreateBillProps, CreateBillResponse } from '@fastgpt/global/support/wallet/bill/api';
|
||||
import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import type { BillSchemaType } from '@fastgpt/global/support/wallet/bill/type.d';
|
||||
import { CreateTrainingBillProps } from '@fastgpt/global/support/wallet/bill/api.d';
|
||||
import type { PagingData, RequestPaging } from '@/types';
|
||||
import type { BillItemType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
|
||||
export const getBills = (
|
||||
data: RequestPaging & {
|
||||
type?: `${BillTypeEnum}`;
|
||||
}
|
||||
) => POST<BillSchemaType[]>(`/proApi/support/wallet/bill/list`, data);
|
||||
export const getUserBills = (data: RequestPaging) =>
|
||||
POST<PagingData<BillItemType>>(`/proApi/support/wallet/bill/getBill`, data);
|
||||
|
||||
export const getWxPayQRCode = (data: CreateBillProps) =>
|
||||
POST<CreateBillResponse>(`/proApi/support/wallet/bill/create`, data);
|
||||
|
||||
export const checkBalancePayResult = (payId: string) =>
|
||||
GET<string>(`/proApi/support/wallet/bill/checkPayResult`, { payId }).then((data) => {
|
||||
try {
|
||||
GET('/common/system/unlockTask');
|
||||
} catch (error) {}
|
||||
return data;
|
||||
});
|
||||
export const postCreateTrainingBill = (data: CreateTrainingBillProps) =>
|
||||
POST<string>(`/support/wallet/bill/createTrainingBill`, data);
|
||||
|
17
projects/app/src/web/support/wallet/pay/api.ts
Normal file
17
projects/app/src/web/support/wallet/pay/api.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { GET } from '@/web/common/api/request';
|
||||
import type { PaySchema } from '@fastgpt/global/support/wallet/pay/type.d';
|
||||
export const getPayOrders = () => GET<PaySchema[]>(`/proApi/support/wallet/pay/getPayOrders`);
|
||||
|
||||
export const getPayCode = (amount: number) =>
|
||||
GET<{
|
||||
codeUrl: string;
|
||||
payId: string;
|
||||
}>(`/proApi/support/wallet/pay/getPayCode`, { amount });
|
||||
|
||||
export const checkPayResult = (payId: string) =>
|
||||
GET<string>(`/proApi/support/wallet/pay/checkPayResult`, { payId }).then((data) => {
|
||||
try {
|
||||
GET('/common/system/unlockTask');
|
||||
} catch (error) {}
|
||||
return data;
|
||||
});
|
@@ -1,20 +1,30 @@
|
||||
import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
|
||||
import {
|
||||
StandardSubPlanParams,
|
||||
StandardSubPlanUpdateResponse
|
||||
StandardSubPlanUpdateResponse,
|
||||
SubDatasetSizeParams,
|
||||
SubDatasetSizePreviewCheckResponse
|
||||
} from '@fastgpt/global/support/wallet/sub/api';
|
||||
import { SubStatusEnum, SubTypeEnum } from '@fastgpt/global/support/wallet/sub/constants';
|
||||
import { FeTeamPlanStatusType } from '@fastgpt/global/support/wallet/sub/type';
|
||||
import { FeTeamSubType } from '@fastgpt/global/support/wallet/sub/type';
|
||||
|
||||
export const putTeamDatasetSubStatus = (data: {
|
||||
status: `${SubStatusEnum}`;
|
||||
type: `${SubTypeEnum}`;
|
||||
}) => POST('/proApi/support/wallet/sub/updateStatus', data);
|
||||
|
||||
export const getTeamPlanStatus = () =>
|
||||
GET<FeTeamPlanStatusType>(`/support/wallet/sub/getTeamSubStatus`);
|
||||
export const getTeamDatasetValidSub = () =>
|
||||
GET<FeTeamSubType>(`/support/wallet/sub/getTeamSubStatus`);
|
||||
|
||||
export const postCheckStandardSub = (data: StandardSubPlanParams) =>
|
||||
POST<StandardSubPlanUpdateResponse>('/proApi/support/wallet/sub/standard/preCheck', data);
|
||||
export const postUpdateStandardSub = (data: StandardSubPlanParams) =>
|
||||
POST<StandardSubPlanUpdateResponse>('/proApi/support/wallet/sub/standard/update', data);
|
||||
|
||||
export const posCheckTeamDatasetSizeSub = (data: SubDatasetSizeParams) =>
|
||||
POST<SubDatasetSizePreviewCheckResponse>(
|
||||
'/proApi/support/wallet/sub/extraDatasetSize/preCheck',
|
||||
data
|
||||
);
|
||||
export const postUpdateTeamDatasetSizeSub = (data: SubDatasetSizeParams) =>
|
||||
POST('/proApi/support/wallet/sub/extraDatasetSize/update', data);
|
||||
|
@@ -1,2 +0,0 @@
|
||||
export const AI_POINT_USAGE_CARD_ROUTE = '/price#point-card';
|
||||
export const EXTRA_PLAN_CARD_ROUTE = '/price#extra-plan';
|
@@ -1,10 +0,0 @@
|
||||
import { GET, POST } from '@/web/common/api/request';
|
||||
import { CreateTrainingUsageProps } from '@fastgpt/global/support/wallet/usage/api.d';
|
||||
import type { PagingData, RequestPaging } from '@/types';
|
||||
import type { UsageItemType } from '@fastgpt/global/support/wallet/usage/type';
|
||||
|
||||
export const getUserUsages = (data: RequestPaging) =>
|
||||
POST<PagingData<UsageItemType>>(`/proApi/support/wallet/usage/getUsage`, data);
|
||||
|
||||
export const postCreateTrainingUsage = (data: CreateTrainingUsageProps) =>
|
||||
POST<string>(`/support/wallet/usage/createTrainingUsage`, data);
|
Reference in New Issue
Block a user