You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.2 KiB
TypeScript
66 lines
2.2 KiB
TypeScript
/*
|
|
* @Author: donghao donghao@supervision.ltd
|
|
* @Date: 2024-04-19 17:10:21
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
* @LastEditTime: 2024-05-24 13:41:34
|
|
* @FilePath: \general-ai-platform-web\mock\businessProject.ts
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
import {
|
|
mockGetBusinessAlgorithmData,
|
|
mockGetBusinessBaseCountData,
|
|
mockGetBusinessProjectData,
|
|
} from './pools/businessProjectData';
|
|
import { successMockApiProps } from './typing';
|
|
import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock';
|
|
export default {
|
|
// 企业列表
|
|
'POST /api/v1/enterprise/entity/index': async (req: Request, res: Response) => {
|
|
// get 使用 query 读取参数
|
|
const { pageNo, pageSize } = req.body;
|
|
const resData: successMockApiProps = {
|
|
...fetchCurrPageByList({
|
|
...mockGetBusinessProjectData,
|
|
data: { ...mockGetBusinessProjectData.data, pageNo, pageSize: pageSize || 10 },
|
|
}),
|
|
};
|
|
res.send(resData);
|
|
},
|
|
//
|
|
'POST /api/v1/enterprise/entity/index/basecount': async (req: Request, res: Response) => {
|
|
const resData: successMockApiProps = {
|
|
...fetchMockSuccessFullByOther(mockGetBusinessBaseCountData),
|
|
};
|
|
res.send(resData);
|
|
},
|
|
|
|
// 企业详情
|
|
'GET /api/businessProject/detail': async (req: Request, res: Response) => {
|
|
// get 使用 query 读取参数
|
|
const { id } = req.query;
|
|
let finalData = {};
|
|
mockGetBusinessProjectData.data.data.forEach((item) => {
|
|
if (Number(item.id) === Number(id)) {
|
|
finalData = item;
|
|
// break;
|
|
}
|
|
});
|
|
const resData: successMockApiProps = fetchMockSuccessFullByOther({
|
|
data: finalData,
|
|
});
|
|
res.json(resData);
|
|
},
|
|
// 企业算法列表
|
|
'GET /api/businessProject/algorithm': async (req: Request, res: Response) => {
|
|
// get 使用 query 读取参数
|
|
const { pageNo, pageSize } = req.query;
|
|
const resData: successMockApiProps = {
|
|
...fetchCurrPageByList({
|
|
...mockGetBusinessAlgorithmData,
|
|
data: { ...mockGetBusinessAlgorithmData.data, pageNo, pageSize: pageSize || 10 },
|
|
}),
|
|
};
|
|
res.json(resData);
|
|
},
|
|
};
|