|
|
@ -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)
|
|
|
|