| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /*
- * @Author: YKH
- * @Date: 2021-12-08 10:26:27
- * @LastEditTime: 2022-04-21 17:05:47
- * @Description:
- * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\hide\service\hide_game_agent.ts
- */
- import { Provide } from '@midwayjs/decorator';
- import { BaseService } from 'midwayjs-cool-core';
- import { InjectEntityModel } from '@midwayjs/orm';
- import { Repository } from 'typeorm';
- import * as _ from 'lodash';
- import { HideGameAgentEntity } from '../entity/hide_game_agent';
- /**
- * 游戏目标
- */
- @Provide()
- export class HideGameAgentService extends BaseService {
- @InjectEntityModel(HideGameAgentEntity)
- HideGameAgentEntity: Repository<HideGameAgentEntity>;
- /**
- * 厂商对应的游戏数量+1
- * @param {*} game_agentId
- * @memberof HideGameAgentService
- */
- async recordGameNum(game_agentId: number) {
- if (game_agentId) {
- const gameAgentEntity = await this.HideGameAgentEntity.findOne(game_agentId);
- gameAgentEntity.game_count = gameAgentEntity.game_count + 1;
- await this.HideGameAgentEntity.save(gameAgentEntity);
- return 1000
- } else {
- return -1
- }
- }
- /**
- * 厂商对应的游戏数量-1
- * @param {*} game_agentId
- * @memberof HideGameAgentService
- */
- async reduceGameNum(game_agentId: number) {
- if (game_agentId) {
- const gameAgentEntity = await this.HideGameAgentEntity.findOne(game_agentId);
- gameAgentEntity.game_count = gameAgentEntity.game_count - 1;
- await this.HideGameAgentEntity.save(gameAgentEntity);
- return 1000
- } else {
- return -1
- }
- }
- /**
- *
- *减少游戏数量by name
- * @param {*} name
- * @return {*}
- * @memberof HideGameAgentService
- */
- async reduceGameNumByname(name: any) {
- if (name) {
- const gameAgentEntity = await this.HideGameAgentEntity.findOne({
- name: name
- });
- gameAgentEntity.game_count = gameAgentEntity.game_count - 1;
- await this.HideGameAgentEntity.save(gameAgentEntity);
- return 1000
- } else {
- return -1
- }
- }
- /**
- *
- *增加游戏数量by name
- * @param {*} name
- * @return {*}
- * @memberof HideGameAgentService
- */
- async addGameNumByname(name: any) {
- if (name) {
- const gameAgentEntity = await this.HideGameAgentEntity.findOne({
- name: name
- });
- gameAgentEntity.game_count = gameAgentEntity.game_count + 1;
- await this.HideGameAgentEntity.save(gameAgentEntity);
- return 1000
- } else {
- return -1
- }
- }
- // /**
- // * 重写分页查询
- // * @param query
- // */
- // async page(query) {
- // const { pc_name, is_rent,shop_name,is_abnormal } = query;
- // const sql = `
- // SELECT
- // *
- // FROM
- // hide_game_computer
- // WHERE 1 = 1
- // ${this.setSql(pc_name, 'and pc_name LIKE ?', [`%${pc_name}%`])}
- // ${this.setSql(is_rent, 'and is_rent = ?', [is_rent])}
- // ${this.setSql(shop_name, 'and shop_name LIKE ?', [`%${shop_name}%`])}
- // ${this.setSql(is_abnormal, 'and is_abnormal = ?', [is_abnormal])}
- // `;
- // return this.sqlRenderPage(sql, query);
- // }
- }
|