|
@@ -11,6 +11,19 @@ class PersonalscoreService extends CrudService {
|
|
|
super(ctx, 'personalscore');
|
|
|
this.model = this.ctx.model.Personalscore;
|
|
|
}
|
|
|
+
|
|
|
+ async opera({ data }) {
|
|
|
+ const cList = data.filter(f => !(f.id || f._id));
|
|
|
+ const uList = data.filter(f => f.id || f._id);
|
|
|
+ console.log(cList);
|
|
|
+ console.log(uList);
|
|
|
+ for (const i of cList) {
|
|
|
+ await this.model.create(i);
|
|
|
+ }
|
|
|
+ for (const i of uList) {
|
|
|
+ await this.model.findByIdAndUpdate(i.id || i._id, i);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = PersonalscoreService;
|