From 2a52df9ebb9fa6a215d5d681a8dbe4563e907f3d Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Thu, 20 Aug 2020 11:50:40 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Home/Controller/TestingResourceController.class.php | 2 +-
Application/Home/View/default/Public/promote_base.html | 2 +-
Data/update.sql | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Application/Home/Controller/TestingResourceController.class.php b/Application/Home/Controller/TestingResourceController.class.php
index d7e64dbfc..78f7602c6 100644
--- a/Application/Home/Controller/TestingResourceController.class.php
+++ b/Application/Home/Controller/TestingResourceController.class.php
@@ -489,7 +489,7 @@ class TestingResourceController extends BaseController
$records = I('records', []);
$loginPromote = $this->getLoginPromote();
- if ($loginPromote['level'] != 1) {
+ if ($loginPromote['level'] > 2) {
return $this->ajaxReturn(['status' => 0, 'message' => '权限不足']);
}
diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html
index 5dce11468..b1873c24b 100644
--- a/Application/Home/View/default/Public/promote_base.html
+++ b/Application/Home/View/default/Public/promote_base.html
@@ -112,7 +112,7 @@
操作日志
-
+
测试资源申请
diff --git a/Data/update.sql b/Data/update.sql
index ee9ad0d4a..3d79d2e7f 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -2483,7 +2483,7 @@ CREATE TABLE `tab_testing_resource_batch` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-alter table tab_user_play_info add column `game_role_id` varchar(80) DEFAULT '' COMMENT '角色' after role_level;
-alter table tab_user_play_info add column `testing_other_quota` decimal(12, 2) DEFAULT '0.00' COMMENT '测试资源额外额度' after promote_account;
+alter table tab_user_play_info add column `game_role_id` varchar(80) not null DEFAULT '' COMMENT '游戏角色标识' after role_level;
+alter table tab_user_play_info add column `testing_other_quota` decimal(12, 2) not null DEFAULT '0.00' COMMENT '测试资源额外额度' after promote_account;
update tab_user_play_info set game_role_id = concat(game_id, '#', role_id);
ALTER TABLE `tab_user_play_info` ADD INDEX `index_unique_role`(`game_role_id`);
\ No newline at end of file
From c7390f4c2e2e3efc9ccc95bc9dbb911cce16ea6a Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Thu, 20 Aug 2020 12:33:46 +0800
Subject: [PATCH 02/14] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Controller/GameApiController.class.php | 10 +++++-----
.../Base/Service/TestingResourceService.class.php | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Application/Admin/Controller/GameApiController.class.php b/Application/Admin/Controller/GameApiController.class.php
index e6ba5ef67..7bd30f474 100644
--- a/Application/Admin/Controller/GameApiController.class.php
+++ b/Application/Admin/Controller/GameApiController.class.php
@@ -40,14 +40,14 @@ class GameApiController extends Think {
public function send()
{
$role = [
- 'role_id' => '6810778',
- 'user_account' => 'liaojl1130',
+ 'role_id' => '6819493',
+ 'user_account' => 'qh11102',
'sdk_version' => 1,
];
$order = [
- 'ref_amount' => 100,
- 'ref_id' => '10',
- 'remark' => 'ELF测试资源发放1',
+ 'ref_amount' => '10.00',
+ 'ref_id' => '8',
+ 'remark' => '测试',
'order_no' => date('YmdHis') . rand(1000, 9999) . '_1',
];
$service = new TestingResourceService();
diff --git a/Application/Base/Service/TestingResourceService.class.php b/Application/Base/Service/TestingResourceService.class.php
index 6954af0e6..31db4fd23 100644
--- a/Application/Base/Service/TestingResourceService.class.php
+++ b/Application/Base/Service/TestingResourceService.class.php
@@ -108,11 +108,11 @@ class TestingResourceService
$gameCatClient = new GameCatClient();
$result = $gameCatClient->api('provide', [
'roleId' => $role['role_id'],
- 'amount' => $order['ref_amount'],
+ 'amount' => intval($order['ref_amount']),
'supportItem' => $order['ref_id'],
'supportType' => '0',
'channelUid' => $role['user_account'],
- 'applyRemark' => $order['remark'],
+ 'applyRemark' => $order['remark'] == '' ? '测试资源申请' : $order['remark'],
'applyId' => $order['order_no'],
'device_type' => $role['sdk_version'] == 1 ? 'andriod' : 'ios',
]);
From 404da03cd04e060ec72e1c56ab1b3076296e1c33 Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Thu, 20 Aug 2020 14:22:14 +0800
Subject: [PATCH 03/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Home/Controller/TestingResourceController.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Application/Home/Controller/TestingResourceController.class.php b/Application/Home/Controller/TestingResourceController.class.php
index 78f7602c6..790b1d92c 100644
--- a/Application/Home/Controller/TestingResourceController.class.php
+++ b/Application/Home/Controller/TestingResourceController.class.php
@@ -430,7 +430,7 @@ class TestingResourceController extends BaseController
$totalQuota = $role['testing_other_quota'] + ($this->gameBaseQuota[$role['game_id']] ?? 0);
if (!is_null($bindRole)) {
$totalQuota += M('spend', 'tab_')
- ->where(['game_id' => $role['game_id'], 'game_player_id' => $bindRole['role_id']])
+ ->where(['game_id' => $role['game_id'], 'game_player_id' => $bindRole['role_id'], 'pay_status' => 1])
->group('game_id,game_player_id')
->sum('pay_amount');
}
From b1f4ec2d9ab172980024f62064a1f1d7b4d66eda Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Thu, 20 Aug 2020 14:31:50 +0800
Subject: [PATCH 04/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Home/Controller/TestingResourceController.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Application/Home/Controller/TestingResourceController.class.php b/Application/Home/Controller/TestingResourceController.class.php
index 790b1d92c..c258d711b 100644
--- a/Application/Home/Controller/TestingResourceController.class.php
+++ b/Application/Home/Controller/TestingResourceController.class.php
@@ -167,7 +167,7 @@ class TestingResourceController extends BaseController
'pay_status' => 1,
'_string' => '(' . implode(' or ', $spendOrWhere) . ')',
];
- $spendList = M('spend', 'tab_')->field('sum(pay_amount) amount, game_id, game_player_id')->where($spendOrWhere)->group('game_id,game_player_id')->select();
+ $spendList = M('spend', 'tab_')->field('sum(pay_amount) amount, game_id, game_player_id')->where($spendCondition)->group('game_id,game_player_id')->select();
foreach ($spendList as $item) {
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
}
From 3890410bece87fde01bd6205a04c00d4a65a9b50 Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Thu, 20 Aug 2020 15:43:10 +0800
Subject: [PATCH 05/14] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Home/Controller/DownloadController.class.php | 8 ++++----
Application/Home/Controller/QueryController.class.php | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php
index 08225978b..b81a44233 100644
--- a/Application/Home/Controller/DownloadController.class.php
+++ b/Application/Home/Controller/DownloadController.class.php
@@ -1446,18 +1446,18 @@ class DownloadController extends BaseController {
if (!empty(I('begtime')) && empty(I('endtime'))) {
- $map['tab_spend.pay_time'] = ['egt', strtotime(I('begtime'))];
+ $map['tab_spend.spend_time'] = ['egt', strtotime(I('begtime'))];
} elseif (empty(I('begtime')) && !empty(I('endtime'))) {
- $map['tab_spend.pay_time'] = ['elt', strtotime(I('endtime')) + 86399];
+ $map['tab_spend.spend_time'] = ['elt', strtotime(I('endtime')) + 86399];
} elseif (!empty(I('begtime')) && !empty(I('endtime'))) {
- $map['tab_spend.pay_time'] = ['between', [strtotime(I('begtime')), strtotime(I('endtime')) + 86399]];
+ $map['tab_spend.spend_time'] = ['between', [strtotime(I('begtime')), strtotime(I('endtime')) + 86399]];
}else {
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = date('Y-m-d');
$initBegTime = strtotime($initBegTime);
$initEndTime = strtotime($initEndTime);
- $map['tab_spend.pay_time'] = ['between',[$initBegTime,$initEndTime]];
+ $map['tab_spend.spend_time'] = ['between',[$initBegTime,$initEndTime]];
}
empty(I('relation_game_id')) || $map['tab_game.relation_game_id'] = I('relation_game_id');
diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php
index 3ff0f0ce2..5ce3deb40 100644
--- a/Application/Home/Controller/QueryController.class.php
+++ b/Application/Home/Controller/QueryController.class.php
@@ -99,7 +99,7 @@ class QueryController extends BaseController
$map['tab_spend.pay_status'] = $payStatus;
}
}
- $map['tab_spend.pay_time'] = ['between', [$begTime, $endTime - 1]];
+ $map['tab_spend.spend_time'] = ['between', [$begTime, $endTime - 1]];
$data = [];
$count = 0;
From 62b566e8b8a571cfc635f8c48a43e738efac7102 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Thu, 20 Aug 2020 18:31:20 +0800
Subject: [PATCH 06/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9C=B0=E5=9D=80?=
=?UTF-8?q?=E5=A1=AB=E5=86=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Controller/FinancialSummaryController.class.php | 2 +-
Application/Admin/Model/CmdTasksModel.class.php | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php
index 7fcb028c0..4dd97fdc8 100644
--- a/Application/Admin/Controller/FinancialSummaryController.class.php
+++ b/Application/Admin/Controller/FinancialSummaryController.class.php
@@ -43,7 +43,7 @@ class FinancialSummaryController extends AdminController
public function updateStatement()
{
$temp = date('Y',time()).'-'.(date('m',time())-1);
- $params = "cd ".ROOTTTTT.";php admin.php FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
+ $params = "php admin.php FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
$r = D("CmdTasks")->addTask("FinancialSummary",$params);
if($r){
$this->ajaxReturn(["success"=>"ok"]);
diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php
index c85f59722..8e9d47b19 100644
--- a/Application/Admin/Model/CmdTasksModel.class.php
+++ b/Application/Admin/Model/CmdTasksModel.class.php
@@ -41,12 +41,15 @@ class CmdTasksModel extends Model{
}
}
//插入任务
- public function addTask($type,$params,$need_tasksid = true)
+ public function addTask($type,$params,$need_tasksid = true,$need_path=true)
{
$task = $this->field("end_time")->where(['status'=>"1",'type'=>$type])->order("id desc")->find();
if(!empty($task)){
return false;
}
+ if($need_path){
+ $params = "cd ".ROOTTTTT.";".$params;
+ }
if($need_tasksid){
$params = rtrim($params,";").'/taskid/{$taskid};';
}
From 8b82fff791e59e9a21cae865683693cdd063b02f Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Thu, 20 Aug 2020 18:33:27 +0800
Subject: [PATCH 07/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1?=
=?UTF-8?q?=E6=8F=92=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Admin/Model/CmdTasksModel.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php
index 8e9d47b19..ace3a88d2 100644
--- a/Application/Admin/Model/CmdTasksModel.class.php
+++ b/Application/Admin/Model/CmdTasksModel.class.php
@@ -43,7 +43,7 @@ class CmdTasksModel extends Model{
//插入任务
public function addTask($type,$params,$need_tasksid = true,$need_path=true)
{
- $task = $this->field("end_time")->where(['status'=>"1",'type'=>$type])->order("id desc")->find();
+ $task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find();
if(!empty($task)){
return false;
}
From 6e49bcc3538b2dc1d85a8d0680b58512679f84a4 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Fri, 21 Aug 2020 09:56:35 +0800
Subject: [PATCH 08/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B4=A2=E5=8A=A1?=
=?UTF-8?q?=E6=B1=87=E6=80=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/View/FinancialSummary/index.html | 149 +-----------------
1 file changed, 2 insertions(+), 147 deletions(-)
diff --git a/Application/Admin/View/FinancialSummary/index.html b/Application/Admin/View/FinancialSummary/index.html
index 93d095469..ea49c1fc8 100644
--- a/Application/Admin/View/FinancialSummary/index.html
+++ b/Application/Admin/View/FinancialSummary/index.html
@@ -294,7 +294,7 @@
if(data.success){
layer.alert('添加重算任务成功,请2分钟后刷新查看');
}else{
- layer.alert('添加任务失败,已有重算任务。请上个重算任务完成');
+ layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成');
}
},
error:function(){
@@ -304,54 +304,7 @@
});
});
})
- $(".paixu").click(function () {
- var that = $(this);
- $data_order = that.attr('data-order');
- $order_type = '{$userarpu_order}';
- if ($order_type == '' || $order_type == '4') {
- $(".sortBy").attr('name', 'data_order');
- val = '3,' + $data_order;
- $(".sortBy").attr('value', val);
- $("#search").click();
- } else if ($order_type == '3') {
- $(".sortBy").attr('name', 'data_order');
- val = '4,' + $data_order;
- $(".sortBy").attr('value', val);
- $("#search").click();
- }
- });
-
- $('.jssamlllist').click(function () {
- var that = $(this), url = that.attr('data-url');
- var url =
- layer.open({
- type: 2,
- title: "【" + that.attr('data-account') + "】小号列表",
- shadeClose: true,
- shade: 0.8,
- area: ['1062px', '80%'],
- content: url,//iframe的url
- });
-
- return false;
- });
-
- $(".paixu").click(function () {
- var val = $(this).attr('data-order');
- if (val == 1) {
- val = 2;
- } else if (val == 2) {
- val = 1;
- }
- var name = $(this).attr('name');
- if (name == 'balance_status') {
- $('#key').val(1);
- } else {
- $('#key').val(2);
- }
- $("#" + name).val(val);
- $("#search").click();
- });
+
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
@@ -359,105 +312,7 @@
}
});
- $("#total_status").click(function () {
- $("#search").click();
- })
-
-
- $('#time_start').datetimepicker({
- format: 'yyyy-mm-dd',
- language: "zh-CN",
- minView: 2,
- autoclose: true
- });
-
- $('#datetimepicker').datetimepicker({
- format: 'yyyy-mm-dd',
- language: "zh-CN",
- minView: 2,
- autoclose: true,
- pickerPosition: 'bottom-left'
- })
-
- var promote_id = "{:I('promote_id')}";
- var company_id = "{:I('company_id')}";
- function getPromotersByCompanyid() {
- var company_id = $("#company_id option:selected").val();
- if(!company_id){
- company_id = -1;
- }
- $.ajax({
- url: "{:U('Ajax/getPromotersByCompanyid')}",
- type: "get",
- data: { company_id:company_id},
- dataType: 'json',
- success: function (response) {
- str = '';
- if(company_id == 0 || company_id ==-1){
- str +='';
- }
- data = response.data;
- for (var i in data) {
- str += ""
- }
- $("#promote_id").empty();
- $("#promote_id").append(str);
- $("#promote_id").select2();
- }
- })
- }
- getPromotersByCompanyid();
-
- $("#company_id").change(function(){
- getPromotersByCompanyid();
- })
})
-
-
- function shenhe(status) {
- var text = $("input:checkbox[name='ids[]']:checked").map(function (index, elem) {
- return $(elem).val();
- }).get().join("\n");
- var desc = '';
- if (status == 0) {
- desc = '锁定';
- } else {
- desc = '开启';
- }
- layer.prompt({
- formType: 2,
- value: text,
- placeholder: '玩家账号(一个账号一行)',
- title: '请输入要' + desc + '的玩家账号(一个账号一行)',
- area: ['800px', '350px'] //自定义文本域宽高
- }, function (value, index, elem) {
- if (value == '') {
- layer.msg("请输入账户ID");
- return;
- }
-
- $.ajax({
- cache: true,
- type: "POST",
- url: "{:U('Member/lock_status')}",
- data: { accounts: value, lock_status: status },// 你的formid
- async: false,
- error: function (data) {
- layer.alert("服务器故障,请稍后重试!", { icon: 2 });
- },
- success: function (data) {
- // var obj = JSON.parse(data);
- // layer.alert(obj.info,{icon:obj.status})
- layer.alert(data.info, { icon: data.status })
- window.location.reload()
- }
- });
- layer.close(index);
- });
- }
-
-
-
\ No newline at end of file
From b88f2986bd0d8e22ae497ecaa4aeb94ff1501d00 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Fri, 21 Aug 2020 10:30:43 +0800
Subject: [PATCH 09/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=87=8D=E7=AE=97?=
=?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B9wind?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/CmdTasksController.class.php | 2 +-
.../CompanyStatementSetController.class.php | 20 +++++++++----------
.../Admin/Model/CmdTasksModel.class.php | 7 ++++++-
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/Application/Admin/Controller/CmdTasksController.class.php b/Application/Admin/Controller/CmdTasksController.class.php
index ef64100e7..f8ab13fdc 100644
--- a/Application/Admin/Controller/CmdTasksController.class.php
+++ b/Application/Admin/Controller/CmdTasksController.class.php
@@ -20,7 +20,7 @@ class CmdTasksController extends Controller {
$cmd = $params['params'];
$cmd = str_replace('{$taskid}',$taskid,$cmd);
try {
- system($cmd);
+ exec($cmd);
} catch (\Exception $e) {
D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 3, 'end_time' => time(), 'result' => $e->getMessage()]);
}
diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php
index 2a67d37c8..8baa03e63 100644
--- a/Application/Admin/Controller/CompanyStatementSetController.class.php
+++ b/Application/Admin/Controller/CompanyStatementSetController.class.php
@@ -537,16 +537,16 @@ class CompanyStatementSetController extends Controller {
$pc =[];
$Promote = M("Promote","tab_");
foreach ($tmpp as $v) {
- //获取会长的支付宝账号
- $p_map = [
- "company_id"=>$v['id'],
- "withdraw_done"=>1
- ];
- $pres = $Promote->field("alipay_account,alipay_real_name")->where($p_map)->find();
- if(!empty($pres) && !empty($pres['alipay_account']) && !empty($pres['alipay_real_name'])){
- $v['ali_user'] = $pres['alipay_real_name'];
- $v['ali_account'] = $pres['alipay_account'];
- }
+ // //获取会长的支付宝账号
+ // $p_map = [
+ // "company_id"=>$v['id'],
+ // "withdraw_done"=>1
+ // ];
+ // $pres = $Promote->field("alipay_account,alipay_real_name")->where($p_map)->find();
+ // if(!empty($pres) && !empty($pres['alipay_account']) && !empty($pres['alipay_real_name'])){
+ // $v['ali_user'] = $pres['alipay_real_name'];
+ // $v['ali_account'] = $pres['alipay_account'];
+ // }
if($v['has_ratio']){
$v['turnover_ratio'] = json_decode($v['turnover_ratio'],true);
}
diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php
index ace3a88d2..ccf7bc0cd 100644
--- a/Application/Admin/Model/CmdTasksModel.class.php
+++ b/Application/Admin/Model/CmdTasksModel.class.php
@@ -48,7 +48,12 @@ class CmdTasksModel extends Model{
return false;
}
if($need_path){
- $params = "cd ".ROOTTTTT.";".$params;
+ if(IS_WIN){
+ $p = explode(':',ROOTTTTT);
+ $params = "{$p[0]}:&".'cd "'.$p[1].'"&'.$params;
+ }else{
+ $params = "cd ".ROOTTTTT.";".$params;
+ }
}
if($need_tasksid){
$params = rtrim($params,";").'/taskid/{$taskid};';
From 4f70b8906325cce4be549b481ce7e97c1af7e007 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Fri, 21 Aug 2020 11:24:30 +0800
Subject: [PATCH 10/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/CmdTasksController.class.php | 10 +++++-----
.../FinancialSummarySetController.class.php | 16 ++--------------
Application/Admin/Model/CmdTasksModel.class.php | 8 +++-----
3 files changed, 10 insertions(+), 24 deletions(-)
diff --git a/Application/Admin/Controller/CmdTasksController.class.php b/Application/Admin/Controller/CmdTasksController.class.php
index f8ab13fdc..e29cab07c 100644
--- a/Application/Admin/Controller/CmdTasksController.class.php
+++ b/Application/Admin/Controller/CmdTasksController.class.php
@@ -2,6 +2,7 @@
namespace Admin\Controller;
use Think\Controller;
+use Think\Exception;
/**
* 系统任务接口
@@ -16,12 +17,11 @@ class CmdTasksController extends Controller {
if(!$params){
echo('暂无任务');
}
- $taskid = $params['id'];
- $cmd = $params['params'];
- $cmd = str_replace('{$taskid}',$taskid,$cmd);
try {
- exec($cmd);
- } catch (\Exception $e) {
+ exec($params['params'], $resArr, $status);
+ $result = json_encode($resArr,JSON_UNESCAPED_UNICODE);
+ D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 2, 'end_time' => time(), 'result' => $result]);
+ } catch (Exception $e) {
D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 3, 'end_time' => time(), 'result' => $e->getMessage()]);
}
}
diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php
index eb3894b23..739dc1299 100644
--- a/Application/Admin/Controller/FinancialSummarySetController.class.php
+++ b/Application/Admin/Controller/FinancialSummarySetController.class.php
@@ -1,5 +1,6 @@
GameSupersignModel = M("GameSupersign",'tab_');
$this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表
$this->TestOrderModel = M("TestOrder",'tab_');//测试订单录入
-
- $taskid = I("taskid");
- if(!empty($taskid)){
- $this->taskid = $taskid;
- }
-
}
/**
* 更新某月数据
@@ -63,9 +58,6 @@ class FinancialSummarySetController extends \Think\Controller
$this->reCount();
$this->setFinancialSummary();
- if($this->taskid){
- D("CmdTasks")->updateTask(['id'=>$this->taskid,'status'=>2,'end_time' => time(), 'result' =>$this->result]);
- }
}
/**
* 强制重新聚合
@@ -95,11 +87,7 @@ class FinancialSummarySetController extends \Think\Controller
//判断是否已经聚合
$countRes = $this->FinancialSummaryModel->field("IFNULL(COUNT(*),0) count")->where("count_year = '{$this->year}' and count_month= '{$this->month}'")->find()['count'];
if($countRes > 0){
- if($this->taskid){
- throw new \Exception("error:Repeated statistics,msg:{$this->date}已经聚合过");
- }else{
- die("error:Repeated statistics,msg:{$this->date}已经聚合过");
- }
+ die("error:Repeated statistics,msg:{$this->date}已经聚合过");
}
echo "{$this->date}开始统计".PHP_EOL;
echo "--收入类型统计中".PHP_EOL;
diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php
index ccf7bc0cd..c923c197b 100644
--- a/Application/Admin/Model/CmdTasksModel.class.php
+++ b/Application/Admin/Model/CmdTasksModel.class.php
@@ -37,11 +37,11 @@ class CmdTasksModel extends Model{
if(empty($task)){
return false;
}else{
- return date("Y-d-m H:i:s",$task['end_time']);
+ return date("Y-m-d H:i:s",$task['end_time']);
}
}
//插入任务
- public function addTask($type,$params,$need_tasksid = true,$need_path=true)
+ public function addTask($type,$params,$need_path=true)
{
$task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find();
if(!empty($task)){
@@ -55,9 +55,7 @@ class CmdTasksModel extends Model{
$params = "cd ".ROOTTTTT.";".$params;
}
}
- if($need_tasksid){
- $params = rtrim($params,";").'/taskid/{$taskid};';
- }
+ $params = rtrim($params,";").' 2>&1';
$save = [
"uid"=>$_SESSION['onethink_admin']['user_auth']['uid'],
"created_time"=>time(),
From 8e2f07db38e03bbce3260e2e504fd35166839e94 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Fri, 21 Aug 2020 13:54:36 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=B3=A8=E9=87=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Application/Admin/Controller/CmdTasksController.class.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/Application/Admin/Controller/CmdTasksController.class.php b/Application/Admin/Controller/CmdTasksController.class.php
index e29cab07c..6381686de 100644
--- a/Application/Admin/Controller/CmdTasksController.class.php
+++ b/Application/Admin/Controller/CmdTasksController.class.php
@@ -7,7 +7,6 @@ use Think\Exception;
/**
* 系统任务接口
* @author cz
- * TODO: 罚款的游戏没有流水不统计,补点为0 无法重算
*/
class CmdTasksController extends Controller {
From f5fb65e400bfdfd5d491923b12cda9e107940450 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Fri, 21 Aug 2020 17:06:26 +0800
Subject: [PATCH 12/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E5=85=AC=E5=8F=B8=E6=B8=B8=E6=88=8F=E6=AF=94=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CompanyStatementSetController.class.php | 89 ++++++++++++++++++-
1 file changed, 87 insertions(+), 2 deletions(-)
diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php
index 8baa03e63..abdceb971 100644
--- a/Application/Admin/Controller/CompanyStatementSetController.class.php
+++ b/Application/Admin/Controller/CompanyStatementSetController.class.php
@@ -1261,8 +1261,6 @@ class CompanyStatementSetController extends Controller {
}
/**
* 获取公司奖罚
- * @param [type] $paymount 支付金额
- * @param [type] $turnover_ratio 梯度
*/
protected function getPromoteUserRewardRecord($cpmpamy_id,$begintime,$endtime)
{
@@ -1286,7 +1284,94 @@ class CompanyStatementSetController extends Controller {
}else{
$rfres;
}
+ }
+ public function getPromoteCompanyGameRatio($company_id,$game_ids,$begintime,$endtime,$company_belong=false){
+ //获取默认比例
+ if($company_belong === false){
+ $company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
+ }
+
+ $mwhere = [
+ "company_belong"=>$company_belong,
+ "relation_game_id"=>["in",$game_ids]
+ ];
+ $m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
+ $modul_ratio = [];
+ for ($i=0; $i < count($m_res); $i++) {
+ $modul_ratio[$m_res[$i]['relation_game_id']] = $m_res[$i];
+ }
+ unset($m_res);
+ //设置默认
+ $game_ratio = [];
+ $tmp_g = explode(",",$game_ids);
+ for ($i=0; $i < count($tmp_g); $i++) {
+ $game_ratio[$tmp_g[$i]] = [
+ ["begintime"=>$begintime,"endtime"=>$endtime]
+ ];
+ }
+ $map = [
+ "company_id"=>$company_id,
+ "relation_game_id"=>['in',$game_ids],
+ "_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
+ ];
+ $res = M("company_game_ratio","tab_")->where($map)->order("begin_time asc")->select();
+ foreach($res as $k=>$v){
+ //获取最后一个数据
+ $tgr = &$game_ratio[$v['relation_game_id']];
+ $last_time_ratio = end($game_ratio[$v['relation_game_id']]);
+ if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
+ //全段
+ if($v['begin_time'] <= $last_time_ratio['begintime']){
+ $tgr[count($tgr)-1]['ratio'] = $v['ratio'];
+ $tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
+ continue;
+ }else{
+ //上分段
+ $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
+ $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
+ continue;
+ }
+ }
+ if($v['end_time'] < $last_time_ratio['endtime']){
+ if($last_time_ratio['begintime'] < $v['begin_time']){
+ //中段
+ $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
+
+ $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
+ $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
+ continue;
+ }
+ if($last_time_ratio['begintime'] > $v['begin_time']){
+ //下分段
+ $tgr[count($tgr)-1]['endtime'] = $v['end_time'];
+ $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
+ continue;
+ }
+ if($last_time_ratio['begintime'] = $v['begin_time']){
+ $tgr[count($tgr)-1]['endtime'] = $v['end_time'];
+ $tgr[count($tgr)-1]['ratio'] = $v['ratio'];
+ $tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
+
+ $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
+ }
+ }
+ }
+ //模板填充
+ foreach($game_ratio as $k=>&$list){
+ foreach($list as $i => &$ratio){
+ if(!isset($ratio['ratio'])){
+ if(isset($modul_ratio[$k]['ratio'])){
+ $ratio['ratio'] = $modul_ratio[$k]['ratio'];
+ $ratio['turnover_ratio'] = $modul_ratio[$k]['turnover_ratio'];
+ }else{
+ $ratio['ratio'] = 0;
+ $ratio['turnover_ratio'] =null;
+ }
+ }
+ }
+ }
+ return $game_ratio;
}
/**
From 492d7a8f737ea29ab8c99a647b4a08aeeeafa465 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Fri, 21 Aug 2020 17:07:57 +0800
Subject: [PATCH 13/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E6=AF=94=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CompanyStatementSetController.class.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php
index abdceb971..284ea2a78 100644
--- a/Application/Admin/Controller/CompanyStatementSetController.class.php
+++ b/Application/Admin/Controller/CompanyStatementSetController.class.php
@@ -1285,7 +1285,17 @@ class CompanyStatementSetController extends Controller {
$rfres;
}
}
- public function getPromoteCompanyGameRatio($company_id,$game_ids,$begintime,$endtime,$company_belong=false){
+ /**
+ * 按公司获取游戏分成比例
+ *
+ * @param [type] $company_id 公司id
+ * @param [type] $game_ids 游戏关联id
+ * @param [type] $begintime 开始时间
+ * @param [type] $endtime 结束时间
+ * @param boolean $company_belong 公司内外团
+ * @return void
+ */
+ protected function getPromoteCompanyGameRatio($company_id,$game_ids,$begintime,$endtime,$company_belong=false){
//获取默认比例
if($company_belong === false){
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
From ff19f3259f8dce4181dc164efef40f41f3462327 Mon Sep 17 00:00:00 2001
From: chenzhi
Date: Fri, 21 Aug 2020 20:04:28 +0800
Subject: [PATCH 14/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E6=B8=B8?=
=?UTF-8?q?=E5=85=AC=E5=8F=B8=E5=A4=9A=E6=AF=94=E4=BE=8B=E7=BB=93=E7=AE=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CompanyStatementSetController.class.php | 248 +++++++++---------
.../Model/CompanyGameRatioModel.class.php | 109 ++++++++
Application/Admin/Model/GameModel.class.php | 4 +-
3 files changed, 235 insertions(+), 126 deletions(-)
create mode 100644 Application/Admin/Model/CompanyGameRatioModel.class.php
diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php
index 284ea2a78..3773c5c1c 100644
--- a/Application/Admin/Controller/CompanyStatementSetController.class.php
+++ b/Application/Admin/Controller/CompanyStatementSetController.class.php
@@ -562,7 +562,9 @@ class CompanyStatementSetController extends Controller {
}
unset($tmpp);
unset($js_id);
- $this->getPromoteCompanySpend($pcList,array_unique(array_keys($pcList)),$begintime,$endtime);
+ $this->getPromoteCompanySpend($pcList,array_unique(array_keys($pcList)),$begintime,$endtime);
+
+
//数据整合
$verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]);
$StatementDb = M("CompanyStatement","tab_");
@@ -614,43 +616,85 @@ class CompanyStatementSetController extends Controller {
$company_belong = $pc[$add_data['company_id']]['company_belong'];
$add_data['company_belong']=$company_belong;
$add_data['company_type']=$pc[$add_data['company_id']]['company_type'];
- if(!isset($v['list'])){continue;}
- //游戏统计
- foreach($v['list'] as $ke=>$va){
+
+ if(!isset($v['game_list'])){continue;}
+ //获取多段比例
+ $game_ratio_list = D("CompanyGameRatio")->getPromoteCompanyGameRatio($add_data['company_id'],$v['game_ids'],$begintime,$endtime,$company_belong);
+ foreach ($game_ratio_list as $t_game_id => $t_game_ratio) {
$game =[];
- $game['pay_amount'] =$va['pay_amount'];
- $game['game_name'] =$va['game_name'];
- //获取比例
- $game['relation_game_id']=$va['relation_game_id'];
- if($type == 1){
- $tratio = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],true,$company_belong);
- $tratio += $company_ratio;
- }elseif($type == 0){
- $tratio = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],false,$company_belong);
- }else{
- //补点
- $tratio1 = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],true,$company_belong);;
- $tratio2 = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],false,$company_belong);
- $tratio = $tratio1-$tratio2+$company_ratio;
- if($tratio <= 0){ continue;}
- }
- $tratio = $tratio-0;
- if($v['type'] == 2){
- $game['increment_ratio']=$tratio;
- }else{
- $game['ratio']=$tratio;
- }
- $add_data['pay_amount'] += $va['pay_amount'];
+ $game['game_name'] =$v['game_list'][$t_game_id]['game_name'];
+ $game['relation_game_id'] =$v['game_list'][$t_game_id]['relation_game_id'];
+ $game_all_payment = $v['game_list'][$t_game_id]['pay_amount'];
+
+ // dump($tratio);
+ $game['fax_ratio']=$fax_ratio-0;
+
+ $game['statement_type']=0;
- $game['sum_money']=round($va['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
- $add_data['statement_money'] += $game['sum_money'];
+ if(count($t_game_ratio) == 1){
+ $tmp_game_ratio = $t_game_ratio[0];
+ $game['pay_amount'] =$game_all_payment;
+ $game['pay_amount'] -=0;
+
+ $game['statement_begin_time']=$statement_begin_time;
+ $game['statement_end_time']=$statement_end_time;
+ $add_data['pay_amount'] += $game['pay_amount'];
- $game['fax_ratio']=$fax_ratio;
+ if($type == 1){
+ $tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
+ $tratio += $company_ratio;
+ }elseif($type == 0){
+ $tratio = $t_game_ratio['ratio'];
+ }else{
+ //补点
+ $tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
+ $tratio2 =$tmp_game_ratio['ratio'];
+ $tratio = $tratio1-$tratio2+$company_ratio;
+ if($tratio <= 0){ continue;}
+ }
+ if($v['type'] == 2){
+ $game['increment_ratio']=$tratio;
+ }else{
+ $game['ratio']=$tratio;
+ }
- $game['statement_begin_time']=$statement_begin_time;
- $game['statement_end_time']=$statement_end_time;
- $game['statement_type']=0;
- $add_data['statement_info'][] = $game;
+ $game['sum_money']=round($game['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
+ $add_data['statement_money'] += $game['sum_money'];
+ $add_data['statement_info'][] = $game;
+ }else{
+ // dd($t_game_ratio);
+ for ($i=0; $i < count($t_game_ratio); $i++) {
+ $tmp_game_ratio = $t_game_ratio[$i];
+ $temp_game = $game;
+ $temp_game['statement_begin_time']=date("Y.m.d",$tmp_game_ratio['begintime']);
+ $temp_game['statement_end_time']=date("Y.m.d",$tmp_game_ratio['endtime']);
+ // dd($t_game_id);
+ $temp_game['pay_amount'] =$this->getRelationGameIdSpend($add_data['company_id'],$t_game_id,$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']);
+ $temp_game['pay_amount'] -=0;
+ $add_data['pay_amount'] += $temp_game['pay_amount'];
+
+ if($type == 1){
+ $tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
+ $tratio += $company_ratio;
+ }elseif($type == 0){
+ $tratio = $t_game_ratio['ratio'];
+ }else{
+ //补点
+ $tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
+ $tratio2 =$tmp_game_ratio['ratio'];
+ $tratio = $tratio1-$tratio2+$company_ratio;
+ if($tratio <= 0){ continue;}
+ }
+ if($v['type'] == 2){
+ $temp_game['increment_ratio']=$tratio;
+ }else{
+ $temp_game['ratio']=$tratio;
+ }
+ $temp_game['sum_money']=round($temp_game['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
+ $add_data['statement_money'] += $temp_game['sum_money'];
+ $add_data['statement_info'][] = $temp_game;
+ }
+ }
}
$add_data['platform_amount'] = $add_data['pay_amount'];
if($type < 2){
@@ -789,9 +833,10 @@ class CompanyStatementSetController extends Controller {
foreach($res as $k=>$v){
$pcList[$k]["pay_amount"] = $v['pay_amount'];
unset($v['pay_amount']);
- $pcList[$k]['list'] = $v;
-
+ $pcList[$k]['game_list'] = $v;
+ $pcList[$k]['game_ids'] = implode(",",array_keys($pcList[$k]['game_list']));
}
+
}
//获取推广公司推广金额
protected function getPuPromoteSpend(&$pcList,$idarr,$begintime,$endtime){
@@ -980,7 +1025,6 @@ class CompanyStatementSetController extends Controller {
$pc[$v['id']]['is_payment']=$pcList[$v['id']]['is_payment'];
}
unset($tmpp);
- // $this->getPromoteCompanySpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
$this->getPuPromoteSpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
@@ -1286,102 +1330,58 @@ class CompanyStatementSetController extends Controller {
}
}
/**
- * 按公司获取游戏分成比例
+ * 获取比例
*
- * @param [type] $company_id 公司id
- * @param [type] $game_ids 游戏关联id
- * @param [type] $begintime 开始时间
- * @param [type] $endtime 结束时间
- * @param boolean $company_belong 公司内外团
+ * @param [type] $amount 总额
+ * @param [type] $ratio 默认比例
+ * @param [type] $turnover_ratio 比例梯度
* @return void
*/
- protected function getPromoteCompanyGameRatio($company_id,$game_ids,$begintime,$endtime,$company_belong=false){
- //获取默认比例
- if($company_belong === false){
- $company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
- }
-
- $mwhere = [
- "company_belong"=>$company_belong,
- "relation_game_id"=>["in",$game_ids]
- ];
- $m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
- $modul_ratio = [];
- for ($i=0; $i < count($m_res); $i++) {
- $modul_ratio[$m_res[$i]['relation_game_id']] = $m_res[$i];
+ protected function getTurnoverRatio($amount,$ratio,$turnover_ratio)
+ {
+ if(empty($turnover_ratio)){
+ return $ratio;
}
- unset($m_res);
- //设置默认
- $game_ratio = [];
- $tmp_g = explode(",",$game_ids);
- for ($i=0; $i < count($tmp_g); $i++) {
- $game_ratio[$tmp_g[$i]] = [
- ["begintime"=>$begintime,"endtime"=>$endtime]
- ];
+ if(!is_array($turnover_ratio)){
+ $turnover_ratio = json_decode($turnover_ratio,true);
}
- $map = [
- "company_id"=>$company_id,
- "relation_game_id"=>['in',$game_ids],
- "_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
- ];
- $res = M("company_game_ratio","tab_")->where($map)->order("begin_time asc")->select();
- foreach($res as $k=>$v){
- //获取最后一个数据
- $tgr = &$game_ratio[$v['relation_game_id']];
- $last_time_ratio = end($game_ratio[$v['relation_game_id']]);
- if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
- //全段
- if($v['begin_time'] <= $last_time_ratio['begintime']){
- $tgr[count($tgr)-1]['ratio'] = $v['ratio'];
- $tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
- continue;
- }else{
- //上分段
- $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
- $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
- continue;
- }
- }
- if($v['end_time'] < $last_time_ratio['endtime']){
- if($last_time_ratio['begintime'] < $v['begin_time']){
- //中段
- $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
-
- $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
-
- $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
- continue;
+ foreach($turnover_ratio as $k=>$v){
+ if($v['instanceof'] == 1){
+ if($amount >= $v['turnover']){
+ $ratio = $v['ratio'];
}
- if($last_time_ratio['begintime'] > $v['begin_time']){
- //下分段
- $tgr[count($tgr)-1]['endtime'] = $v['end_time'];
- $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
- continue;
- }
- if($last_time_ratio['begintime'] = $v['begin_time']){
- $tgr[count($tgr)-1]['endtime'] = $v['end_time'];
- $tgr[count($tgr)-1]['ratio'] = $v['ratio'];
- $tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
-
- $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
- }
- }
- }
- //模板填充
- foreach($game_ratio as $k=>&$list){
- foreach($list as $i => &$ratio){
- if(!isset($ratio['ratio'])){
- if(isset($modul_ratio[$k]['ratio'])){
- $ratio['ratio'] = $modul_ratio[$k]['ratio'];
- $ratio['turnover_ratio'] = $modul_ratio[$k]['turnover_ratio'];
- }else{
- $ratio['ratio'] = 0;
- $ratio['turnover_ratio'] =null;
- }
+ }else{
+ if($amount > $v['turnover']){
+ $ratio = $v['ratio'];
}
}
}
- return $game_ratio;
+ return $ratio;
+ }
+
+ protected function getRelationGameIdSpend($company_id,$relation_game_id,$begintime,$endtime)
+ {
+ $res = [];
+ //获取推广员
+ $Promote = M("Promote","tab_");
+ $Spend = M("Spend","tab_");
+ $spenMap = [
+ "s.pay_status"=>1,
+ "s.payed_time"=>['between', [$begintime,$endtime]],
+ ];
+
+ $company_id = $company_id;
+ $pres = $Promote->field("group_concat(id) ids,count(id) count")->where("company_id = '{$company_id}'")->group("company_id")->find();
+ if($pres['count'] ==0 ){return 0;}
+ $spenMap['s.promote_id']=["in",$pres['ids']];
+ //游戏
+
+ $game_id = D("Game")->changeRelationGameidToGameid($relation_game_id);
+ // dd($game_id);
+ $spenMap['s.game_id'] =['in',$game_id];
+ //获取支付记录
+ $pay_amount = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount')->where($spenMap)->find();
+ return $pay_amount['pay_amount'] ?? 0;
}
/**
diff --git a/Application/Admin/Model/CompanyGameRatioModel.class.php b/Application/Admin/Model/CompanyGameRatioModel.class.php
new file mode 100644
index 000000000..f2ebb4f1f
--- /dev/null
+++ b/Application/Admin/Model/CompanyGameRatioModel.class.php
@@ -0,0 +1,109 @@
+field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
+ }
+
+ $mwhere = [
+ "company_belong"=>$company_belong,
+ "relation_game_id"=>["in",$game_ids]
+ ];
+ $m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
+ $modul_ratio = [];
+ for ($i=0; $i < count($m_res); $i++) {
+ $modul_ratio[$m_res[$i]['relation_game_id']] = $m_res[$i];
+ }
+ unset($m_res);
+ //设置默认
+ $game_ratio = [];
+ $tmp_g = explode(",",$game_ids);
+ for ($i=0; $i < count($tmp_g); $i++) {
+ $game_ratio[$tmp_g[$i]] = [
+ ["begintime"=>$begintime,"endtime"=>$endtime]
+ ];
+ }
+ $map = [
+ "company_id"=>$company_id,
+ "relation_game_id"=>['in',$game_ids],
+ "_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
+ ];
+ $res = $this->where($map)->order("begin_time asc")->select();
+ foreach($res as $k=>$v){
+ //获取最后一个数据
+ $tgr = &$game_ratio[$v['relation_game_id']];
+ $last_time_ratio = end($game_ratio[$v['relation_game_id']]);
+ if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
+ //全段
+ if($v['begin_time'] <= $last_time_ratio['begintime']){
+ $tgr[count($tgr)-1]['ratio'] = $v['ratio'];
+ $tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
+ continue;
+ }else{
+ //上分段
+ $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
+ $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
+ continue;
+ }
+ }
+ if($v['end_time'] < $last_time_ratio['endtime']){
+ if($last_time_ratio['begintime'] < $v['begin_time']){
+ //中段
+ $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
+
+ $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
+
+ $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
+ continue;
+ }
+ if($last_time_ratio['begintime'] > $v['begin_time']){
+ //下分段
+ $tgr[count($tgr)-1]['endtime'] = $v['end_time'];
+ $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
+ continue;
+ }
+ if($last_time_ratio['begintime'] = $v['begin_time']){
+ $tgr[count($tgr)-1]['endtime'] = $v['end_time'];
+ $tgr[count($tgr)-1]['ratio'] = $v['ratio'];
+ $tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
+
+ $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
+ }
+ }
+ }
+ //模板填充
+ foreach($game_ratio as $k=>&$list){
+ foreach($list as $i => &$ratio){
+ if(!isset($ratio['ratio'])){
+ if(isset($modul_ratio[$k]['ratio'])){
+ $ratio['ratio'] = $modul_ratio[$k]['ratio'];
+ $ratio['turnover_ratio'] = $modul_ratio[$k]['turnover_ratio'];
+ }else{
+ $ratio['ratio'] = 0;
+ $ratio['turnover_ratio'] =null;
+ }
+ }
+ }
+ }
+ return $game_ratio;
+ }
+}
\ No newline at end of file
diff --git a/Application/Admin/Model/GameModel.class.php b/Application/Admin/Model/GameModel.class.php
index fdaee470c..545a2c22e 100644
--- a/Application/Admin/Model/GameModel.class.php
+++ b/Application/Admin/Model/GameModel.class.php
@@ -462,7 +462,7 @@ class GameModel extends Model{
*/
public function changeRelationGameidToGameid($ids,$type=false)
{
- $rid = $this->field('id')->where(["relation_game_id"=>["in",$ids]])->select();
+ $rid = $this->field('id')->where("relation_game_id in ({$ids})")->select();
if($type){
return array_column($rid,'id');
}else{
@@ -479,7 +479,7 @@ class GameModel extends Model{
*/
public function changeGameidToRelationGameid($ids,$type=false)
{
- $rid = $this->field('relation_game_id')->where(["id"=>["in",$ids]])->group("relation_game_id")->select();
+ $rid = $this->field('relation_game_id')->where("id in ({$ids})")->group("relation_game_id")->select();
if($type){
return array_column($rid,'relation_game_id');
}else{