import { Provide } from '@midwayjs/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { News } from '../../entity/platform/news.entity';
import { Repository } from 'typeorm';
import { BaseServiceV2 } from '../../frame/BaseServiceV2';
@Provide()
export class NewsService extends BaseServiceV2 {
  @InjectEntityModel(News)
  model: Repository<News>;

  getQueryColumnsOpera() {
    const obj = {
      tags: this.Opera.Json,
    };
    return obj;
  }
  // 加浏览量
  async fetchBrowse(data) {
    const { number, id } = data;
    await this.model.update({ id }, { number: number + 1 });
  }
}
