import { Provide } from '@midwayjs/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { News } from '../../entity/platform/news.entity';
import { Repository } from 'typeorm';
import { BaseService } from '../../frame/BaseService';
@Provide()
export class NewsService extends BaseService<News> {
  @InjectEntityModel(News)
  model: Repository<News>;
  // 加浏览量
  async fetchBrowse(data) {
    const { number, id } = data;
    await this.model.update({ id }, { number: number + 1 });
  }
}
