|
|
@@ -11,13 +11,13 @@ import { ShuyouGameCompleteHandService } from './game_complete_hand';
|
|
|
import { ShuyouGameCompleteHandEntity } from '../entity/game_complete_hand';
|
|
|
import { ShuyouXJFUtilsService } from './utils_xjf';
|
|
|
import { ShuyouGameCompleteHandCardEntity } from '../entity/game_complete_hand_card';
|
|
|
-const axios = require('axios')
|
|
|
+import { ShuyouGameCompleteEntity } from '../entity/game_complete';
|
|
|
+const axios = require('axios');
|
|
|
/**
|
|
|
* 游戏目标
|
|
|
*/
|
|
|
@Provide()
|
|
|
export class ShuyouGameTargetService extends BaseService {
|
|
|
-
|
|
|
@InjectEntityModel(ShuyouGameTargetEntity)
|
|
|
ShuyouGameTargetEntity: Repository<ShuyouGameTargetEntity>;
|
|
|
|
|
|
@@ -36,6 +36,9 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
@InjectEntityModel(ShuyouGameTaskEntity)
|
|
|
ShuyouGameTaskEntity: Repository<ShuyouGameTaskEntity>;
|
|
|
|
|
|
+ @InjectEntityModel(ShuyouGameCompleteEntity)
|
|
|
+ ShuyouGameCompleteEntity: Repository<ShuyouGameCompleteEntity>;
|
|
|
+
|
|
|
@Inject()
|
|
|
ShuyouXJFUtilsService: ShuyouXJFUtilsService;
|
|
|
|
|
|
@@ -43,30 +46,30 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
ShuyouGameCompleteHandCardEntity: Repository<ShuyouGameCompleteHandCardEntity>;
|
|
|
|
|
|
/**
|
|
|
- * 重载修改接口
|
|
|
- */
|
|
|
+ * 重载修改接口
|
|
|
+ */
|
|
|
async update(param) {
|
|
|
// console.log(param)
|
|
|
const exists = await this.ShuyouGameTargetEntity.findOne({
|
|
|
id: param.id,
|
|
|
});
|
|
|
- param.createTime = new Date()
|
|
|
- param.updateTime = new Date()
|
|
|
+ param.createTime = new Date();
|
|
|
+ param.updateTime = new Date();
|
|
|
if (!_.isEmpty(exists)) {
|
|
|
if (exists.target_new_low >= param.target_new) {
|
|
|
- param.target_new_low = param.target_new
|
|
|
+ param.target_new_low = param.target_new;
|
|
|
} else {
|
|
|
- param.target_new_low = exists.target_new_low
|
|
|
+ param.target_new_low = exists.target_new_low;
|
|
|
}
|
|
|
if (exists.target_pay_low >= param.target_pay) {
|
|
|
- param.target_pay_low = param.target_pay
|
|
|
+ param.target_pay_low = param.target_pay;
|
|
|
} else {
|
|
|
- param.target_pay_low = exists.target_pay_low
|
|
|
+ param.target_pay_low = exists.target_pay_low;
|
|
|
}
|
|
|
if (exists.target_active_low >= param.target_active) {
|
|
|
- param.target_active_low = param.target_active
|
|
|
+ param.target_active_low = param.target_active;
|
|
|
} else {
|
|
|
- param.target_active_low = exists.target_active_low
|
|
|
+ param.target_active_low = exists.target_active_low;
|
|
|
}
|
|
|
let addObj = {
|
|
|
task_id: param.task_id,
|
|
|
@@ -78,23 +81,33 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
target_active: param.target_active,
|
|
|
target_new_low: param.target_new_low,
|
|
|
target_pay_low: param.target_pay_low,
|
|
|
- target_active_low: param.target_active_low
|
|
|
- }
|
|
|
- const updateResult = await this.ShuyouGameTargetEntity
|
|
|
- .createQueryBuilder()
|
|
|
- .update()
|
|
|
- .set(addObj)
|
|
|
- .where('id = :id', {
|
|
|
- id: param.id,
|
|
|
- })
|
|
|
- .execute();
|
|
|
+ target_active_low: param.target_active_low,
|
|
|
+ };
|
|
|
+ const updateResult =
|
|
|
+ await this.ShuyouGameTargetEntity.createQueryBuilder()
|
|
|
+ .update()
|
|
|
+ .set(addObj)
|
|
|
+ .where('id = :id', {
|
|
|
+ id: param.id,
|
|
|
+ })
|
|
|
+ .execute();
|
|
|
if (updateResult.affected >= 1) {
|
|
|
// throw new CoolCommException('修改成功~');
|
|
|
// console.log('修改成功~')
|
|
|
} else {
|
|
|
// throw new CoolCommException('修改成功~');
|
|
|
- console.log('修改失败~')
|
|
|
+ console.log('修改失败~');
|
|
|
}
|
|
|
+ //修改财务备注remark=====
|
|
|
+ await this.ShuyouGameCompleteEntity.createQueryBuilder()
|
|
|
+ .update()
|
|
|
+ .set({ remark: param.remark })
|
|
|
+ .where('task_id = :task_id and new_date = :new_date', {
|
|
|
+ task_id: param.task_id,
|
|
|
+ new_date: param.new_date,
|
|
|
+ })
|
|
|
+ .execute();
|
|
|
+ //==========================
|
|
|
//修改手动完成情况
|
|
|
//==================================
|
|
|
let obj = {
|
|
|
@@ -111,98 +124,135 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
is_same_hand: param.is_same_hand,
|
|
|
account_hand: param.account_hand,
|
|
|
is_wt_hand: param.is_wt_hand,
|
|
|
- is_xjf_hand: param.is_xjf_hand
|
|
|
- }
|
|
|
+ is_xjf_hand: param.is_xjf_hand,
|
|
|
+ };
|
|
|
//查询本次修改之前的数据
|
|
|
- const oldCompleteHandEntity = await this.ShuyouGameCompleteHandEntity.findOne({
|
|
|
- task_id: param.task_id,
|
|
|
- new_date: param.new_date
|
|
|
- });
|
|
|
- let old_amount_hand = 0
|
|
|
- let old_complete_pay_hand = 0
|
|
|
+ const oldCompleteHandEntity =
|
|
|
+ await this.ShuyouGameCompleteHandEntity.findOne({
|
|
|
+ task_id: param.task_id,
|
|
|
+ new_date: param.new_date,
|
|
|
+ });
|
|
|
+ let old_amount_hand = 0;
|
|
|
+ let old_complete_pay_hand = 0;
|
|
|
if (oldCompleteHandEntity) {
|
|
|
- old_amount_hand = oldCompleteHandEntity.amount_hand
|
|
|
- old_complete_pay_hand = oldCompleteHandEntity.complete_pay_hand
|
|
|
+ old_amount_hand = oldCompleteHandEntity.amount_hand;
|
|
|
+ old_complete_pay_hand = oldCompleteHandEntity.complete_pay_hand;
|
|
|
}
|
|
|
//=============
|
|
|
- await this.ShuyouGameCompleteHandService.addOrUpdate(obj)
|
|
|
+ await this.ShuyouGameCompleteHandService.addOrUpdate(obj);
|
|
|
//上传WT start=======================
|
|
|
if (param.is_wt_hand == 1 || param.is_xjf_hand == 1) {
|
|
|
- const taskInfo = await this.ShuyouGameTaskEntity.findOne({ id: param.task_id })
|
|
|
+ const taskInfo = await this.ShuyouGameTaskEntity.findOne({
|
|
|
+ id: param.task_id,
|
|
|
+ });
|
|
|
// console.log(taskInfo)
|
|
|
if (taskInfo) {
|
|
|
- let game_id = ''
|
|
|
- let channel_id = ''
|
|
|
- let url = ''
|
|
|
- let new_amount_hand = 0
|
|
|
- let new_complete_pay_hand = 0
|
|
|
+ let game_id = '';
|
|
|
+ let channel_id = '';
|
|
|
+ let url = '';
|
|
|
+ let new_amount_hand = 0;
|
|
|
+ let new_complete_pay_hand = 0;
|
|
|
if (param.is_wt_hand == 1) {
|
|
|
if (param.is_same_hand == 0) {
|
|
|
- new_amount_hand = parseFloat(param.price_hand) * parseFloat(param.complete_pay_hand) - parseFloat(old_amount_hand + '')
|
|
|
+ new_amount_hand =
|
|
|
+ parseFloat(param.price_hand) *
|
|
|
+ parseFloat(param.complete_pay_hand) -
|
|
|
+ parseFloat(old_amount_hand + '');
|
|
|
} else {
|
|
|
- new_amount_hand = parseFloat(param.amount_hand) - parseFloat(old_amount_hand + '')
|
|
|
+ new_amount_hand =
|
|
|
+ parseFloat(param.amount_hand) -
|
|
|
+ parseFloat(old_amount_hand + '');
|
|
|
}
|
|
|
if (taskInfo.game_agentId == 5) {
|
|
|
//魅族
|
|
|
- game_id = taskInfo.mz_id
|
|
|
- channel_id = taskInfo.mz_channel
|
|
|
- url = 'https://sy.nkfzs.com/v2/data_collect/game_task_report_meizu?channel_id=' + channel_id + '&game_id=' + game_id + '&type=3&account=hand_' + new Date().getTime() + '&money=' + new_amount_hand
|
|
|
+ game_id = taskInfo.mz_id;
|
|
|
+ channel_id = taskInfo.mz_channel;
|
|
|
+ url =
|
|
|
+ 'https://sy.nkfzs.com/v2/data_collect/game_task_report_meizu?channel_id=' +
|
|
|
+ channel_id +
|
|
|
+ '&game_id=' +
|
|
|
+ game_id +
|
|
|
+ '&type=3&account=hand_' +
|
|
|
+ new Date().getTime() +
|
|
|
+ '&money=' +
|
|
|
+ new_amount_hand;
|
|
|
} else if (taskInfo.game_agentId == 1) {
|
|
|
//腾讯
|
|
|
- game_id = taskInfo.qq_id
|
|
|
- channel_id = taskInfo.qq_channel
|
|
|
- url = 'https://sy.nkfzs.com/v2/data_collect/game_task_report?channel_id=' + channel_id + '&game_id=' + game_id + '&type=3&account=hand_' + new Date().getTime() + '&money=' + new_amount_hand
|
|
|
+ game_id = taskInfo.qq_id;
|
|
|
+ channel_id = taskInfo.qq_channel;
|
|
|
+ url =
|
|
|
+ 'https://sy.nkfzs.com/v2/data_collect/game_task_report?channel_id=' +
|
|
|
+ channel_id +
|
|
|
+ '&game_id=' +
|
|
|
+ game_id +
|
|
|
+ '&type=3&account=hand_' +
|
|
|
+ new Date().getTime() +
|
|
|
+ '&money=' +
|
|
|
+ new_amount_hand;
|
|
|
}
|
|
|
// console.log(url)
|
|
|
new Promise(function (resolve, reject) {
|
|
|
- axios.get(url)
|
|
|
+ axios
|
|
|
+ .get(url)
|
|
|
.then((res: string) => {
|
|
|
// console.log(res)
|
|
|
resolve(res);
|
|
|
})
|
|
|
.catch((error: any) => {
|
|
|
// console.log(error)
|
|
|
- resolve(error)
|
|
|
+ resolve(error);
|
|
|
// reject(error)
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
if (param.is_xjf_hand == 1) {
|
|
|
- new_complete_pay_hand = parseInt(param.complete_pay_hand) - parseInt(old_complete_pay_hand + '')
|
|
|
+ new_complete_pay_hand =
|
|
|
+ parseInt(param.complete_pay_hand) -
|
|
|
+ parseInt(old_complete_pay_hand + '');
|
|
|
//上传手动付费到xjf后台
|
|
|
- game_id = taskInfo.xjf_id + ''
|
|
|
+ game_id = taskInfo.xjf_id + '';
|
|
|
for (var i = 0; i < new_complete_pay_hand; i++) {
|
|
|
- await this.ShuyouXJFUtilsService.uploadLog(game_id, 'hand' + i + '_' + new Date().getTime(), '付费充值', '付费成功', '');
|
|
|
+ await this.ShuyouXJFUtilsService.uploadLog(
|
|
|
+ game_id,
|
|
|
+ 'hand' + i + '_' + new Date().getTime(),
|
|
|
+ '付费充值',
|
|
|
+ '付费成功',
|
|
|
+ ''
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
//记录 QQ卡消耗 start=========================
|
|
|
- const card_list = param.card_list
|
|
|
+ const card_list = param.card_list;
|
|
|
if (card_list && param.pay_mode_hand == 0) {
|
|
|
//删除之前该游戏该日期的QQ卡记录
|
|
|
await this.ShuyouGameCompleteHandCardEntity.delete({
|
|
|
task_id: param.task_id,
|
|
|
- new_date: param.new_date
|
|
|
+ new_date: param.new_date,
|
|
|
});
|
|
|
for (const item of card_list) {
|
|
|
if (item.card_account != '' || item.card_balance != '') {
|
|
|
// console.log(item)
|
|
|
// 上传手动做付费的QQ卡,game_id,card_account,card_balance
|
|
|
- let qqConsume
|
|
|
+ let qqConsume;
|
|
|
// console.log(game_id + '----' + item.card_account + '----' + item.card_balance)
|
|
|
- qqConsume = await this.ShuyouXJFUtilsService.uploadQQconsume(game_id, item.card_account, item.card_balance);
|
|
|
+ qqConsume = await this.ShuyouXJFUtilsService.uploadQQconsume(
|
|
|
+ game_id,
|
|
|
+ item.card_account,
|
|
|
+ item.card_balance
|
|
|
+ );
|
|
|
// console.log(qqConsume)
|
|
|
if (qqConsume.data == 'ok') {
|
|
|
await this.ShuyouGameCompleteHandCardEntity.save({
|
|
|
task_id: param.task_id,
|
|
|
new_date: param.new_date,
|
|
|
card_account: item.card_account,
|
|
|
- card_balance: item.card_balance
|
|
|
+ card_balance: item.card_balance,
|
|
|
});
|
|
|
} else {
|
|
|
- throw new CoolCommException(qqConsume.data)
|
|
|
+ throw new CoolCommException(qqConsume.data);
|
|
|
}
|
|
|
} else {
|
|
|
- throw new CoolCommException('添加的qq卡信息不能为空')
|
|
|
+ throw new CoolCommException('添加的qq卡信息不能为空');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -222,7 +272,7 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
async updateTarget(task_id: string, new_date: Date) {
|
|
|
const gameTargetEntity = await this.ShuyouGameTargetEntity.findOne({
|
|
|
task_id: task_id,
|
|
|
- new_date: new_date
|
|
|
+ new_date: new_date,
|
|
|
});
|
|
|
// this.logger.warn(task_id)
|
|
|
// this.logger.warn(new_date)
|
|
|
@@ -261,33 +311,34 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
lc_twentyseven: 0,
|
|
|
lc_twentyeight: 0,
|
|
|
lc_twentynine: 0,
|
|
|
- lc_thirty: 0
|
|
|
- }
|
|
|
- const updateResult = await this.ShuyouGameTargetEntity
|
|
|
- .createQueryBuilder()
|
|
|
- .update()
|
|
|
- .set(targetValue)
|
|
|
- .where('task_id = :task_id and new_date = :new_date', {
|
|
|
- task_id: task_id,
|
|
|
- new_date: new_date
|
|
|
- })
|
|
|
- .execute();
|
|
|
+ lc_thirty: 0,
|
|
|
+ };
|
|
|
+ const updateResult =
|
|
|
+ await this.ShuyouGameTargetEntity.createQueryBuilder()
|
|
|
+ .update()
|
|
|
+ .set(targetValue)
|
|
|
+ .where('task_id = :task_id and new_date = :new_date', {
|
|
|
+ task_id: task_id,
|
|
|
+ new_date: new_date,
|
|
|
+ })
|
|
|
+ .execute();
|
|
|
// this.logger.warn(updateResult)
|
|
|
- const deleteResult = await this.ShuyouGameTargetEntity
|
|
|
- .createQueryBuilder()
|
|
|
- .delete()
|
|
|
- .where('task_id = :task_id and new_date > :new_date', {
|
|
|
- task_id: task_id,
|
|
|
- new_date: new_date
|
|
|
- }).execute()
|
|
|
+ const deleteResult =
|
|
|
+ await this.ShuyouGameTargetEntity.createQueryBuilder()
|
|
|
+ .delete()
|
|
|
+ .where('task_id = :task_id and new_date > :new_date', {
|
|
|
+ task_id: task_id,
|
|
|
+ new_date: new_date,
|
|
|
+ })
|
|
|
+ .execute();
|
|
|
// this.logger.warn(deleteResult)
|
|
|
if (updateResult.affected >= 1 && deleteResult.affected >= 0) {
|
|
|
- return 1000
|
|
|
+ return 1000;
|
|
|
} else {
|
|
|
- return -1
|
|
|
+ return -1;
|
|
|
}
|
|
|
} else {
|
|
|
- return -1
|
|
|
+ return -1;
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
@@ -296,15 +347,27 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
async addTarget(queryObject: ShuyouGameTaskEntity) {
|
|
|
const gameTargetEntity = await this.ShuyouGameTargetEntity.findOne({
|
|
|
task_id: queryObject.id,
|
|
|
- new_date: this.utils.formatDate(new Date())
|
|
|
+ new_date: this.utils.formatDate(new Date()),
|
|
|
});
|
|
|
// this.logger.warn(gameTargetEntity)
|
|
|
- let target_new = 0
|
|
|
- let target_pay = 0
|
|
|
- let target_active = 0
|
|
|
- target_new = Math.floor(Math.random() * (queryObject.target_new_high - queryObject.target_new_low + 1) + queryObject.target_new_low)
|
|
|
- target_pay = Math.floor(Math.random() * (queryObject.target_pay_high - queryObject.target_pay_low + 1) + queryObject.target_pay_low)
|
|
|
- target_active = Math.floor(Math.random() * (queryObject.target_active_high - queryObject.target_active_low + 1) + queryObject.target_active_low)
|
|
|
+ let target_new = 0;
|
|
|
+ let target_pay = 0;
|
|
|
+ let target_active = 0;
|
|
|
+ target_new = Math.floor(
|
|
|
+ Math.random() *
|
|
|
+ (queryObject.target_new_high - queryObject.target_new_low + 1) +
|
|
|
+ queryObject.target_new_low
|
|
|
+ );
|
|
|
+ target_pay = Math.floor(
|
|
|
+ Math.random() *
|
|
|
+ (queryObject.target_pay_high - queryObject.target_pay_low + 1) +
|
|
|
+ queryObject.target_pay_low
|
|
|
+ );
|
|
|
+ target_active = Math.floor(
|
|
|
+ Math.random() *
|
|
|
+ (queryObject.target_active_high - queryObject.target_active_low + 1) +
|
|
|
+ queryObject.target_active_low
|
|
|
+ );
|
|
|
// this.logger.warn(queryObject.directorId)
|
|
|
let targetObj = {
|
|
|
task_id: queryObject.id,
|
|
|
@@ -314,7 +377,7 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
updateTime: new Date(),
|
|
|
target_new: target_new,
|
|
|
target_pay: target_pay,
|
|
|
- target_active: target_active
|
|
|
+ target_active: target_active,
|
|
|
// lc_two: 0,
|
|
|
// lc_three: 0,
|
|
|
// lc_four: 0,
|
|
|
@@ -344,41 +407,50 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
// lc_twentyeight: 0,
|
|
|
// lc_twentynine: 0,
|
|
|
// lc_thirty: 0
|
|
|
- }
|
|
|
- if (gameTargetEntity) { //已存在,则更新
|
|
|
- const updateResult = await this.ShuyouGameTargetEntity
|
|
|
- .createQueryBuilder()
|
|
|
- .update()
|
|
|
- .set(targetObj)
|
|
|
- .where('task_id = :task_id and new_date = :new_date', {
|
|
|
- task_id: queryObject.id,
|
|
|
- new_date: this.utils.formatDate(new Date())
|
|
|
- })
|
|
|
- .execute();
|
|
|
+ };
|
|
|
+ if (gameTargetEntity) {
|
|
|
+ //已存在,则更新
|
|
|
+ const updateResult =
|
|
|
+ await this.ShuyouGameTargetEntity.createQueryBuilder()
|
|
|
+ .update()
|
|
|
+ .set(targetObj)
|
|
|
+ .where('task_id = :task_id and new_date = :new_date', {
|
|
|
+ task_id: queryObject.id,
|
|
|
+ new_date: this.utils.formatDate(new Date()),
|
|
|
+ })
|
|
|
+ .execute();
|
|
|
// this.logger.warn(updateResult)
|
|
|
if (updateResult.affected >= 1) {
|
|
|
- return 1000
|
|
|
+ return 1000;
|
|
|
} else {
|
|
|
- return -1
|
|
|
+ return -1;
|
|
|
}
|
|
|
} else {
|
|
|
//不存在,则新建
|
|
|
- await this.ShuyouGameTargetEntity.insert(targetObj)
|
|
|
+ await this.ShuyouGameTargetEntity.insert(targetObj);
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
- * 重写分页查询
|
|
|
- * @param query
|
|
|
- */
|
|
|
+ * 重写分页查询
|
|
|
+ * @param query
|
|
|
+ */
|
|
|
async page(query) {
|
|
|
- let { task_id, task_name, new_date, directorId, is_complete, login_modeId, game_agentId } = query;
|
|
|
+ let {
|
|
|
+ task_id,
|
|
|
+ task_name,
|
|
|
+ new_date,
|
|
|
+ directorId,
|
|
|
+ is_complete,
|
|
|
+ login_modeId,
|
|
|
+ game_agentId,
|
|
|
+ } = query;
|
|
|
// if (!new_date) {
|
|
|
// new_date = this.utils.formatDate(new Date())
|
|
|
// }
|
|
|
const sql = `
|
|
|
SELECT
|
|
|
a.id,a.task_id,a.task_name,DATE_FORMAT(a.new_date,'%Y-%m-%d') AS new_date,a.target_new,a.target_pay,a.target_active,
|
|
|
- IFNULL(c.complete_new, 0) AS complete_new,IFNULL(c.complete_pay, 0) AS complete_pay,game_rate,game_rate_xmy,
|
|
|
+ IFNULL(c.complete_new, 0) AS complete_new,IFNULL(c.complete_pay, 0) AS complete_pay,game_rate,game_rate_xmy,c.remark,
|
|
|
IFNULL(c.complete_active,0) AS complete_active,c.updateTime,c.is_complete,c.amount,t.xjf_id,
|
|
|
b.name AS directorName,b.id AS directorId,t.login_modeId AS login_modeId,l.name AS login_mode,
|
|
|
d.type_id AS type_id,d.reason AS reason,d.solution AS solution,
|
|
|
@@ -398,41 +470,51 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
WHERE
|
|
|
1 = 1
|
|
|
${this.setSql(task_id, 'and a.task_id LIKE ?', [`%${task_id}%`])}
|
|
|
- ${this.setSql(task_name, 'and a.task_name LIKE ?', [`%${task_name}%`])}
|
|
|
+ ${this.setSql(task_name, 'and a.task_name LIKE ?', [
|
|
|
+ `%${task_name}%`,
|
|
|
+ ])}
|
|
|
${this.setSql(directorId, 'and b.id = ?', [directorId])}
|
|
|
- ${this.setSql(login_modeId, 'and t.login_modeId = ?', [login_modeId])}
|
|
|
- ${this.setSql(game_agentId, 'and t.game_agentId = ?', [game_agentId])}
|
|
|
- ${this.setSql(new_date, 'and a.new_date >= ? and a.new_date <= ?', [this.utils.formatDate(new Date(new_date[0])), this.utils.formatDate(new Date(new_date[1]))])}
|
|
|
+ ${this.setSql(login_modeId, 'and t.login_modeId = ?', [
|
|
|
+ login_modeId,
|
|
|
+ ])}
|
|
|
+ ${this.setSql(game_agentId, 'and t.game_agentId = ?', [
|
|
|
+ game_agentId,
|
|
|
+ ])}
|
|
|
+ ${this.setSql(new_date, 'and a.new_date >= ? and a.new_date <= ?', [
|
|
|
+ this.utils.formatDate(new Date(new_date[0])),
|
|
|
+ this.utils.formatDate(new Date(new_date[1])),
|
|
|
+ ])}
|
|
|
${this.setSql(is_complete, 'and c.is_complete = ?', [is_complete])}
|
|
|
`;
|
|
|
const result = await this.sqlRenderPage(sql, query);
|
|
|
- let page = 0
|
|
|
- let size = 0
|
|
|
- let total = 0
|
|
|
- let pageInfo = []
|
|
|
+ let page = 0;
|
|
|
+ let size = 0;
|
|
|
+ let total = 0;
|
|
|
+ let pageInfo = [];
|
|
|
if (result) {
|
|
|
- page = result.pagination.page
|
|
|
- size = result.pagination.size
|
|
|
- total = result.pagination.total
|
|
|
+ page = result.pagination.page;
|
|
|
+ size = result.pagination.size;
|
|
|
+ total = result.pagination.total;
|
|
|
await ykhForeach(result.list, async (item, index) => {
|
|
|
- let obj = item
|
|
|
- const handCardEntitys = await this.ShuyouGameCompleteHandCardEntity.find({
|
|
|
- task_id: item.task_id,
|
|
|
- new_date: item.new_date
|
|
|
- });
|
|
|
- let cardList = []
|
|
|
+ let obj = item;
|
|
|
+ const handCardEntitys =
|
|
|
+ await this.ShuyouGameCompleteHandCardEntity.find({
|
|
|
+ task_id: item.task_id,
|
|
|
+ new_date: item.new_date,
|
|
|
+ });
|
|
|
+ let cardList = [];
|
|
|
if (handCardEntitys) {
|
|
|
handCardEntitys.forEach(h => {
|
|
|
let obj_son = {
|
|
|
card_account: h.card_account,
|
|
|
- card_balance: h.card_balance
|
|
|
- }
|
|
|
- cardList.push(obj_son)
|
|
|
+ card_balance: h.card_balance,
|
|
|
+ };
|
|
|
+ cardList.push(obj_son);
|
|
|
});
|
|
|
}
|
|
|
- obj.card_list = cardList
|
|
|
- pageInfo.push(obj)
|
|
|
- })
|
|
|
+ obj.card_list = cardList;
|
|
|
+ pageInfo.push(obj);
|
|
|
+ });
|
|
|
}
|
|
|
// console.log(pageInfo)
|
|
|
let sqlRenderPage = {
|
|
|
@@ -440,12 +522,11 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
pagination: {
|
|
|
page: page,
|
|
|
size: size,
|
|
|
- total: total
|
|
|
- }
|
|
|
- }
|
|
|
+ total: total,
|
|
|
+ },
|
|
|
+ };
|
|
|
// console.log(sqlRenderPage)
|
|
|
- return sqlRenderPage
|
|
|
-
|
|
|
+ return sqlRenderPage;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -453,12 +534,15 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
* @memberof ShuyouGameTargetService
|
|
|
*/
|
|
|
async info(id) {
|
|
|
- let info
|
|
|
- const shuyouGameTargetEntity = await this.ShuyouGameTargetEntity.findOne({ id });
|
|
|
- const shuyouGameCompleteHandEntity = await this.ShuyouGameCompleteHandEntity.findOne({
|
|
|
- task_id: shuyouGameTargetEntity.task_id,
|
|
|
- new_date: shuyouGameTargetEntity.new_date
|
|
|
+ let info;
|
|
|
+ const shuyouGameTargetEntity = await this.ShuyouGameTargetEntity.findOne({
|
|
|
+ id,
|
|
|
});
|
|
|
+ const shuyouGameCompleteHandEntity =
|
|
|
+ await this.ShuyouGameCompleteHandEntity.findOne({
|
|
|
+ task_id: shuyouGameTargetEntity.task_id,
|
|
|
+ new_date: shuyouGameTargetEntity.new_date,
|
|
|
+ });
|
|
|
// const handCardEntitys = await this.ShuyouGameCompleteHandCardEntity.find({
|
|
|
// task_id: shuyouGameTargetEntity.task_id,
|
|
|
// new_date: shuyouGameTargetEntity.new_date
|
|
|
@@ -469,7 +553,7 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
// cardList.push(e)
|
|
|
// });
|
|
|
// }
|
|
|
- info = shuyouGameTargetEntity
|
|
|
+ info = shuyouGameTargetEntity;
|
|
|
// info.card_list = cardList
|
|
|
if (shuyouGameCompleteHandEntity) {
|
|
|
info.complete_new_hand = shuyouGameCompleteHandEntity.complete_new_hand;
|
|
|
@@ -486,39 +570,43 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
info.is_xjf_hand = shuyouGameCompleteHandEntity.is_xjf_hand;
|
|
|
// info.card_list = [{ card_account: '', card_balance: '' }];
|
|
|
} else {
|
|
|
- info.complete_new_hand = 0
|
|
|
- info.complete_lc_hand = 0
|
|
|
- info.complete_pay_hand = 0
|
|
|
+ info.complete_new_hand = 0;
|
|
|
+ info.complete_lc_hand = 0;
|
|
|
+ info.complete_pay_hand = 0;
|
|
|
}
|
|
|
return info;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 重新下发今日付费未成功的账号以及重置留存账号
|
|
|
- * @memberof ShuyouGameTargetService
|
|
|
- */
|
|
|
+ * 重新下发今日付费未成功的账号以及重置留存账号
|
|
|
+ * @memberof ShuyouGameTargetService
|
|
|
+ */
|
|
|
async resetPay(id) {
|
|
|
- const ShuyouGameTaskEntity = await this.ShuyouGameTaskEntity.findOne({ id });
|
|
|
+ const ShuyouGameTaskEntity = await this.ShuyouGameTaskEntity.findOne({
|
|
|
+ id,
|
|
|
+ });
|
|
|
if (ShuyouGameTaskEntity) {
|
|
|
// console.log(ShuyouGameTaskEntity)
|
|
|
- let message
|
|
|
- message = await this.ShuyouXJFUtilsService.resetPay(ShuyouGameTaskEntity.xjf_id);
|
|
|
+ let message;
|
|
|
+ message = await this.ShuyouXJFUtilsService.resetPay(
|
|
|
+ ShuyouGameTaskEntity.xjf_id
|
|
|
+ );
|
|
|
if (message.data == 'ok') {
|
|
|
- return { code: 1000, data: message.data }
|
|
|
+ return { code: 1000, data: message.data };
|
|
|
} else {
|
|
|
- return { code: -1, data: message.data }
|
|
|
+ return { code: -1, data: message.data };
|
|
|
}
|
|
|
} else {
|
|
|
- return { code: -1, data: '未找到xjf_id' }
|
|
|
+ return { code: -1, data: '未找到xjf_id' };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询任务目标与完成
|
|
|
- * @param query
|
|
|
- */
|
|
|
+ * 查询任务目标与完成
|
|
|
+ * @param query
|
|
|
+ */
|
|
|
async getTaskTAndC(queryObj) {
|
|
|
- let { task_id, new_date } = queryObj
|
|
|
+ let { task_id, new_date } = queryObj;
|
|
|
const sql = `
|
|
|
SELECT
|
|
|
a.task_id,a.task_name,a.target_new,a.target_pay,a.target_active,
|
|
|
@@ -540,12 +628,13 @@ export class ShuyouGameTargetService extends BaseService {
|
|
|
WHERE
|
|
|
1 = 1
|
|
|
${this.setSql(task_id, 'and a.task_id = ?', [task_id])}
|
|
|
- ${this.setSql(new_date, 'and a.new_date = ?', [this.utils.formatDate(new Date(new_date))])}
|
|
|
+ ${this.setSql(new_date, 'and a.new_date = ?', [
|
|
|
+ this.utils.formatDate(new Date(new_date)),
|
|
|
+ ])}
|
|
|
`;
|
|
|
// console.log(sql)
|
|
|
return this.nativeQuery(sql);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// foreach加上async/await
|
|
|
@@ -561,4 +650,4 @@ const ykhForeach = async (arr, callback) => {
|
|
|
}
|
|
|
k++;
|
|
|
}
|
|
|
-};
|
|
|
+};
|