wangzhibo
7 天以前 665ba0f9ae078c2859209451a163d10515171d11
src/modules/user/service/info.ts
@@ -46,7 +46,7 @@
   */
  async person(id) {
    const info = await this.userInfoEntity.findOneBy({ id: Equal(id) });
    delete info.password;
    //delete info.password;
    return info;
  }
@@ -59,10 +59,10 @@
      { id: userId },
      {
        status: 2,
        phone: null,
        unionid: null,
        phone: "",
        unionid: "",
        nickName: `已注销-00${userId}`,
        avatarUrl: null,
        avatarUrl: "",
      }
    );
  }
@@ -85,7 +85,7 @@
          uuid() + '.png'
        );
      }
    } catch (err) {}
    } catch (err) { }
    try {
      return await this.userInfoEntity.update({ id }, param);
    } catch (err) {
@@ -99,13 +99,21 @@
   * @param password
   * @param 验证码
   */
  async updatePassword(userId, password, code) {
    const user = await this.userInfoEntity.findOneBy({ id: userId });
  async updatePassword(userId: string, password: string, code: string) {
    const user = await this.userInfoEntity.findOneBy({ unionid: userId });
    if (!user) {
      throw new CoolCommException('用户不存在');
    }
    const check = await this.userSmsService.checkCode(user.phone, code);
    if (!check) {
      throw new CoolCommException('验证码错误');
    }
    await this.userInfoEntity.update(user.id, { password: md5(password) });
    await this.userInfoEntity.update(user.unionid, {
      password: md5(password),
    });
  }
  /**