wangzhibo
5 天以前 50e5cdbaceee71f000341a434620d10a87b582f5
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失败,请检查refreshToken是否正确或过期'
@@ -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,