diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 3d5f54ea1..b34b5a9e7 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -122,9 +122,10 @@ class MarketPercentageController extends ThinkController // var_dump($map);die(); $data = SM("settleup_marketorder", "tab_") - ->field("pay_time,promote_account,company_name,company_belong,real_name,develop_type,game_name, + ->field("id,pay_time,promote_account,company_name,company_belong,real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount, - sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit"); + sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit, + other_amount,refund_amount"); if ($_REQUEST['export']) { $data = $data->where($map) @@ -142,7 +143,8 @@ class MarketPercentageController extends ThinkController $sum = SM("settleup_marketorder", "tab_") ->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount, - sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit") + sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit, + sum(other_amount) other_amount,sum(refund_amount) refund_amount") ->where($map) ->find(); @@ -181,9 +183,11 @@ class MarketPercentageController extends ThinkController 'develop_type' => '类型', 'game_name' => '游戏名称', 'pay_amount' => '总流水', - 'cp_amount' => '上游结算流水', - 'promote_amount' => '下游结算流水', + 'cp_amount' => '上游结算额', + 'promote_amount' => '下游结算额', 'channel_amount' => '支付渠道费用', + 'refund_amount'=>'退款金额', + 'other_amount'=>'返点及其他', 'company_tax' => '公司税费', 'company_profit' => '税后毛利额']; @@ -221,6 +225,22 @@ class MarketPercentageController extends ThinkController $this->display(); } + public function otherAmountEdit() + { + if(!array_key_exists('id',$_REQUEST) || !array_key_exists('other_amount',$_REQUEST)){ + $this->ajaxReturn(['status'=>0,'msg'=>'参数错误']); + } + $id = I("id"); + $other_amount = I("other_amount"); + $dbres = M("settleup_marketorder","tab_")->where("id = {$id}")->find(); + $save = [ + 'id'=>$id, + 'company_profit'=>$dbres['company_profit']-($other_amount-$dbres['other_amount']), + 'other_amount'=>$other_amount + ]; + M("settleup_marketorder","tab_")->save($save); + $this->ajaxReturn(['status'=>1,'msg'=>'其他扣款添加成功']); + } public function indexuncaculate($row = 10, $p = 1) { @@ -1266,19 +1286,23 @@ class MarketPercentageController extends ThinkController public function reCaculateBonus() { - - $pay_time = $_REQUEST['pay_time']; - - if (!$pay_time) { - $pay_time = "all"; -// $pay_time = date("Y-m",strtotime('-1 month')); + $type = $_REQUEST['type']; + if(empty($type)){ + die('参数错误'); + } + if($type == 1){ + $action = "caculateMarketStream/time"; + }else{ + $action = "createMarketBonus/pay_time"; + } + $pay_time = date( 'Y-m', strtotime( 'last day of -1 months' ) ); + $params = "php ".SUBSITE_INDEX." Timing/{$action}/{$pay_time}"; + $r = D("CmdTasks")->addTask("MarketPerformanceSet",$params); + if($r){ + $this->ajaxReturn(["status"=>"1",'msg'=>"任务添加成功,大约需等待5分钟后生成"]); + }else{ + $this->ajaxReturn(["status"=>"0","msg"=>'任务添加失败']); } - -// var_dump("cd ".ROOTTT.";php admin.php timing/caculateMarketStream/time/{$pay_time} > /dev/null &");die(); - - exec("source /etc/profile;cd " . ROOTTT . ";php " . SUBSITE_INDEX . " timing/caculateMarketStream/time/{$pay_time} > /dev/null &"); - - $this->ajaxReturn(['status' => 1]); } public function showBonusList($row = 10, $p = 1) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 6d40c92a0..d08526f0d 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -844,6 +844,7 @@ class TimingController extends AdminController { $count_date = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); } A("MarketPerformanceSet")->setFreeMonth($count_date); + $this->createMarketBonus($_REQUEST['time']); die(); echo date("Y-m-d H:i:s")."----------------------市场结算管理计算----------------------\n"; @@ -1357,6 +1358,7 @@ class TimingController extends AdminController { ->field("id,admin_id,pay_time,promote_account,company_belong,tab_settleup_marketorder.real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(company_profit) company_profit, sum(if((develop_type = 1 or develop_type = 2), pay_amount, 0)) performance_revenue,sum(if(develop_type = 3, pay_amount, 0)) appraisal_bonuses, + sum(if((develop_type = 1 or develop_type = 2), refund_amount, 0)) performance_refund_amount,sum(if(develop_type = 3, refund_amount, 0)) appraisal_refund_amount, sum(company_tax) company_tax, sum(cp_amount) cp_amount,sum(promote_amount) promote_amount") ->where($map) ->where(["admin_id"=>['in',array_keys($accessData)]]) @@ -1368,6 +1370,8 @@ class TimingController extends AdminController { if(isset($accessData[$admin_id])){ $value = array_merge($value,$accessData[$admin_id]); } + $value['performance_revenue'] -= $value['performance_refund_amount']; + $value['appraisal_bonuses'] -= $value['appraisal_refund_amount']; $sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses']; diff --git a/Application/Admin/View/MarketPercentage/index.html b/Application/Admin/View/MarketPercentage/index.html index 02c2d0628..8dae70017 100644 --- a/Application/Admin/View/MarketPercentage/index.html +++ b/Application/Admin/View/MarketPercentage/index.html @@ -43,7 +43,7 @@
@@ -125,11 +125,14 @@