wangzhibo
4 天以前 c19f1f7e21c93d1f13b4f44a8a615f65af577559
src/modules/user/service/login.ts
@@ -287,18 +287,24 @@
    const user = await this.basicdataSorterEntity.findOneBy({ phone });
    if (user && user.password == md5(password)) {
      if (user.status !== 0) {
        throw new CoolCommException('分拣员账号不可用');
      }
      const info = {
        id: user.businessId,
      }
      };
      const { expire, refreshExpire } = this.jwtConfig;
      return {
        expire,
        token: await this.generateSorterToken(info),
        refreshExpire,
        refreshToken: await this.generateSorterToken(info, true),
        sorterId: user.businessId,
        businessName: user.businessName,
        phone: user.phone,
        departmentId: user.departmentId,
        workSiteId: user.workSiteId,
      };
    } else {
      throw new CoolCommException('账号或密码错误');
    }
@@ -346,7 +352,9 @@
   */
  async generateSorterToken(info, isRefresh = false) {
    const { expire, refreshExpire, secret } = this.jwtConfig;
    const user = await this.basicdataSorterEntity.findOneBy({ businessId: Equal(info.unionid) });
    const user = await this.basicdataSorterEntity.findOneBy({
      businessId: Equal(info.id),
    });
    const tokenInfo = {
      isRefresh,
      ...info,