更新服务器部分文件
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 158 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 144 KiB |
@ -13,6 +13,7 @@ const {
|
||||
updateAdminService,
|
||||
findAllAdminService,
|
||||
findAdminByIdService,
|
||||
adminIsExistService
|
||||
} = require("../services/adminService");
|
||||
|
||||
const { formatResponse, analysisToken } = require("../utils/tools");
|
||||
@ -108,4 +109,12 @@ router.patch("/:id", async function (req, res) {
|
||||
res.send(formatResponse(0, "", result));
|
||||
});
|
||||
|
||||
/**
|
||||
* 根据 loginId 来查找该管理员是否存在
|
||||
*/
|
||||
router.get("/adminIsExist/:loginId", async function (req, res) {
|
||||
const result = await adminIsExistService(req.params.loginId);
|
||||
res.send(formatResponse(0, "", result));
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@ -8,6 +8,7 @@ const {
|
||||
deleteAdminDao,
|
||||
findAdminByIdDao,
|
||||
updateAdminDao,
|
||||
findAdminByLoginId
|
||||
} = require("../dao/adminDao");
|
||||
const { adminRule } = require("./rules");
|
||||
const { ValidationError } = require("../utils/errors");
|
||||
@ -145,3 +146,16 @@ module.exports.updateAdminService = async function (id, newInfo) {
|
||||
}
|
||||
return await updateAdminDao(id, newInfo);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} loginId 管理员的登录账号
|
||||
*/
|
||||
module.exports.adminIsExistService = async function (loginId) {
|
||||
const data = await findAdminByLoginId(loginId);
|
||||
if (data.length) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -209,10 +209,7 @@ module.exports.userIsExistService = async function (loginId) {
|
||||
* @returns
|
||||
*/
|
||||
module.exports.passwordcheckService = async function ({ userId, loginPwd }) {
|
||||
console.log(userId, "1");
|
||||
console.log(loginPwd, "2");
|
||||
const userInfo = await findUserByIdDao(userId);
|
||||
console.log(userInfo);
|
||||
if (userInfo.loginPwd === md5(loginPwd)) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||