|
@@ -35,6 +35,25 @@ class OtheruserService extends CrudService {
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async creatcpjl(data) {
|
|
|
|
+ const { name, phone, passwd, type, characterid } = data;
|
|
|
|
+ console.log(data);
|
|
|
|
+ assert(name && phone && passwd && type, '缺少部分信息项');
|
|
|
|
+ assert(/^\d{11}$/i.test(phone), 'phone无效');
|
|
|
|
+ const user = await this.model.findOne({ phone });
|
|
|
|
+ if (user) {
|
|
|
|
+ throw new BusinessError(ErrorCode.DATA_EXISTED);
|
|
|
|
+ }
|
|
|
|
+ const newdata = data;
|
|
|
|
+ const pas = await this.createJwtPwd(passwd);
|
|
|
|
+ newdata.passwd = pas;
|
|
|
|
+ const res = await this.model.create(newdata);
|
|
|
|
+ if (type === '1') {
|
|
|
|
+ await this.imodel.create({ uid: res.id, name });
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
// 重写修改方法
|
|
// 重写修改方法
|
|
async update({ id }, data) {
|
|
async update({ id }, data) {
|
|
const { name, phone, passwd, type, characterid } = data;
|
|
const { name, phone, passwd, type, characterid } = data;
|