This commit is contained in:
Gao Shan
2022-10-04 00:12:49 +08:00
committed by Gao Shan
parent cde3b77e4d
commit 6e95de664d
123 changed files with 7845 additions and 18 deletions
@@ -0,0 +1,46 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
export async function currentUser(options?: { [key: string]: any }) {
return request<API.OptionalResult<API.CurrentUser>>('/api-user/users/current', {
method: 'GET',
...(options || {}),
});
}
export async function currentUser2(options?: { [key: string]: any }) {
const result = await request<API.OptionalResult<API.CurrentUser>>('/api-user/users/current', {
method: 'GET',
...(options || {}),
});
return result.datas ?? {};
}
export async function fetchMenuData(options?: { [key: string]: any }) {
return request<API.Menu[]>('/api-user/menus/current', {
method: 'GET',
...(options || {}),
});
}
/** 退出登录接口 POST /api/login/outLogin */
export async function outLogin(options?: { [key: string]: any }) {
return request<Record<string, any>>('/api/login/outLogin', {
method: 'POST',
...(options || {}),
});
}
export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
return request<API.OptionalResult<API.LoginResult>>('/api-uaa/oauth/token', {
method: 'POST',
requestType: 'form',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: 'Basic d2ViQXBwOndlYkFwcA==',
},
data: { ...body, grant_type: 'password_code' },
...(options || {}),
});
}
@@ -0,0 +1,8 @@
// @ts-ignore
/* eslint-disable */
// API 更新时间:
// API 唯一标识:
import * as api from './api';
export default {
api,
};
+59
View File
@@ -0,0 +1,59 @@
// @ts-ignore
/* eslint-disable */
declare namespace API {
type Result<T> = {
resp_code?: number;
resp_msg?: number;
datas?: T[];
};
type OptionalResult<T> = {
resp_code?: number;
resp_msg?: number;
datas?: T;
};
type CurrentUser = {
userId?: string;
username?: string;
nickname?: string;
headImgUrl?: string;
sex?: number;
type?: string;
};
type Menu = {
id?: number;
name?: string;
path?: string;
url?: string;
css?: string;
subMenus?: Menu[];
};
type LoginResult = {
access_token?: string;
token_type?: string;
refresh_token?: string;
expires_in?: number;
scope?: string;
account_type?: string;
};
type LoginParams = {
username?: string;
password?: string;
validCode?: string;
deviceId?: string;
};
type ErrorResponse = {
/** 业务约定的错误码 */
errorCode: string;
/** 业务上的错误信息 */
errorMessage?: string;
/** 业务上的请求是否成功 */
success?: boolean;
};
}
+56
View File
@@ -0,0 +1,56 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
export async function indice(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SEARCH.Indice>>('/api-search/admin/indices', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data };
}
export async function index(indexName: string) {
const result = await request<API.OptionalResult<any>>('/api-search/admin/index', {
method: 'GET',
params: { indexName },
});
return result.datas;
}
export async function syslog(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SEARCH.SysLog>>('/api-log/sysLog', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
export async function tracelog(traceId: string) {
const params = { queryStr: `traceId:${traceId}`, sortCol: 'timestamp', sortOrder: 'ASC' };
const result = await request<SYSTEM.Page<SEARCH.TraceLog>>('/api-log/traceLog', {
method: 'GET',
params,
});
return result.data;
}
export async function auditlog(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SEARCH.TraceLog>>('/api-log/auditLog', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
export async function slowQueryLog(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SEARCH.TraceLog>>('/api-log/slowQueryLog', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
+8
View File
@@ -0,0 +1,8 @@
// @ts-ignore
/* eslint-disable */
// API 更新时间:
// API 唯一标识:
import * as api from './api';
export default {
api,
};
+50
View File
@@ -0,0 +1,50 @@
// @ts-ignore
/* eslint-disable */
declare namespace SEARCH {
type Indice = {
docsCount?: string;
docsDeleted?: string;
health?: string;
index?: string;
status?: string;
storeSize?: string;
};
type SysLog = {
id?: string;
'@timestamp'?: Date;
agent?: { name?: string; type?: string; id?: string; version?: string };
appName?: string;
classname?: string;
id?: string;
logLevel?: string;
serverIp?: string;
serverPort?: string;
timestamp?: string;
message?: string;
traceId?: string;
spanId?: string;
threadName?: string;
};
type TraceLog = {
appName?: string;
parentId?: string;
serverIp?: string;
serverPort?: string;
spanId?: string;
};
type AuditLog = {
id?: string;
appName?: string;
className?: string;
clientId?: string;
methodName?: string;
operation?: string;
timestamp?: string;
userId?: string;
userName?: string;
};
}
+12
View File
@@ -0,0 +1,12 @@
// @ts-ignore
/* eslint-disable */
// API 更新时间:
// API 唯一标识:
import * as pet from './pet';
import * as store from './store';
import * as user from './user';
export default {
pet,
store,
user,
};
+166
View File
@@ -0,0 +1,166 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
/** Update an existing pet PUT /pet */
export async function updatePet(body: API.Pet, options?: { [key: string]: any }) {
return request<any>('/pet', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Add a new pet to the store POST /pet */
export async function addPet(body: API.Pet, options?: { [key: string]: any }) {
return request<any>('/pet', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */
export async function findPetsByStatus(
params: {
// query
/** Status values that need to be considered for filter */
status: 'available' | 'pending' | 'sold'[];
},
options?: { [key: string]: any },
) {
return request<API.Pet[]>('/pet/findByStatus', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */
export async function findPetsByTags(
params: {
// query
/** Tags to filter by */
tags: string[];
},
options?: { [key: string]: any },
) {
return request<API.Pet[]>('/pet/findByTags', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** Find pet by ID Returns a single pet GET /pet/${param0} */
export async function getPetById(
params: {
// path
/** ID of pet to return */
petId: number;
},
options?: { [key: string]: any },
) {
const { petId: param0 } = params;
return request<API.Pet>(`/pet/${param0}`, {
method: 'GET',
params: { ...params },
...(options || {}),
});
}
/** Updates a pet in the store with form data POST /pet/${param0} */
export async function updatePetWithForm(
params: {
// path
/** ID of pet that needs to be updated */
petId: number;
},
body: { name?: string; status?: string },
options?: { [key: string]: any },
) {
const { petId: param0 } = params;
const formData = new FormData();
Object.keys(body).forEach((ele) => {
const item = (body as any)[ele];
if (item !== undefined && item !== null) {
formData.append(ele, typeof item === 'object' ? JSON.stringify(item) : item);
}
});
return request<any>(`/pet/${param0}`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
params: { ...params },
data: formData,
...(options || {}),
});
}
/** Deletes a pet DELETE /pet/${param0} */
export async function deletePet(
params: {
// header
api_key?: string;
// path
/** Pet id to delete */
petId: number;
},
options?: { [key: string]: any },
) {
const { petId: param0 } = params;
return request<any>(`/pet/${param0}`, {
method: 'DELETE',
params: { ...params },
...(options || {}),
});
}
/** uploads an image POST /pet/${param0}/uploadImage */
export async function uploadFile(
params: {
// path
/** ID of pet to update */
petId: number;
},
body: { additionalMetadata?: string; file?: string },
options?: { [key: string]: any },
) {
const { petId: param0 } = params;
const formData = new FormData();
Object.keys(body).forEach((ele) => {
const item = (body as any)[ele];
if (item !== undefined && item !== null) {
formData.append(ele, typeof item === 'object' ? JSON.stringify(item) : item);
}
});
return request<API.ApiResponse>(`/pet/${param0}/uploadImage`, {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
},
params: { ...params },
data: formData,
...(options || {}),
});
}
+54
View File
@@ -0,0 +1,54 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
/** Returns pet inventories by status Returns a map of status codes to quantities GET /store/inventory */
export async function getInventory(options?: { [key: string]: any }) {
return request<Record<string, any>>('/store/inventory', {
method: 'GET',
...(options || {}),
});
}
/** Place an order for a pet POST /store/order */
export async function placeOrder(body: API.Order, options?: { [key: string]: any }) {
return request<API.Order>('/store/order', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** Find purchase order by ID For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions GET /store/order/${param0} */
export async function getOrderById(
params: {
// path
/** ID of pet that needs to be fetched */
orderId: number;
},
options?: { [key: string]: any },
) {
const { orderId: param0 } = params;
return request<API.Order>(`/store/order/${param0}`, {
method: 'GET',
params: { ...params },
...(options || {}),
});
}
/** Delete purchase order by ID For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors DELETE /store/order/${param0} */
export async function deleteOrder(
params: {
// path
/** ID of the order that needs to be deleted */
orderId: number;
},
options?: { [key: string]: any },
) {
const { orderId: param0 } = params;
return request<any>(`/store/order/${param0}`, {
method: 'DELETE',
params: { ...params },
...(options || {}),
});
}
+52
View File
@@ -0,0 +1,52 @@
// @ts-ignore
/* eslint-disable */
declare namespace API {
type Order = {
id?: number;
petId?: number;
quantity?: number;
shipDate?: string;
/** Order Status */
status?: 'placed' | 'approved' | 'delivered';
complete?: boolean;
};
type Category = {
id?: number;
name?: string;
};
type User = {
id?: number;
username?: string;
firstName?: string;
lastName?: string;
email?: string;
password?: string;
phone?: string;
/** User Status */
userStatus?: number;
};
type Tag = {
id?: number;
name?: string;
};
type Pet = {
id?: number;
category?: Category;
name: string;
photoUrls: string[];
tags?: Tag[];
/** pet status in the store */
status?: 'available' | 'pending' | 'sold';
};
type ApiResponse = {
code?: number;
type?: string;
message?: string;
};
}
+114
View File
@@ -0,0 +1,114 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
/** Create user This can only be done by the logged in user. POST /user */
export async function createUser(body: API.User, options?: { [key: string]: any }) {
return request<any>('/user', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** Creates list of users with given input array POST /user/createWithArray */
export async function createUsersWithArrayInput(
body: API.User[],
options?: { [key: string]: any },
) {
return request<any>('/user/createWithArray', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** Creates list of users with given input array POST /user/createWithList */
export async function createUsersWithListInput(body: API.User[], options?: { [key: string]: any }) {
return request<any>('/user/createWithList', {
method: 'POST',
data: body,
...(options || {}),
});
}
/** Logs user into the system GET /user/login */
export async function loginUser(
params: {
// query
/** The user name for login */
username: string;
/** The password for login in clear text */
password: string;
},
options?: { [key: string]: any },
) {
return request<string>('/user/login', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** Logs out current logged in user session GET /user/logout */
export async function logoutUser(options?: { [key: string]: any }) {
return request<any>('/user/logout', {
method: 'GET',
...(options || {}),
});
}
/** Get user by user name GET /user/${param0} */
export async function getUserByName(
params: {
// path
/** The name that needs to be fetched. Use user1 for testing. */
username: string;
},
options?: { [key: string]: any },
) {
const { username: param0 } = params;
return request<API.User>(`/user/${param0}`, {
method: 'GET',
params: { ...params },
...(options || {}),
});
}
/** Updated user This can only be done by the logged in user. PUT /user/${param0} */
export async function updateUser(
params: {
// path
/** name that need to be updated */
username: string;
},
body: API.User,
options?: { [key: string]: any },
) {
const { username: param0 } = params;
return request<any>(`/user/${param0}`, {
method: 'PUT',
params: { ...params },
data: body,
...(options || {}),
});
}
/** Delete user This can only be done by the logged in user. DELETE /user/${param0} */
export async function deleteUser(
params: {
// path
/** The name that needs to be deleted */
username: string;
},
options?: { [key: string]: any },
) {
const { username: param0 } = params;
return request<any>(`/user/${param0}`, {
method: 'DELETE',
params: { ...params },
...(options || {}),
});
}
+100
View File
@@ -0,0 +1,100 @@
// @ts-ignore
/* eslint-disable */
import { download } from '@/util/download';
import { request } from 'umi';
export async function user(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SYSTEM.User>>('/api-user/users', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
export async function role() {
const result = await request<SYSTEM.Page<SYSTEM.Role>>('/api-user/roles', {
method: 'GET',
});
return result.data;
}
export async function pageRole(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SYSTEM.Role>>('/api-user/roles', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
export async function menuForAuth(roleId: number, tenantId: string) {
const url = `/api-user/menus/${roleId}/menus`;
const result = await request<SYSTEM.Menu[]>(url, {
method: 'GET',
params: { tenantId },
});
return result;
}
export function exportUser(params?: { [key: string]: string | number }) {
return request('/api-user/users/export', {
method: 'POST',
params,
responseType: 'blob',
}).then((res) => {
const blob = new Blob([res]);
const objectURL = URL.createObjectURL(blob);
let btn = document.createElement('a');
btn.download = 'user.xls';
btn.href = objectURL;
btn.click();
URL.revokeObjectURL(objectURL);
});
}
export async function token(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SYSTEM.Token>>('/api-uaa/tokens', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
export async function app(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SYSTEM.App>>('/api-uaa/clients/list', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
export async function generator(params?: { [key: string]: string | number }) {
const { current, pageSize, ...rest } = params ?? {};
const result = await request<SYSTEM.Page<SYSTEM.Generator>>('/api-generator/generator/list', {
method: 'GET',
params: { page: current, limit: pageSize, ...rest },
});
return { data: result.data, total: result.count };
}
export function exportGenerator(tables: string) {
return request('/api-generator/generator/code', {
method: 'GET',
params: { tables },
responseType: 'blob',
getResponse: true,
}).then((res) => {
download(res);
});
}
export async function menu(params: { [key: string]: string | number }) {
const result = await request<SYSTEM.Page<SYSTEM.Menu>>('/api-user/menus/findAlls', {
method: 'GET',
params,
});
return result.data;
}
+8
View File
@@ -0,0 +1,8 @@
// @ts-ignore
/* eslint-disable */
// API 更新时间:
// API 唯一标识:
import * as api from './api';
export default {
api,
};
+84
View File
@@ -0,0 +1,84 @@
// @ts-ignore
/* eslint-disable */
declare namespace SYSTEM {
type Page<T> = {
code?: number;
count?: number;
data?: T[];
};
type Role = {
id: number;
createTime?: Date;
updateTime?: Date;
code: string;
name: string;
userId?: string;
};
type User = {
id?: number;
username?: string;
nickname?: string;
headImgUrl?: string;
sex?: number;
type?: string;
mobile?: string;
createTime?: Date;
enabled?: boolean;
del?: boolean;
roles?: Role[];
};
type Menu = {
id: number;
name?: string;
pId?: number;
parentId?: number;
url?: string;
type?: number;
css?: string;
checked?: boolean;
open?: boolean;
sort?: number;
children?: Menu[];
};
type Token = {
accountType?: string;
clientId?: string;
expiration?: Date;
grantType?: string;
tokenValue?: string;
username?: string;
};
type App = {
id: number;
accessTokenValiditySeconds?: number;
additionalInformation?: string;
authorities?: string;
authorizedGrantTypes?: string;
autoapprove?: string;
clientId?: string;
clientName?: string;
clientSecret?: string;
clientSecretStr?: string;
createTime?: Date;
idTokenValiditySeconds?: number;
refreshTokenValiditySeconds?: number;
resourceIds?: string;
scope?: string;
supportIdToken?: boolean;
updateTime?: Date;
webServerRedirectUri?: string;
};
type Generator = {
createTime?: Date;
engine?: string;
tableComment?: string;
tableName?: string;
};
}
+9
View File
@@ -0,0 +1,9 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
export async function statistic() {
return request<WELCOME.Statistic>('/api-log/requestStat', {
method: 'GET',
});
}
+8
View File
@@ -0,0 +1,8 @@
// @ts-ignore
/* eslint-disable */
// API 更新时间:
// API 唯一标识:
import * as api from './api';
export default {
api,
};
+34
View File
@@ -0,0 +1,34 @@
// @ts-ignore
/* eslint-disable */
declare namespace WELCOME {
type Browser = {
name?: number;
value?: string;
};
type Statistic = {
browser_datas?: Browser[];
browser_legendData?: string[];
currDate_pv?: number;
currDate_uv?: number;
currHour_uv?: number;
currMonth_pv?: number;
currWeek_pv?: number;
operatingSystem_datas?: Browser[];
operatingSystem_legendData?: string[];
statDate_items?: Date[];
statDate_pv?: number[];
statDate_uv?: number[];
statWeek_items?: Date[];
statWeek_pv?: number[];
statWeek_uv?: number[];
};
type AreaData = {
type: string;
date: Date;
value: number;
};
}