|
|
|
@ -15,72 +15,78 @@ class FinanceController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
public function settlementDtl()
|
|
|
|
|
{
|
|
|
|
|
$model = M('spend', 'tab_');
|
|
|
|
|
$page = intval(I('get.p', 1));
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据arraypage
|
|
|
|
|
$row = intval(I('get.row', 10));
|
|
|
|
|
$payOrderNumber = I('pay_order_number', '');
|
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
|
|
$initEndTime = $nowTime;
|
|
|
|
|
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
|
|
|
|
|
$begTime = strtotime($initBegTime);
|
|
|
|
|
$endTime = strtotime($initEndTime);
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
$securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码
|
|
|
|
|
$model = new PromoteApi();
|
|
|
|
|
$res = $model->verify_er_User(PID, $securityCode);//验证安全密码
|
|
|
|
|
if ($res) {
|
|
|
|
|
$model = M('spend', 'tab_');
|
|
|
|
|
$page = intval(I('get.p', 1));
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据arraypage
|
|
|
|
|
$row = intval(I('get.row', 10));
|
|
|
|
|
$payOrderNumber = I('pay_order_number', '');
|
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
|
|
$initEndTime = $nowTime;
|
|
|
|
|
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
|
|
|
|
|
$begTime = strtotime($initBegTime);
|
|
|
|
|
$endTime = strtotime($initEndTime);
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
$parameter['p'] = $page;
|
|
|
|
|
$parameter['row'] = $row;
|
|
|
|
|
$parameter['pay_order_number'] = $payOrderNumber;
|
|
|
|
|
$parameter['begtime'] = $initBegTime;
|
|
|
|
|
$parameter['endtime'] = $initEndTime;
|
|
|
|
|
$parameter['p'] = $page;
|
|
|
|
|
$parameter['row'] = $row;
|
|
|
|
|
$parameter['pay_order_number'] = $payOrderNumber;
|
|
|
|
|
$parameter['begtime'] = $initBegTime;
|
|
|
|
|
$parameter['endtime'] = $initEndTime;
|
|
|
|
|
|
|
|
|
|
$map['chain'] = ['like', $loginPromote['chain'] . $loginPromote['id'] . '/%'];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
$ids[] = $loginPromote['id'];
|
|
|
|
|
$ids = implode(',', $ids);
|
|
|
|
|
$map['chain'] = ['like', $loginPromote['chain'] . $loginPromote['id'] . '/%'];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
$ids[] = $loginPromote['id'];
|
|
|
|
|
$ids = implode(',', $ids);
|
|
|
|
|
// var_dump($ids);
|
|
|
|
|
// die;
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['promote_id'] = ['in', $ids];
|
|
|
|
|
if (!empty($payOrderNumber)) {
|
|
|
|
|
$map['pay_order_number'] = $payOrderNumber;
|
|
|
|
|
}
|
|
|
|
|
if (!empty($begTime) && empty($endTime)) {
|
|
|
|
|
$map['pay_time'] = ['egt', $begTime];
|
|
|
|
|
} elseif (empty($begTime) && !empty($endTime)) {
|
|
|
|
|
$map['pay_time'] = ['elt', $endTime + 86399];
|
|
|
|
|
} elseif (!empty($begTime) && !empty($endTime)) {
|
|
|
|
|
$map['pay_time'] = ['between', [$begTime, $endTime + 86399]];
|
|
|
|
|
}
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['promote_id'] = ['in', $ids];
|
|
|
|
|
if (!empty($payOrderNumber)) {
|
|
|
|
|
$map['pay_order_number'] = $payOrderNumber;
|
|
|
|
|
}
|
|
|
|
|
if (!empty($begTime) && empty($endTime)) {
|
|
|
|
|
$map['pay_time'] = ['egt', $begTime];
|
|
|
|
|
} elseif (empty($begTime) && !empty($endTime)) {
|
|
|
|
|
$map['pay_time'] = ['elt', $endTime + 86399];
|
|
|
|
|
} elseif (!empty($begTime) && !empty($endTime)) {
|
|
|
|
|
$map['pay_time'] = ['between', [$begTime, $endTime + 86399]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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,convert(pay_amount*if(selle_ratio >= 0,selle_ratio,0),decimal(10,2)) as income,pay_time,selle_status')
|
|
|
|
|
->where($map)
|
|
|
|
|
->order('id desc')
|
|
|
|
|
->page($page, $row)
|
|
|
|
|
->select();
|
|
|
|
|
$count = $model->where($map)->count();
|
|
|
|
|
$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,convert(pay_amount*if(selle_ratio >= 0,selle_ratio,0),decimal(10,2)) as income,pay_time,selle_status')
|
|
|
|
|
->where($map)
|
|
|
|
|
->order('id desc')
|
|
|
|
|
->page($page, $row)
|
|
|
|
|
->select();
|
|
|
|
|
$count = $model->where($map)->count();
|
|
|
|
|
|
|
|
|
|
foreach ($data as &$list) {
|
|
|
|
|
switch ($list['selle_status']) {
|
|
|
|
|
case 0:
|
|
|
|
|
$list['selle_status'] = '未提现';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$list['selle_status'] = '';
|
|
|
|
|
break;
|
|
|
|
|
foreach ($data as &$list) {
|
|
|
|
|
switch ($list['selle_status']) {
|
|
|
|
|
case 0:
|
|
|
|
|
$list['selle_status'] = '未提现';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$list['selle_status'] = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
$list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
|
|
|
|
|
}
|
|
|
|
|
$list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$page = set_pagination($count, $row, $parameter);
|
|
|
|
|
$page = set_pagination($count, $row, $parameter);
|
|
|
|
|
|
|
|
|
|
$this->assign('listData', $data);
|
|
|
|
|
$this->assign('count', $count);
|
|
|
|
|
$this->assign('initBegTime', $initBegTime);
|
|
|
|
|
$this->assign('initEndTime', $initEndTime);
|
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign('listData', $data);
|
|
|
|
|
$this->assign('count', $count);
|
|
|
|
|
$this->assign('initBegTime', $initBegTime);
|
|
|
|
|
$this->assign('initEndTime', $initEndTime);
|
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
|
$this->assign('meta_title', '结算明细');
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|