|
@@ -10,8 +10,10 @@ import { wareList } from './mock/ware';
|
|
import { lessonList } from './mock/lesson';
|
|
import { lessonList } from './mock/lesson';
|
|
import { courseList } from './mock/course';
|
|
import { courseList } from './mock/course';
|
|
import { supportList } from './mock/support';
|
|
import { supportList } from './mock/support';
|
|
|
|
+import { comboList } from './mock/combo';
|
|
import { orderList } from './mock/order';
|
|
import { orderList } from './mock/order';
|
|
import { signature } from './mock/signature';
|
|
import { signature } from './mock/signature';
|
|
|
|
+import { cmsUserList } from './mock/cmsUser';
|
|
import * as api from './src/utils/api';
|
|
import * as api from './src/utils/api';
|
|
|
|
|
|
// mock数据持久化
|
|
// mock数据持久化
|
|
@@ -25,8 +27,10 @@ global.wareList = wareList;
|
|
global.lessonList = lessonList;
|
|
global.lessonList = lessonList;
|
|
global.courseList = courseList;
|
|
global.courseList = courseList;
|
|
global.supportList = supportList;
|
|
global.supportList = supportList;
|
|
|
|
+global.comboList = comboList;
|
|
global.orderList = orderList;
|
|
global.orderList = orderList;
|
|
global.signature = signature;
|
|
global.signature = signature;
|
|
|
|
+global.cmsUserList = cmsUserList;
|
|
|
|
|
|
// 操作成功响应内容
|
|
// 操作成功响应内容
|
|
const SUCCESS = { code: 200, success: true, message: null };
|
|
const SUCCESS = { code: 200, success: true, message: null };
|
|
@@ -318,6 +322,29 @@ const proxy = {
|
|
const { id } = req.params;
|
|
const { id } = req.params;
|
|
queryOne(global.supportList, id, res);
|
|
queryOne(global.supportList, id, res);
|
|
},
|
|
},
|
|
|
|
+ // 课程包
|
|
|
|
+ [`POST ${api.combo.replace('/:id', '')}`]: (req, res) => {
|
|
|
|
+ console.log(`[POST][${api.combo}]`, req.body);
|
|
|
|
+ res.send(create(global.comboList, req.body));
|
|
|
|
+ },
|
|
|
|
+ [`DELETE ${api.combo}`]: (req, res) => {
|
|
|
|
+ console.log(`[DELETE][${api.combo}]`, req.params);
|
|
|
|
+ const { id } = req.params;
|
|
|
|
+ remove(global.comboList, id, res);
|
|
|
|
+ },
|
|
|
|
+ [`PUT ${api.combo.replace('/:id', '')}`]: (req, res) => {
|
|
|
|
+ console.log(`[PUT][${api.combo}]`, req.body);
|
|
|
|
+ res.send(update(global.comboList, req.body));
|
|
|
|
+ },
|
|
|
|
+ [`GET ${api.combos}`]: (req, res) => {
|
|
|
|
+ console.log(`[GET][${api.combos}]`, req.query);
|
|
|
|
+ res.send(query(global.comboList, req.query));
|
|
|
|
+ },
|
|
|
|
+ [`GET ${api.combo}`]: (req, res) => {
|
|
|
|
+ console.log(`[GET][${api.combo}]`, req.params);
|
|
|
|
+ const { id } = req.params;
|
|
|
|
+ queryOne(global.comboList, id, res);
|
|
|
|
+ },
|
|
// 订单
|
|
// 订单
|
|
[`POST ${api.order.replace('/:id', '')}`]: (req, res) => {
|
|
[`POST ${api.order.replace('/:id', '')}`]: (req, res) => {
|
|
console.log(`[POST][${api.order}]`, req.body);
|
|
console.log(`[POST][${api.order}]`, req.body);
|
|
@@ -341,6 +368,24 @@ const proxy = {
|
|
const { id } = req.params;
|
|
const { id } = req.params;
|
|
queryOne(global.orderList, id, res);
|
|
queryOne(global.orderList, id, res);
|
|
},
|
|
},
|
|
|
|
+ // cms用户
|
|
|
|
+ [`POST ${api.cmsUser.replace('/:id', '')}`]: (req, res) => {
|
|
|
|
+ console.log(`[POST][${api.cmsUser}]`, req.body);
|
|
|
|
+ res.send(create(global.cmsUserList, req.body));
|
|
|
|
+ },
|
|
|
|
+ [`DELETE ${api.cmsUser}`]: (req, res) => {
|
|
|
|
+ console.log(`[DELETE][${api.cmsUser}]`, req.params);
|
|
|
|
+ const { id } = req.params;
|
|
|
|
+ remove(global.cmsUserList, id, res);
|
|
|
|
+ },
|
|
|
|
+ [`PUT ${api.cmsUser.replace('/:id', '')}`]: (req, res) => {
|
|
|
|
+ console.log(`[PUT][${api.cmsUser}]`, req.body);
|
|
|
|
+ res.send(update(global.cmsUserList, req.body));
|
|
|
|
+ },
|
|
|
|
+ [`GET ${api.cmsUsers}`]: (req, res) => {
|
|
|
|
+ console.log(`[GET][${api.cmsUsers}]`, req.query);
|
|
|
|
+ res.send(query(global.cmsUserList, req.query));
|
|
|
|
+ },
|
|
};
|
|
};
|
|
|
|
|
|
// 是否禁用代理
|
|
// 是否禁用代理
|