feat:对接了strapi 接口
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import _ from "lodash";
|
||||
import { ConfigHelper } from "funjia-server";
|
||||
const getEmployee = (router) => {
|
||||
router.post('/api/employee/login', async (ctx) => {
|
||||
const url = ConfigHelper.config.server.url + "/api";
|
||||
|
||||
// 设置头类型, 如果不设置,会直接下载该页面
|
||||
ctx.type = 'application/json';
|
||||
const params = ctx.request.body;
|
||||
|
||||
const res = await fetch(`${url}/employees?filters[userName][$eq]=${params.userName}&filters[pwd][$eq]=${params.pwd}`, {
|
||||
method: 'GET'
|
||||
})
|
||||
|
||||
const data = await res.json();
|
||||
ctx.body = { code: data.data.length > 0 ? 0 : 1, data: data.data?.[0] }
|
||||
});
|
||||
}
|
||||
export default getEmployee;
|
||||
Reference in New Issue
Block a user