|
|
|
@ -160,7 +160,9 @@ class FinanceController extends BaseController
|
|
|
|
|
$page = intval(I('get.p', 1));
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据arraypage
|
|
|
|
|
$row = intval(I('get.row', 10));
|
|
|
|
|
$gameId = intval(I('game_id', 0));
|
|
|
|
|
$payOrderNumber = I('pay_order_number', '');
|
|
|
|
|
$status = intval(I('status', 0));
|
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
|
@ -172,13 +174,16 @@ class FinanceController extends BaseController
|
|
|
|
|
|
|
|
|
|
$parameter['p'] = $page;
|
|
|
|
|
$parameter['row'] = $row;
|
|
|
|
|
$parameter['game_id'] = $gameId;
|
|
|
|
|
$parameter['pay_order_number'] = $payOrderNumber;
|
|
|
|
|
$parameter['status'] = $status;
|
|
|
|
|
$parameter['begtime'] = $initBegTime;
|
|
|
|
|
$parameter['endtime'] = $initEndTime;
|
|
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
|
$count = 0;
|
|
|
|
|
if (intval($endTime - $begTime) / (24 * 3600) <= 31) {
|
|
|
|
|
$withdrawIds = [];
|
|
|
|
|
$map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
$ids[] = $this->loginPromote['id'];
|
|
|
|
@ -186,10 +191,29 @@ class FinanceController extends BaseController
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['promote_id'] = ['in', $ids];
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
$map['pay_time'] = ['between', [$begTime, $endTime]];
|
|
|
|
|
if (!empty($gameId)) {
|
|
|
|
|
$map['game_id'] = $gameId;
|
|
|
|
|
}
|
|
|
|
|
if (!empty($payOrderNumber)) {
|
|
|
|
|
$map['pay_order_number'] = $payOrderNumber;
|
|
|
|
|
}
|
|
|
|
|
if (isset($_GET['status'])) {
|
|
|
|
|
if ($status == -2) {
|
|
|
|
|
$map['selle_status'] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$withdrawMap['promote_id'] = $this->loginPromote['id'];
|
|
|
|
|
$withdrawMap['status'] = $status;
|
|
|
|
|
$withdrawIds = M('withdraw', 'tab_')->where($withdrawMap)->getField('id', true);
|
|
|
|
|
|
|
|
|
|
if (empty($withdrawIds)) {
|
|
|
|
|
$map = '1 = 2';
|
|
|
|
|
} else {
|
|
|
|
|
$map['withdraw_id'] = ['in', $withdrawIds];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id')
|
|
|
|
|
->where($map)
|
|
|
|
@ -199,10 +223,12 @@ class FinanceController extends BaseController
|
|
|
|
|
$count = $model->where($map)->count();
|
|
|
|
|
|
|
|
|
|
//提现状态
|
|
|
|
|
$withdrawIds = [0];
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
if ($value['withdraw_id'] > 0 && !in_array($value['withdraw_id'], $withdrawIds)) {
|
|
|
|
|
$withdrawIds[] = $value['withdraw_id'];
|
|
|
|
|
if (empty($withdrawIds)) {
|
|
|
|
|
$withdrawIds = [0];
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
if ($value['withdraw_id'] > 0 && !in_array($value['withdraw_id'], $withdrawIds)) {
|
|
|
|
|
$withdrawIds[] = $value['withdraw_id'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$withdrawStatus = M('withdraw', 'tab_')
|
|
|
|
|