|
@@ -11,6 +11,15 @@ class HeadteacherService extends CrudService {
|
|
|
constructor(ctx) {
|
|
|
super(ctx, 'headteacher');
|
|
|
this.model = this.ctx.model.Headteacher;
|
|
|
+ this.umodel = this.ctx.model.User;
|
|
|
+ }
|
|
|
+
|
|
|
+ async create(data) {
|
|
|
+ const { name, phone } = data;
|
|
|
+ const res = await this.model.create(data);
|
|
|
+ const newdata = { name, mobile: phone, type: '1', uid: res.id };
|
|
|
+ newdata.passwd = { secret: '12345678' };
|
|
|
+ await this.umodel.create(newdata);
|
|
|
}
|
|
|
|
|
|
}
|