feat:对接了strapi 接口

This commit is contained in:
2025-05-03 19:51:37 +08:00
parent 3e2aa46ea1
commit f31c30116a
17 changed files with 562 additions and 369 deletions
+19
View File
@@ -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;