|
@@ -1,8 +1,18 @@
|
|
|
-import { Provide } from '@midwayjs/core';
|
|
|
+import { Inject, Provide } from '@midwayjs/core';
|
|
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
|
|
import { Equal, Repository } from 'typeorm';
|
|
|
import { Collection } from '../../entity/platform/collection.entity';
|
|
|
import { BaseServiceV2 } from '../../frame/BaseServiceV2';
|
|
|
+import { MatchService } from '../platform/match.service';
|
|
|
+import { AchievementService } from '../platform/achievement.service';
|
|
|
+import { SupplyService } from '../platform/supply.service';
|
|
|
+import { SupportService } from '../platform/support.service';
|
|
|
+import { ProjectService } from '../platform/project.service';
|
|
|
+import { FootplateService } from '../platform/footplate.service';
|
|
|
+import { NewsService } from '../platform/news.service';
|
|
|
+import { ExpertService } from '../../service/users/expert.service';
|
|
|
+import { DemandService } from '../platform/demand.service';
|
|
|
+import { CompanyService } from '../../service/users/company.service';
|
|
|
@Provide()
|
|
|
export class CollectionService extends BaseServiceV2 {
|
|
|
getQueryColumnsOpera(): object {
|
|
@@ -10,11 +20,40 @@ export class CollectionService extends BaseServiceV2 {
|
|
|
}
|
|
|
@InjectEntityModel(Collection)
|
|
|
model: Repository<Collection>;
|
|
|
+
|
|
|
+ @Inject()
|
|
|
+ match: MatchService;
|
|
|
+ @Inject()
|
|
|
+ achievement: AchievementService;
|
|
|
+ @Inject()
|
|
|
+ supply: SupplyService;
|
|
|
+ @Inject()
|
|
|
+ support: SupportService;
|
|
|
+ @Inject()
|
|
|
+ project: ProjectService;
|
|
|
+ @Inject()
|
|
|
+ footplate: FootplateService;
|
|
|
+ @Inject()
|
|
|
+ news: NewsService;
|
|
|
+ @Inject()
|
|
|
+ expert: ExpertService;
|
|
|
+ @Inject()
|
|
|
+ demand: DemandService;
|
|
|
+ @Inject()
|
|
|
+ company: CompanyService;
|
|
|
+
|
|
|
+ // 转化来源数据名称
|
|
|
+ async fillScource(data) {
|
|
|
+ const { type, source } = data;
|
|
|
+ const dataRes = await this[type].fetch({ id: source });
|
|
|
+ if (dataRes) data = { ...data, source_name: dataRes.name || dataRes.title };
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
// 取消收藏
|
|
|
async cancel(data) {
|
|
|
const { user, source } = data;
|
|
|
const d = await this.model.findOne({ where: { user: Equal(user), source: Equal(source) } });
|
|
|
- // await this.model.deleteOne({ user, source });
|
|
|
await this.model.delete(d.id);
|
|
|
}
|
|
|
}
|