推广提现--更新

master
chenxiaojun 5 years ago
parent cf0680eddf
commit 08dd26f942

@ -1083,18 +1083,22 @@ public function auto_rrdae(){
$error_repeat = 0; $error_repeat = 0;
if (!empty($promotes)) { if (!empty($promotes)) {
foreach ($promotes as $promote) { switch ($settlement) {
if ($settlement == 3) {
$result = $withdrawModel->promoteWithdrawRecoupByPromote($promote);
} else {
switch ($promote['settlement_type']) {
case 1: case 1:
$result = $withdrawModel->promoteWithdrawWeeklyByPromote($promote, $initial); $fun = 'promoteWithdrawWeeklyByPromote';
break; break;
case 2: case 2:
$result = $withdrawModel->promoteWithdrawPerMonthByPromote($promote, $initial); $fun = 'promoteWithdrawPerMonthByPromote';
break;
case 3:
$fun = 'promoteWithdrawRecoupByPromote';
break; break;
} }
foreach ($promotes as $promote) {
if ($fun == 'promoteWithdrawRecoupByPromote') {
$result = $withdrawModel->$fun($promote);
} else {
$result = $withdrawModel->$fun($promote, $initial);
} }
switch ($result) { switch ($result) {
case -4: 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}";
} }
} }

@ -179,13 +179,13 @@ class WithdrawModel extends Model{
return -2;//余额不足 return -2;//余额不足
} }
$gameRatios = [];
if ($initial === false) { if ($initial === false) {
$beginTime = date('Y-m-d', $settlementBeginTime); $beginTime = date('Y-m-d', $settlementBeginTime);
} else {
$beginTime = '初始';
}
$endTime = date('Y-m-d', $settlementEndTime); $endTime = date('Y-m-d', $settlementEndTime);
$gameRatios = $this->getGameRatio($spendMap, $beginTime, $endTime); $gameRatios = $this->getGameRatio($spendMap, $beginTime, $endTime);
}
$gameRatios = $gameRatios ? json_encode($gameRatios) : ''; $gameRatios = $gameRatios ? json_encode($gameRatios) : '';
$thisTime = time(); $thisTime = time();
@ -237,9 +237,11 @@ class WithdrawModel extends Model{
if ($initial) { if ($initial) {
$settlementType = 9; $settlementType = 9;
$settlementBeginTime = 0; $settlementBeginTime = 0;
$beginTime = '初始';
} else {
$beginTime = date('Y-m-d', $settlementBeginTime);
} }
$beginTime = date('Y-m-d', $settlementBeginTime);
$endTime = date('Y-m-d', $settlementEndTime); $endTime = date('Y-m-d', $settlementEndTime);
$spendMap['pay_status'] = 1; $spendMap['pay_status'] = 1;
$spendMap['selle_status'] = 0; $spendMap['selle_status'] = 0;
@ -248,7 +250,6 @@ class WithdrawModel extends Model{
$spendWhere = $spendMap; $spendWhere = $spendMap;
$spendModel = M('spend', 'tab_'); $spendModel = M('spend', 'tab_');
$gameRatios = [];
$promoteGameRatioMap['status'] = 1; $promoteGameRatioMap['status'] = 1;
$promoteGameRatioMap['promote_id'] = $promote['id']; $promoteGameRatioMap['promote_id'] = $promote['id'];
$promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time') $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') ->order('update_time desc')
->select(); ->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) { if (empty($promoteGameRatios) || $initial) {
$balance = $spendModel->field("sum(if(selle_ratio > 0, pay_amount * selle_ratio, 0)) as balance") $balance = $spendModel->field("sum(if(selle_ratio > 0, pay_amount * selle_ratio, 0)) as balance")
->where($spendMap) ->where($spendMap)

Loading…
Cancel
Save