From 08dd26f9421e85d006a863f691692120bcee5c24 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Thu, 9 Jan 2020 11:09:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E6=8F=90=E7=8E=B0--=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AutoController.class.php | 26 +++++++++++-------- .../Admin/Model/WithdrawModel.class.php | 20 +++++++------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php index 47b0a75a8..e75d464ac 100644 --- a/Application/Admin/Controller/AutoController.class.php +++ b/Application/Admin/Controller/AutoController.class.php @@ -1083,18 +1083,22 @@ public function auto_rrdae(){ $error_repeat = 0; if (!empty($promotes)) { + switch ($settlement) { + case 1: + $fun = 'promoteWithdrawWeeklyByPromote'; + break; + case 2: + $fun = 'promoteWithdrawPerMonthByPromote'; + break; + case 3: + $fun = 'promoteWithdrawRecoupByPromote'; + break; + } foreach ($promotes as $promote) { - if ($settlement == 3) { - $result = $withdrawModel->promoteWithdrawRecoupByPromote($promote); + if ($fun == 'promoteWithdrawRecoupByPromote') { + $result = $withdrawModel->$fun($promote); } else { - switch ($promote['settlement_type']) { - case 1: - $result = $withdrawModel->promoteWithdrawWeeklyByPromote($promote, $initial); - break; - case 2: - $result = $withdrawModel->promoteWithdrawPerMonthByPromote($promote, $initial); - break; - } + $result = $withdrawModel->$fun($promote, $initial); } switch ($result) { case -4: @@ -1119,6 +1123,6 @@ public function auto_rrdae(){ } } - echo "success:{$success} error_withdraw:{$error_withdraw} error_spend:{$error_spend} error_balance:{$error_balance}"; + echo "success:{$success} error_withdraw:{$error_withdraw} error_spend:{$error_spend} error_balance:{$error_balance} error_unset:{$error_unset} error_repeat:{$error_repeat}"; } } diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php index 0c03b4703..7cb4ac54a 100644 --- a/Application/Admin/Model/WithdrawModel.class.php +++ b/Application/Admin/Model/WithdrawModel.class.php @@ -179,13 +179,13 @@ class WithdrawModel extends Model{ return -2;//余额不足 } - $gameRatios = []; if ($initial === false) { $beginTime = date('Y-m-d', $settlementBeginTime); - $endTime = date('Y-m-d', $settlementEndTime); - $gameRatios = $this->getGameRatio($spendMap, $beginTime, $endTime); + } else { + $beginTime = '初始'; } - + $endTime = date('Y-m-d', $settlementEndTime); + $gameRatios = $this->getGameRatio($spendMap, $beginTime, $endTime); $gameRatios = $gameRatios ? json_encode($gameRatios) : ''; $thisTime = time(); @@ -237,9 +237,11 @@ class WithdrawModel extends Model{ if ($initial) { $settlementType = 9; $settlementBeginTime = 0; + $beginTime = '初始'; + } else { + $beginTime = date('Y-m-d', $settlementBeginTime); } - $beginTime = date('Y-m-d', $settlementBeginTime); $endTime = date('Y-m-d', $settlementEndTime); $spendMap['pay_status'] = 1; $spendMap['selle_status'] = 0; @@ -248,7 +250,6 @@ class WithdrawModel extends Model{ $spendWhere = $spendMap; $spendModel = M('spend', 'tab_'); - $gameRatios = []; $promoteGameRatioMap['status'] = 1; $promoteGameRatioMap['promote_id'] = $promote['id']; $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time') @@ -256,11 +257,8 @@ class WithdrawModel extends Model{ ->order('update_time desc') ->select(); - if ($initial === false) { - $beginTime = date('Y-m-d', $settlementBeginTime); - $endTime = date('Y-m-d', $settlementEndTime); - $gameRatios = $this->getGameRatio($spendMap, $beginTime, $endTime); - } + $gameRatios = $this->getGameRatio($spendMap, $beginTime, $endTime); + if (empty($promoteGameRatios) || $initial) { $balance = $spendModel->field("sum(if(selle_ratio > 0, pay_amount * selle_ratio, 0)) as balance") ->where($spendMap)