|
@@ -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,
|