|
@@ -39,6 +39,9 @@ router.post('/login', async (ctx) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ console.log("user res信息")
|
|
|
+ console.log(res)
|
|
|
+
|
|
|
const token = util.createToken({ userName, userId: res.id, nickName: res.nickName });
|
|
|
userService.updateUserInfo(res.id);
|
|
|
util.success(ctx, {
|
|
@@ -46,6 +49,9 @@ router.post('/login', async (ctx) => {
|
|
|
userName,
|
|
|
token,
|
|
|
});
|
|
|
+
|
|
|
+ console.log("新的token:"+token)
|
|
|
+
|
|
|
});
|
|
|
|
|
|
/**
|
|
@@ -439,4 +445,34 @@ router.post('/subUser/delete', async (ctx) => {
|
|
|
util.fail(ctx, '删除失败,请重试');
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+//addbywanghao sso 20250512
|
|
|
+router.post('/ssoLogin', async (ctx) => {
|
|
|
+ const { userIdno } = ctx.request.body;
|
|
|
+ if (!userIdno ) {
|
|
|
+ util.fail(ctx, 'userIdno不能为空');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await userService.findUserSso(userIdno);
|
|
|
+
|
|
|
+ if (!res) {
|
|
|
+ util.fail(ctx, 'userIdno 不存在,暂无权限');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("user res信息")
|
|
|
+ console.log(res)
|
|
|
+
|
|
|
+ const token = util.createToken({ userName: res.userName, userId: res.id, nickName: res.nickName });
|
|
|
+ userService.updateUserInfo(res.id);
|
|
|
+ util.success(ctx, {
|
|
|
+ userId: res.id,
|
|
|
+ userName: res.userName,
|
|
|
+ token,
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log("sso新的token:"+token)
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
module.exports = router;
|