lrf402788946 4 năm trước cách đây
mục cha
commit
d2d287fff0
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      app/service/user.js

+ 6 - 1
app/service/user.js

@@ -118,7 +118,12 @@ class UserService extends CrudService {
     if (user) {
       // 2021-06-07修改:根据身份证/手机号,找到对应的学生信息,将_id变为uid重保存
       const stuInfo = await this.stuModel.findOne({ $or: [{ id_number }, { mobile }] });
-      if (stuInfo) user.uid = stuInfo._id;
+      if (stuInfo) {
+        user.uid = stuInfo._id;
+        // 将学生信息的openid也重置
+        stuInfo.openid = openid;
+        await stuInfo.save();
+      }
       user.openid = openid;
       user.unionid = unionid;
       await user.save();