Skip to content

Commit

Permalink
🐛 fix(api): Purge
Browse files Browse the repository at this point in the history
  • Loading branch information
web-ppanel committed Nov 17, 2024
1 parent 6f0fa20 commit 98c1c30
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/user/openapi2ts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const config = [
requestLibPath: "import request from '@/utils/request';",
schemaPath: 'https://swagger.ppanel.dev/user.json',
serversPath: './services',
projectName: 'admin',
projectName: 'user',
},
];

Expand Down
1 change: 0 additions & 1 deletion apps/user/services/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// API 唯一标识:
import * as auth from './auth';
import * as common from './common';

export default {
auth,
common,
Expand Down
1 change: 0 additions & 1 deletion apps/user/services/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as payment from './payment';
import * as subscribe from './subscribe';
import * as ticket from './ticket';
import * as user from './user';

export default {
announcement,
document,
Expand Down
13 changes: 13 additions & 0 deletions apps/user/services/user/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ declare namespace API {
total: number;
};

type QueryUserAffiliateResponse = {
list: UserAffiliate[];
total: number;
};

type QueryUserBalanceLogListResponse = {
list: UserBalanceLog[];
total: number;
Expand Down Expand Up @@ -345,6 +350,14 @@ declare namespace API {
status: number;
};

type UserAffiliate = {
email: string;
avatar: string;
telegram: number;
registered_at: number;
enable: boolean;
};

type UserBalanceLog = {
id: number;
user_id: number;
Expand Down
11 changes: 11 additions & 0 deletions apps/user/services/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
/* eslint-disable */
import request from '@/utils/request';

/** Query User Affiliate GET /v1/public/user/affiliate */
export async function queryUserAffiliate(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.QueryUserAffiliateResponse }>(
'/v1/public/user/affiliate',
{
method: 'GET',
...(options || {}),
},
);
}

/** Query User Balance Log GET /v1/public/user/balance_log */
export async function queryUserBalanceLog(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.QueryUserBalanceLogListResponse }>(
Expand Down
7 changes: 3 additions & 4 deletions apps/user/utils/tutorial.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const BASE_URL = 'https://cdn.jsdelivr.net/gh/perfect-panel/ppanel-tutorial@main';
const BASE_URL = 'https://cdn.jsdelivr.net/gh/perfect-panel/ppanel-tutorial';

export async function getTutorial(path: string): Promise<string> {
try {
const url = `${BASE_URL}/${path}`;
await fetch(url.replace('cdn', 'purge'));
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
Expand All @@ -24,9 +25,7 @@ type TutorialItem = {

export async function getTutorialList() {
return await getTutorial('SUMMARY.md').then((markdown) => {
const map = parseTutorialToMap(
markdown.replace(/en-us/gi, 'en-US').replace(/zh-cn/gi, 'zh-CN'),
);
const map = parseTutorialToMap(markdown);
map.forEach((value, key) => {
map.set(
key,
Expand Down

0 comments on commit 98c1c30

Please sign in to comment.