lrf402788946 %!s(int64=4) %!d(string=hai) anos
pai
achega
d2d287fff0
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  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();