liuyu 5 gadi atpakaļ
vecāks
revīzija
67890543ae
2 mainītis faili ar 5 papildinājumiem un 6 dzēšanām
  1. 1 0
      app/controller/.roomuser.js
  2. 4 6
      app/service/roomuser.js

+ 1 - 0
app/controller/.roomuser.js

@@ -4,6 +4,7 @@ module.exports = {
       "name",
       "!phone",
       "openid",
+      'passwd',
       "role",
       "deptname",
       "level",

+ 4 - 6
app/service/roomuser.js

@@ -15,22 +15,20 @@ class RoomuserService extends CrudService {
   }
 
   async create(data) {
-    const { name, password } = data;
+    const { name, passwd } = data;
     assert(name, '用户名不能为空');
-    assert(password, '密码不能为空');
+    assert(passwd, '密码不能为空');
     const { phone } = data;
     const has_phone = await this.model.findOne({ phone });
     if (has_phone) {
       throw new BusinessError('此手机号已被注册,请更换手机号');
     }
-    const newdata = data;
-    newdata.password = { secret: password };
-    const res = await this.model.create(newdata);
+    const res = await this.model.create(data);
     if (res) {
       const newdata = {
         name,
         phone: data.phone,
-        passwd: password,
+        passwd,
         uid: res.id,
         role: data.role,
         deptname: data.deptname,