From 50e5cdbaceee71f000341a434620d10a87b582f5 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期六, 15 八月 2026 17:12:59 +0800
Subject: [PATCH] 修改 用户属性表中userId从number到string
---
src/modules/user/service/login.ts | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/modules/user/service/login.ts b/src/modules/user/service/login.ts
index 0b8d2f2..18d5cb3 100644
--- a/src/modules/user/service/login.ts
+++ b/src/modules/user/service/login.ts
@@ -120,7 +120,7 @@
};
await this.userInfoEntity.insert(user);
}
- return this.token({ id: user.id });
+ return this.token({ id: user.unionid });
}
/**
@@ -187,7 +187,7 @@
const find: any = { openid: wxUserInfo.openid };
let wxInfo: any = await this.userWxEntity.findOneBy(find);
if (wxInfo) {
- wxUserInfo.id = wxInfo.id;
+ wxUserInfo.id = wxInfo.unionid;
}
return this.userWxEntity.save({
...wxUserInfo,
@@ -237,7 +237,7 @@
};
await this.userInfoEntity.insert(userInfo);
}
- return this.token({ id: userInfo.id });
+ return this.token({ id: userInfo.unionid });
}
/**
@@ -253,7 +253,7 @@
const userInfo = await this.userInfoEntity.findOneBy({
id: info['id'],
});
- return this.token({ id: userInfo.id });
+ return this.token({ id: userInfo?.unionid });
} catch (e) {
throw new CoolCommException(
'鍒锋柊token澶辫触锛岃妫�鏌efreshToken鏄惁姝g‘鎴栬繃鏈�'
@@ -271,7 +271,7 @@
if (user && user.password == md5(password)) {
return this.token({
- id: user.id,
+ id: user.unionid,
});
} else {
throw new CoolCommException('璐﹀彿鎴栧瘑鐮侀敊璇�');
@@ -328,7 +328,7 @@
*/
async generateToken(info, isRefresh = false) {
const { expire, refreshExpire, secret } = this.jwtConfig;
- const user = await this.userInfoEntity.findOneBy({ id: Equal(info.id) });
+ const user = await this.userInfoEntity.findOneBy({ unionid: Equal(info.unionid) });
const tokenInfo = {
isRefresh,
...info,
@@ -346,7 +346,7 @@
*/
async generateSorterToken(info, isRefresh = false) {
const { expire, refreshExpire, secret } = this.jwtConfig;
- const user = await this.basicdataSorterEntity.findOneBy({ businessId: Equal(info.id) });
+ const user = await this.basicdataSorterEntity.findOneBy({ businessId: Equal(info.unionid) });
const tokenInfo = {
isRefresh,
...info,
--
Gitblit v1.9.1