YKH 4 år sedan
förälder
incheckning
d3a1c988d7

+ 3 - 3
cool-admin-midway-master/README.md

@@ -1,14 +1,14 @@
 <!--
  * @Author: YKH
  * @Date: 2021-12-08 10:23:31
- * @LastEditTime: 2022-05-05 13:56:03
+ * @LastEditTime: 2022-05-09 18:55:50
  * @Description: 
  * @FilePath: \cool-admin\cool-admin-midway-master\README.md
 -->
 
 ####
-新增数据库
-shuyou_target_flag
+game_task新增字段mz_channel,mz_id.需要手动添加至数据库
+
 
 ## Node版后台基础框架基于Egg.js
 

+ 1 - 1
cool-admin-midway-master/src/app/modules/hide/controller/app/game_task.ts

@@ -54,7 +54,7 @@ export class HideAppGameTaskController extends BaseController {
    * @param {*} queryObject
    * @memberof HideAppGameTaskController
    */
-  //TODO接口添加上任务对应的文件,每个类型只返回一个最高版本号的
+  //
   @Get('/getTaskTAndC')
   async getTaskTAndC(@Query(ALL) queryObject) {
     let { task_id, new_date } = queryObject

+ 1 - 1
cool-admin-midway-master/src/app/modules/hide/service/hide_game_task.ts

@@ -1,7 +1,7 @@
 import { Inject, Provide } from '@midwayjs/decorator';
 import { BaseService, CoolCommException } from 'midwayjs-cool-core';
 import { InjectEntityModel } from '@midwayjs/orm';
-import { getConnection, Repository, Table } from 'typeorm';
+import { Repository } from 'typeorm';
 import * as _ from 'lodash';
 import { ILogger } from '@midwayjs/logger';
 import { HideGameTaskEntity } from '../entity/hide_game_task';

+ 1 - 1
cool-admin-midway-master/src/app/modules/shuyou/controller/app/game_task.ts

@@ -62,7 +62,7 @@ export class ShuyouAppGameTaskController extends BaseController {
    * @param {*} queryObject
    * @memberof ShuyouAppGameTaskController
    */
-  //TODO接口添加上任务对应的文件,每个类型只返回一个最高版本号的
+  //接口添加上任务对应的文件,每个类型只返回一个最高版本号的
   @Get('/getTaskTAndC')
   async getTaskTAndC(@Query(ALL) queryObject) {
     let { task_id, new_date } = queryObject

+ 2 - 2
cool-admin-midway-master/src/app/modules/shuyou/controller/app/vx_api.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: YKH
  * @Date: 2022-04-12 15:14:01
- * @LastEditTime: 2022-04-15 14:58:49
+ * @LastEditTime: 2022-05-11 17:08:46
  * @Description: 
  * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\shuyou\controller\app\vx_api.ts
  */
@@ -40,7 +40,7 @@ export class ShuyouAppVXApiController extends BaseController {
    * @param {*} queryObject
    * @memberof ShuyouAppVXApiController
    */
-  //TODO各种微信扫码api
+  //各种微信扫码api
   @Get('/getVXApi')
   async getVXApi(@Query(ALL) queryObject) {
     //task_id: 任务id  account:账号  projectId:项目id  qrCode: qrCode orderId:订单号  orderType:订单类型

+ 6 - 0
cool-admin-midway-master/src/app/modules/shuyou/entity/game_task.ts

@@ -123,6 +123,12 @@ export class ShuyouGameTaskEntity {
   @Column({ comment: '腾讯后台游戏id(如果是腾讯游戏则填写)', length: 50, nullable: true })
   qq_id: string;
 
+  @Column({ comment: '魅族游戏渠道id(如果是魅族游戏则填写)', length: 50, default: null })
+  mz_channel: string;
+
+  @Column({ comment: '魅族后台游戏id(如果是魅族游戏则填写)', length: 50, default: null })
+  mz_id: string;
+
   @Column({ comment: '下载链接', nullable: true })
   download: string;
 

+ 1 - 1
cool-admin-midway-master/src/app/modules/shuyou/service/game_task.ts

@@ -154,7 +154,7 @@ export class ShuyouGameTaskService extends BaseService {
             SELECT
             a.id,a.task_name,a.new_date,a.createTime,a.updateTime,a.target_new_low,a.target_new_high,a.target_pay_low,a.target_pay_high,a.target_active_low,a.target_active_high,
             a.lc_two_ratio,a.lc_three_ratio,a.lc_four_ratio,a.lc_five_ratio,a.lc_six_ratio,a.lc_seven_ratio,a.lc_eight_ratio,a.lc_fifteen_ratio,a.lc_thirty_ratio,a.stopTime,a.stopRemark,
-            a.remark,a.is_run,a.is_repeat,a.xmy_id,a.qq_channel,a.qq_id,a.download,a.unit_price_low,a.unit_price_high,
+            a.remark,a.is_run,a.is_repeat,a.xmy_id,a.qq_channel,a.qq_id,a.mz_channel,a.mz_id,a.download,a.unit_price_low,a.unit_price_high,
             any_value (b.name) AS directorName,b.id AS directorId,
             any_value (c.name) AS login_modeId,
             any_value (d.name) AS game_agentId,

+ 7 - 3
cool-admin-midway-master/src/app/modules/task/controller/admin/flag.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: YKH
  * @Date: 2022-04-25 11:45:04
- * @LastEditTime: 2022-05-05 16:27:48
+ * @LastEditTime: 2022-05-09 11:37:29
  * @Description: 
  * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\task\controller\admin\flag.ts
  */
@@ -37,8 +37,12 @@ export class ShuyouTargetFlagController extends BaseController {
         let getTodayFlag = await this.ShuyouTargetFlagService.getTodayFlag('todayFlag');
         // console.log(getTodayFlag)
         if (!getTodayFlag) {
-            return { code: -1, message: '未查询到标记' };
+            return await this.fail('未查询到标记', -1);
+        } else if (getTodayFlag.code == 1000) {
+            return await this.ok({ code: 1000, message: getTodayFlag.data });
+        } else {
+            // return await this.fail(getTodayFlag.data, -1);
+            return await this.ok({ code: -1, message: getTodayFlag.data });
         }
-        return getTodayFlag;
     }
 }

+ 6 - 8
cool-admin-midway-master/src/app/modules/task/service/flag.ts

@@ -1,13 +1,13 @@
 /*
  * @Author: YKH
  * @Date: 2022-04-25 11:47:16
- * @LastEditTime: 2022-05-05 15:37:37
+ * @LastEditTime: 2022-05-09 13:45:39
  * @Description: 
  * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\task\service\flag.ts
  */
 
 import { Provide } from '@midwayjs/decorator';
-import { BaseService, CoolCommException } from 'midwayjs-cool-core';
+import { BaseService } from 'midwayjs-cool-core';
 import { InjectEntityModel } from '@midwayjs/orm';
 import { Repository } from 'typeorm';
 import * as _ from 'lodash';
@@ -66,14 +66,12 @@ export class ShuyouTargetFlagService extends BaseService {
         });
         // console.log(exists)
         if (_.isEmpty(exists)) {
-            return { code: 1000 }
+            return { code: 1000, data: 'exists' }
         } else if (exists.status == 1) {
-            return { code: 1000 }
-        } else {
+            return { code: 1000, data: 'success' }
+        } else
             return { code: -1, data: exists }
-        }
     }
+}
 
 
-
-}

+ 76 - 9
cool-admin-midway-master/src/app/modules/task/service/shuyou.ts

@@ -143,10 +143,15 @@ export class TaskShuyouService extends BaseService {
       detail: '',
       time: new Date
     }
+    // flag.detail = 'syncTargetAndComplete Fail'
+    // flag.status = 0
+    // await this.ShuyouTargetFlagService.add(flag)
+
     const sql = `
       SELECT 
         a.*,
-        b.xmy_id AS xmy_id,b.unit_price_low AS unit_price_low,b.unit_price_high AS unit_price_high
+        b.xmy_id AS xmy_id,b.unit_price_low AS unit_price_low,b.unit_price_high AS unit_price_high,
+        b.game_agentId,b.login_modeId,b.mz_channel, b.mz_id
       from 
         shuyou_game_target a
         LEFT JOIN shuyou_game_task b ON a.task_id = b.id
@@ -157,7 +162,8 @@ export class TaskShuyouService extends BaseService {
     const targetList = await this.nativeQuery(sql);
     if (_.isEmpty(targetList)) {
       flag.detail = 'shuyou_game_target is null'
-      this.ShuyouTargetFlagService.add(flag)
+      flag.status = 0
+      await this.ShuyouTargetFlagService.add(flag)
       return 'syncTargetAndComplete >>> shuyou_game_target is null >>> ' + updateTime;
     }
     //
@@ -165,7 +171,8 @@ export class TaskShuyouService extends BaseService {
     if (_.isEmpty(data1)) {
       // this.logger.warn('小绵羊后台数据错误')
       flag.detail = '小绵羊后台数据错误'
-      this.ShuyouTargetFlagService.add(flag)
+      flag.status = 0
+      await this.ShuyouTargetFlagService.add(flag)
       return 'syncTargetAndComplete >>> 小绵羊后台数据错误 >>> ' + updateTime;
     }
     let xmyData = JSON.parse(data1 + '')
@@ -179,7 +186,8 @@ export class TaskShuyouService extends BaseService {
     if (_.isEmpty(data2)) {
       // this.logger.warn('老机房后台数据错误')
       flag.detail = '老机房后台数据错误'
-      this.ShuyouTargetFlagService.add(flag)
+      flag.status = 0
+      await this.ShuyouTargetFlagService.add(flag)
       return 'syncTargetAndComplete >>> 老机房后台数据错误 >>> ' + updateTime;
     }
     computerRoomData = JSON.parse(data2 + '')
@@ -188,7 +196,8 @@ export class TaskShuyouService extends BaseService {
     if (_.isEmpty(data3)) {
       // this.logger.warn('新机房后台数据错误')
       flag.detail = '新机房后台数据错误'
-      this.ShuyouTargetFlagService.add(flag)
+      flag.status = 0
+      await this.ShuyouTargetFlagService.add(flag)
       return 'syncTargetAndComplete >>> 新机房后台数据错误 >>> ' + updateTime;
     }
     newComputerRoomData = JSON.parse(data3 + '')
@@ -197,7 +206,8 @@ export class TaskShuyouService extends BaseService {
     if (_.isEmpty(data4)) {
       // this.logger.warn('王淑霖付费目标接口数据错误')
       flag.detail = '王淑霖付费目标接口数据错误'
-      this.ShuyouTargetFlagService.add(flag)
+      flag.status = 0
+      await this.ShuyouTargetFlagService.add(flag)
       return 'syncTargetAndComplete >>> 王淑霖付费目标接口数据错误 >>> ' + updateTime;
     }
     wslData = JSON.parse(data4 + '')
@@ -206,7 +216,8 @@ export class TaskShuyouService extends BaseService {
     if (_.isEmpty(data5)) {
       // this.logger.warn('OldService is run')
       flag.detail = 'OldService is err'
-      this.ShuyouTargetFlagService.add(flag)
+      flag.status = 0
+      await this.ShuyouTargetFlagService.add(flag)
       return 'syncTargetAndComplete >>> OldService is err >>> ' + updateTime;
     }
     let data6 = JSON.parse(data5 + '')
@@ -322,6 +333,49 @@ export class TaskShuyouService extends BaseService {
         }
         amount = (parseInt(e.unit_price_high) + parseInt(e.unit_price_low)) * 0.5 * complete_pay
       }
+      //魅族游戏付费目标处理
+      if (e.game_agentId == 5 && e.login_modeId == 2) {
+        //b.mz_channel, b.mz_id
+        var checkedMz = false
+        for (let wslvalue of wslData) {
+          if (wslvalue.gameid == e.mz_id + '-' + e.mz_channel) {
+            target_pay = wslvalue.money
+            checkedMz = true
+            break;
+          }
+        }
+        // 执行目标查找和修改开始(只修改魅族游戏的付费目标)========================
+        if (checkedMz == true) {
+          let targetObj = {
+            task_id: task_id,
+            task_name: task_name,
+            new_date: new_date,
+            directorId: e.directorId,
+            target_pay: target_pay,
+            updateTime: updateTime
+          }
+          const targetEntity = await this.ShuyouGameTargetEntity.findOne({
+            task_id: task_id,
+            new_date: new_date
+          });
+          // console.log(targetEntity)
+          if (targetEntity) {
+            await this.ShuyouGameTargetEntity
+              .createQueryBuilder()
+              .update()
+              .set(targetObj)
+              .where('task_id = :task_id and new_date = :new_date', {
+                task_id: task_id,
+                new_date: new_date
+              })
+              .execute();
+            // this.logger.warn(updateResult)
+          }
+        }
+        // 执行魅族游戏目标查找和修改结束========================
+      }
+      //======================================================
+
       for (let oldvalue of computerRoomData) {
         if (oldvalue.game_name == task_name || e.xmy_id == oldvalue.game_id_xmy) {
           if (typeof (oldvalue.game_rate_xmy) == "undefined") {
@@ -537,7 +591,7 @@ export class TaskShuyouService extends BaseService {
     // 按负责人查询当前总数据end====================================
     flag.detail = 'syncTargetAndComplete  SUCCESS'
     flag.status = 1
-    this.ShuyouTargetFlagService.add(flag)
+    await this.ShuyouTargetFlagService.add(flag)
     return 'syncTargetAndComplete  SUCCESS>>>' + updateTime;
   }
   /**
@@ -567,6 +621,7 @@ export class TaskShuyouService extends BaseService {
       SELECT 
         a.*,
         b.xmy_id AS xmy_id,b.unit_price_low AS unit_price_low,b.unit_price_high AS unit_price_high,
+        b.game_agentId,b.login_modeId,b.mz_channel, b.mz_id,
         c.name AS directorName
       from 
         shuyou_game_target a
@@ -687,6 +742,18 @@ export class TaskShuyouService extends BaseService {
         amount = (parseInt(e.unit_price_high) + parseInt(e.unit_price_low)) * 0.5 * complete_pay
         // amount = 6 * complete_pay
       }
+      //======================================================
+      //魅族游戏付费目标处理
+      if (e.game_agentId == 5 && e.login_modeId == 2) {
+        //b.mz_channel, b.mz_id
+        for (let wslvalue of wslData) {
+          if (wslvalue.gameid == e.mz_id + '-' + e.mz_channel) {
+            target_pay = wslvalue.money
+            break;
+          }
+        }
+      }
+      //======================================================
       for (let oldvalue of computerRoomData) {
         if (oldvalue.game_id == task_id || oldvalue.game_name == task_name || e.xmy_id == oldvalue.game_id_xmy) {
           if (typeof (oldvalue.game_rate_xmy) == "undefined") {
@@ -1250,7 +1317,7 @@ let queryNewComputerRoom = function (new_date) {
   });
   return pm;
 }
-// 从王淑霖接口获取小绵羊游戏付费目标
+// 从王淑霖接口获取小绵羊游戏付费目标-此接口包含魅族付费目标
 let queryWSL = function (new_date) {
   var url = 'http://148.70.251.170/wsl-A/get_sheep_pay.php?times=' + new_date
   var http = require('http');