|
@@ -1,23 +1,14 @@
|
|
|
import { Provide } from '@midwayjs/decorator';
|
|
|
import { InjectEntityModel } from '@midwayjs/typegoose';
|
|
|
-import { getModelForClass, ReturnModelType } from '@typegoose/typegoose';
|
|
|
+import { ReturnModelType } from '@typegoose/typegoose';
|
|
|
import { BaseService } from 'free-midway-component';
|
|
|
import { Message } from '../entity/message.entity';
|
|
|
-import { UnitStudioApply } from '../entity/basic/unitStudioApply.entity';
|
|
|
-import { UserStudioApply } from '../entity/basic/userStudioApply.entity';
|
|
|
+import { UnitStudioApply } from '../entityBasic/unitStudioApply.entity';
|
|
|
+import { UserStudioApply } from '../entityBasic/userStudioApply.entity';
|
|
|
import _ = require('lodash');
|
|
|
type modelType = ReturnModelType<typeof Message>;
|
|
|
@Provide()
|
|
|
export class MessageService extends BaseService<modelType> {
|
|
|
- constructor(ctx) {
|
|
|
- super();
|
|
|
- if (!this.ctx && ctx) {
|
|
|
- this.ctx = ctx;
|
|
|
- if (!this.cModel) this.cModel = getModelForClass(UnitStudioApply);
|
|
|
- if (!this.sModel) this.sModel = getModelForClass(UserStudioApply);
|
|
|
- if (!this.model) this.model = getModelForClass(Message);
|
|
|
- }
|
|
|
- }
|
|
|
@InjectEntityModel(Message)
|
|
|
model: modelType;
|
|
|
|
|
@@ -50,8 +41,8 @@ export class MessageService extends BaseService<modelType> {
|
|
|
const list = [];
|
|
|
for (const val of e) {
|
|
|
let data = {};
|
|
|
- if (type === '1') data = _.pick(val, ['id', 'company', 'phone']);
|
|
|
- else if (type === '2') data = _.pick(val, ['id', 'name', 'phone']);
|
|
|
+ if (type === '1') data = _.pick(val, ['_id', 'company', 'phone']);
|
|
|
+ else if (type === '2') data = _.pick(val, ['_id', 'name', 'phone']);
|
|
|
list.push(data);
|
|
|
}
|
|
|
return list;
|