diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index bb447967d..8ecbce4d2 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -529,7 +529,7 @@ class FinanceController extends BaseController if ($withdrawId == 0) { $this->error('参数异常'); } - $withdraw = $model->field('promote_id,status')->where(array('id' => $withdrawId))->find(); + $withdraw = $model->where(array('id' => $withdrawId))->find(); if (empty($withdraw) || $withdraw['promote_id'] != $this->loginPromote['id']) { $this->error('参数异常'); } @@ -544,7 +544,18 @@ class FinanceController extends BaseController $parameter['user_account'] = $userAccount; $parameter['pay_order_number'] = $payOrderNumber; - $map['withdraw_id'] = $withdrawId; + if ($withdraw['settlement_type'] == 3) { + if (empty($withdraw['game_ratio'])) { + $map['_string'] = '1 = 2'; + } else { + $gameRatios = json_decode($withdraw['game_ratio'], true); + $gameIds = array_keys($gameRatios); + $map['game_id'] = ['in', $gameIds]; + $map['pay_time'] = ['between', [$withdraw['settlement_begin_time'], $withdraw['settlement_end_time']]]; + } + } else { + $map['withdraw_id'] = $withdrawId; + } if (!empty($gameId)) { $map['game_id'] = $gameId; } @@ -613,20 +624,40 @@ class FinanceController extends BaseController if (empty($withdraw) || $withdraw['promote_id'] != $this->loginPromote['id']) { $this->error('参数异常'); } + + $settlementBeginTime = $withdraw['settlement_begin_time']; + $settlementEndTime = $withdraw['settlement_end_time']; $withdraw['create_time'] = date('Y-m-d H:i:s', $withdraw['create_time']); $withdraw['settlement_end_time'] = date('Y-m-d H:i:s', $withdraw['settlement_end_time']); $withdraw['status'] = FinanceController::$withdrawStatus[$withdraw['status']]; - $map['withdraw_id'] = $withdrawId; + if (empty($withdraw['game_ratio'])) { + $map['_string'] = '1 = 2'; + } else { + $gameRatios = json_decode($withdraw['game_ratio'], true); + $gameIds = array_keys($gameRatios); + $map['game_id'] = ['in', $gameIds]; + $map['pay_time'] = ['between', [$settlementBeginTime, $settlementEndTime]]; + } + if ($withdraw['settlement_type'] != 3) { + $map['withdraw_id'] = $withdrawId; + } + $data = M('spend', 'tab_') - ->field('game_name,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_way,sum(pay_amount) as pay_amount_all,sum(if(selle_ratio > 0,pay_amount * selle_ratio,0)) as income') + ->field('game_id,game_name,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_way,sum(pay_amount) as pay_amount_all,sum(if(selle_ratio > 0,pay_amount * selle_ratio,0)) as income') ->where($map) ->group('game_id') ->order('game_id') ->select(); if (!empty($data)) { foreach ($data as &$list) { - $list['income'] = bcdiv($list['income'], 100, 2); + $list['income'] = '0.00'; + if (isset($gameRatios[$list['game_id']])) { + foreach ($gameRatios[$list['game_id']] as $gameIncome) { + $income = bcdiv(bcmul($gameIncome['sum_amount'], $gameIncome['selle_ratio'], 2), 100, 2); + $list['income'] = bcadd($list['income'], $income, 2); + } + } } } diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index e08f08cdb..4fe8c80d9 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -232,20 +232,20 @@ class PromoteController extends BaseController $this->assign("rules", $rules); $this->assign("rules_count", count($rules)); - $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); - $cacheKey = "pop:rule:set"; - if (!$redis->sIsMember($cacheKey, get_pid())) { - $currentTime = strtotime(date('Y-m-d')); - $weekArray = [7,1,2,3,4,5,6]; - $week = $weekArray[date("w")]; - $match_rules = M("document_pop_rules") - ->field('id') - ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") - ->order("sort asc, id desc") - ->select(); - } else { - $match_rules = []; - } +// $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); +// $cacheKey = "pop:rule:set"; +// if (!$redis->sIsMember($cacheKey, get_pid())) { +// $currentTime = strtotime(date('Y-m-d')); +// $weekArray = [7,1,2,3,4,5,6]; +// $week = $weekArray[date("w")]; +// $match_rules = M("document_pop_rules") +// ->field('id') +// ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") +// ->order("sort asc, id desc") +// ->select(); +// } else { +// $match_rules = []; +// } $this->assign("match_rules_id", $match_rules ? json_encode(array_column($match_rules, 'id')) : 'null'); diff --git a/Application/Home/View/default/Finance/settlementOrder.html b/Application/Home/View/default/Finance/settlementOrder.html index d05184dc1..0f57aa709 100644 --- a/Application/Home/View/default/Finance/settlementOrder.html +++ b/Application/Home/View/default/Finance/settlementOrder.html @@ -141,11 +141,11 @@ 游戏名称 流水 现金分成基数 - 现金分成比例 + 平台币分成基数 - 平台币分成比例 + 绑定币分成基数 - 绑定币分成比例 + 合作方分成金额 @@ -165,19 +165,19 @@ 0 - {$vo.selle_ratio}% + {$vo.pay_amount_all} 0 - {$vo.selle_ratio}% + {$vo.pay_amount_all} 0 - {$vo.selle_ratio}% + {$vo.income} diff --git a/Application/Home/View/default/Finance/withdrawDtl.html b/Application/Home/View/default/Finance/withdrawDtl.html index 7b67dbfb3..d06f14696 100644 --- a/Application/Home/View/default/Finance/withdrawDtl.html +++ b/Application/Home/View/default/Finance/withdrawDtl.html @@ -134,11 +134,11 @@ 玩家账号 订单总额 现金分成基数 - 现金分成比例 + 平台币分成基数 - 平台币分成比例 + 绑定币分成基数 - 绑定币分成比例 + 现金支付通道 收益 订单状态 @@ -164,19 +164,19 @@ 0 - {$vo.selle_ratio}% + {$vo.pay_amount} 0 - {$vo.selle_ratio}% + {$vo.pay_amount} 0 - {$vo.selle_ratio}% + {$vo.pay_way_name} {$vo.income} {$status}