解决冲突

master
ELF 5 years ago
commit ca84e029be

@ -252,7 +252,7 @@ class BaseController extends HomeController
} }
//验证安全密码--视图 //验证安全密码--视图
public function verifyPasswordView($modelList, $metaTitle) public function verifyPasswordView($modelList, $show = true)
{ {
$securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码 $securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码
$model = new \User\Api\PromoteApi(); $model = new \User\Api\PromoteApi();
@ -260,11 +260,14 @@ class BaseController extends HomeController
if ($res) { if ($res) {
return true; return true;
} }
if ($show) {
$this->assign('modelList', $modelList);
$this->assign('meta_title', '安全密码');
$this->display('Public/verify_password');
exit;
}
$this->assign('modelList', $modelList); return false;
$this->assign('metaTitle', $metaTitle);
$this->display('Public/verify_password');
exit;
} }
//验证安全密码 //验证安全密码

@ -2,6 +2,7 @@
namespace Home\Controller; namespace Home\Controller;
use Base\Model\Model;
use OT\DataDictionary; use OT\DataDictionary;
use Base\Repository\PromoteRepository; use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository; use Base\Repository\SpendRepository;
@ -12,12 +13,144 @@ use Base\Repository\UserRepository;
*/ */
class FinanceController extends BaseController class FinanceController extends BaseController
{ {
//提现状态
public static $withdrawStatus = [
-1 => '审核未通过',
0 => '待审核',
1 => '汇款中',
2 => '已汇款',
];
//权限过滤
private function purview()
{
$this->loginPromote = $this->getLoginPromote();
if ($this->loginPromote['level'] != 1) {
$this->error('权限异常');
}
return true;
}
private function getDayList($beginTime, $endTime)
{
$dayList = [];
do {
$dayList[] = date('Y-m-d', $beginTime);
$beginTime += 24 * 60 * 60;
} while ($beginTime < $endTime);
return $dayList;
}
private function assembleRecords($items, $keys, $valueColumn, $keyColumn = 'day')
{
$records = [];
foreach ($keys as $key) {
$value = 0;
foreach ($items as $item) {
if ($item[$keyColumn] == $key) {
$value = $item[$valueColumn];
}
}
$records[$key] = $value;
}
return $records;
}
//生成提现单号
private function produceWithdrawNumber()
{
$prefix = 'WD_';
$number = '';
while (true) {
$randomNum = rand(10, 99);
$number = $prefix . time() . $randomNum;
$map['widthdraw_number'] = $number;
$res = M('withdraw', 'tab_')->where($map)->getField('id');
if (!$res) {
break;
}
}
return $number;
}
//结算中心
public function index()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle];
$this->verifyPasswordView($modelList);
$model = M('spend', 'tab_');
$thisDay = strtotime(date('Y-m-d'));
$thisMonth = strtotime(date('Y-m'));
$yesterday = strtotime(date('Y-m-d', strtotime('-1 day', time())));
$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);
$endTime = $endTime + 3600 * 24;
$map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
$promoteIds = M('promote', 'tab_')->where($map)->getField('id', true);
$promoteIds[] = $this->loginPromote['id'];
$promoteIds = implode(',', $promoteIds);
$map = [];
$map['pay_status'] = 1;
$map['promote_id'] = ['in', $promoteIds];
$income = $model->field("sum(if(pay_time < $thisDay, if(selle_ratio > 0, pay_amount * selle_ratio, 0), 0)) as history_income,
sum(if(pay_time >= $thisMonth, if(selle_ratio > 0, pay_amount * selle_ratio, 0), 0)) as this_month_income,
sum(if((pay_time >= $yesterday and pay_time < $thisDay), if(selle_ratio > 0, pay_amount * selle_ratio, 0), 0)) as yesterday_income,
sum(if(pay_time < $thisDay, if(selle_status = 0, pay_amount * selle_ratio, 0), 0)) as balance")
->where($map)
->find();
foreach ($income as &$value) {
$value = bcdiv($value, 100, 2);
}
$map['pay_time'] = ['between', [$begTime, $endTime]];
$dayList = $this->getDayList($begTime, $endTime);
$data = $model->field('FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,
sum(if(selle_ratio > 0, pay_amount * selle_ratio, 0)) as income')
->where($map)
->group('day')
->select();
$data = $this->assembleRecords($data, $dayList, 'income');
foreach ($dayList as $day) {
$date = date('Ymd', strtotime($day));
$records[] = [
'day' => $date,
'income' => bcdiv($data[$day], 100, 2),
'url' => U('settlementDtl', array('begtime' => $day, 'endtime' => $day))
];
}
$this->assign('income', $income);
$this->assign('listData', $records);
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('yesterday', date('Y-m-d', $yesterday));
$this->assign('meta_title', $metaTitle);
$this->display();
}
//结算明细
public function settlementDtl() public function settlementDtl()
{ {
//是否是会长
$this->purview();
//验证安全密码 //验证安全密码
$metaTitle = '结算明细'; $metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle]; $modelList = ['财务管理', $metaTitle];
$this->verifyPasswordView($modelList, $metaTitle); $this->verifyPasswordView($modelList);
$model = M('spend', 'tab_'); $model = M('spend', 'tab_');
$page = intval(I('get.p', 1)); $page = intval(I('get.p', 1));
@ -31,7 +164,6 @@ class FinanceController extends BaseController
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime); $begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime); $endTime = strtotime($initEndTime);
$loginPromote = $this->getLoginPromote();
$parameter['p'] = $page; $parameter['p'] = $page;
$parameter['row'] = $row; $parameter['row'] = $row;
@ -39,9 +171,9 @@ class FinanceController extends BaseController
$parameter['begtime'] = $initBegTime; $parameter['begtime'] = $initBegTime;
$parameter['endtime'] = $initEndTime; $parameter['endtime'] = $initEndTime;
$map['chain'] = ['like', $loginPromote['chain'] . $loginPromote['id'] . '/%']; $map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
$ids = M('promote', 'tab_')->where($map)->getField('id', true); $ids = M('promote', 'tab_')->where($map)->getField('id', true);
$ids[] = $loginPromote['id']; $ids[] = $this->loginPromote['id'];
$ids = implode(',', $ids); $ids = implode(',', $ids);
$map = []; $map = [];
@ -57,22 +189,44 @@ class FinanceController extends BaseController
$map['pay_time'] = ['between', [$begTime, $endTime + 86399]]; $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') $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) ->where($map)
->order('id desc') ->order('id desc')
->page($page, $row) ->page($page, $row)
->select(); ->select();
$count = $model->where($map)->count(); $count = $model->where($map)->count();
//提现状态
$withdrawIds = [];
foreach ($data as $key => $value) {
if ($value['withdraw_id'] > 0 && !in_array($value['withdraw_id'], $withdrawIds)) {
$withdrawIds[] = $value['withdraw_id'];
}
}
$withdrawStatus = M('withdraw', 'tab_')
->where(array('id' => ['in', $withdrawIds]))
->getField('id,status');
foreach ($data as &$list) { foreach ($data as &$list) {
switch ($list['selle_status']) { //提现状态
case 0: if ($list['pay_status'] == 1) {
$list['selle_status'] = '未提现'; switch ($list['selle_status']) {
break; case 0:
default: $list['selle_status'] = '未提现';
$list['selle_status'] = ''; break;
break; default:
if ($list['withdraw_id'] > 0) {
$list['selle_status'] = FinanceController::$withdrawStatus[$withdrawStatus[$list['withdraw_id']]];
} else {
$list['selle_status'] = '';
}
break;
}
} else {
$list['selle_status'] = '支付失败';
} }
$list['income'] = bcmul($list['pay_amount'], bcdiv($list['selle_ratio'], 100, 2), 2);
$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']);
} }
@ -83,7 +237,252 @@ class FinanceController extends BaseController
$this->assign('initBegTime', $initBegTime); $this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime); $this->assign('initEndTime', $initEndTime);
$this->assign('_page', $page); $this->assign('_page', $page);
$this->assign('meta_title', '结算明细'); $this->assign('meta_title', $metaTitle);
$this->assign('modelList', $modelList);
$this->display();
}
//提现
public function withdraw()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle];
$res = $this->verifyPasswordView($modelList, false);
if ($res == false) {
$data['status'] = 0;
$data['msg'] = '权限异常';
$this->ajaxReturn($data);
}
$spendModel = M('spend', 'tab_');
$thisDay = strtotime(date('Y-m-d'));
$map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
$promoteIds = M('promote', 'tab_')->where($map)->getField('id', true);
$promoteIds[] = $this->loginPromote['id'];
$promoteIds = implode(',', $promoteIds);
$map = [];
$map['pay_status'] = 1;
$map['selle_status'] = 0;
$map['promote_id'] = ['in', $promoteIds];
$map['pay_time'] = ['lt', $thisDay];
$balance = $spendModel->field("sum(pay_amount * selle_ratio) as balance")
->where($map)
->find()['balance'];
$balance = bcdiv($balance, 100, 2);
if ($balance < 100) {
$data['status'] = 0;
$data['msg'] = '账户余额低于100元无法提现';
$this->ajaxReturn($data);
}
$spendIds = $spendModel->where($map)->getField('id', true);
if (!empty($spendIds)) {
$data['status'] = 0;
$data['msg'] = '数据异常';
$this->ajaxReturn($data);
}
$thisTime = time();
$add['sum_money'] = $balance;
$add['promote_id'] = $this->loginPromote['id'];
$add['promote_account'] = $this->loginPromote['account'];
$add['create_time'] = $thisTime;
$add['status'] = 0;
$add['widthdraw_number'] = $this->produceWithdrawNumber();
$add['settlement_end_time'] = $thisDay - 1;
M()->startTrans();//开启事物
$withdrawId = M('withdraw', 'tab_')->add($add);
if (!$withdrawId) {
M()->rollback();//事物回滚
$data['status'] = 0;
$data['msg'] = '提现失败';
$this->ajaxReturn($data);
}
$map = [];
$map['id'] = ['in', $spendIds];
$save['selle_status'] = 1;
$save['selle_time'] = $thisTime;
$save['withdraw_id'] = $withdrawId;
$res = $spendModel->where($map)->save($save);
if ($res === false) {
M('withdraw', 'tab_')->delete($withdrawId);
M()->rollback();//事物回滚
$data['status'] = 0;
$data['msg'] = '提现失败';
$this->ajaxReturn($data);
}
M()->commit();//事物提交
$data['status'] = 1;
$data['msg'] = '提现成功';
$this->ajaxReturn($data);
}
//提现记录
public function withdrawRecord()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '提现记录';
$modelList = ['财务管理', $metaTitle];
$this->verifyPasswordView($modelList);
$model = M('withdraw', 'tab_');
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
$withdrawNumber = I('widthdraw_number', '');
$initBegTime = I('begtime', '');
$initEndTime = I('endtime', '');
$begTime = strtotime(date('Y-m-d', strtotime($initBegTime)));
$endTime = strtotime(date('Y-m-d', strtotime($initEndTime))) + 3600 * 24;
$status = '';
$parameter['p'] = $page;
$parameter['row'] = $row;
$parameter['widthdraw_number'] = $withdrawNumber;
$parameter['begtime'] = $initBegTime;
$parameter['endtime'] = $initEndTime;
$map['promote_id'] = $this->loginPromote['id'];
if (!empty($withdrawNumber)) {
$map['widthdraw_number'] = $withdrawNumber;
}
if (!empty($initBegTime) && empty($initEndTime)) {
$map['create_time'] = ['egt', $begTime];
} elseif (empty($initBegTime) && !empty($initEndTime)) {
$map['create_time'] = ['lt', $endTime];
} elseif (!empty($initBegTime) && !empty($initEndTime)) {
$map['create_time'] = ['between', [$begTime, $endTime - 1]];
}
if (isset($_GET['status']) && $_GET['status'] !== '') {
$status = intval($_GET['status']);
if (!isset(FinanceController::$withdrawStatus[$status])) {
if (!isset(FinanceController::$withdrawStatus[$status])) {
$this->error('参数异常');
}
$map['status'] = $status;
}
}
$data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond')
->where($map)
->order('id desc')
->page($page, $row)
->select();
$count = $model
->where($map)
->count();
if (!empty($data)) {
foreach ($data as &$list) {
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
$list['status'] = FinanceController::$withdrawStatus[$list['status']];
}
}
$page = set_pagination($count, $row, $parameter);
$this->assign('listData', $data);
$this->assign('count', $count);
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('status', $status);
$this->assign('_page', $page);
$this->assign('meta_title', $metaTitle);
$this->assign('modelList', $modelList);
$this->display();
}
//提现明细
public function withdrawDtl()
{
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '提现明细';
$modelList = ['财务管理', '提现记录', $metaTitle];
$this->verifyPasswordView($modelList);
$model = M('withdraw', 'tab_');
$spendModel = M('spend', 'tab_');
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
$withdrawId = intval(I('get.id', 0));
if ($withdrawId == 0) {
$this->error('参数异常');
}
$withdraw = $model->field('promote_id,status')->where(array('id' => $withdrawId))->find();
if (empty($withdraw) || $withdraw['promote_id'] != $this->loginPromote['id']) {
$this->error('参数异常');
}
$gameId = intval(I('game_id', 0));
$userAccount = I('user_account', '');
$payOrderNumber = I('pay_order_number', '');
$parameter['p'] = $page;
$parameter['row'] = $row;
$parameter['id'] = $withdrawId;
$parameter['game_id'] = $gameId;
$parameter['user_account'] = $userAccount;
$parameter['pay_order_number'] = $payOrderNumber;
$map['withdraw_id'] = $withdrawId;
if (!empty($gameId)) {
$map['game_id'] = $gameId;
}
if (!empty($userAccount)) {
$map['user_account'] = $userAccount;
}
if (!empty($payOrderNumber)) {
$map['pay_order_number'] = $payOrderNumber;
}
$data = $spendModel
->field('id,pay_order_number,game_name,sdk_version,user_account,pay_amount,pay_way,selle_ratio,pay_time')
->where($map)
->order('id desc')
->page($page, $row)
->select();
$count = $spendModel
->where($map)
->count();
if (!empty($data)) {
foreach ($data as &$list) {
$list['income'] = bcmul($list['pay_amount'], bcdiv($list['selle_ratio'], 100, 2), 2);
$list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
switch ($list['pay_way']) {
case 2:
case 3:
case 4:
$list['pay_way_name'] = QueryController::$payWay[2];
break;
default:
$list['pay_way_name'] = QueryController::$payWay[$list['pay_way']];
break;
}
}
}
$page = set_pagination($count, $row, $parameter);
$this->assign('listData', $data);
$this->assign('count', $count);
$this->assign('status', FinanceController::$withdrawStatus[$withdraw['status']]);
$this->assign('_page', $page);
$this->assign('meta_title', $metaTitle);
$this->assign('modelList', $modelList);
$this->display(); $this->display();
} }
} }

@ -22,7 +22,7 @@ class GameDivideController extends BaseController
//验证安全密码 //验证安全密码
$metaTitle = '分成比例'; $metaTitle = '分成比例';
$modelList = ['游戏管理', $metaTitle]; $modelList = ['游戏管理', $metaTitle];
$this->verifyPasswordView($modelList, $metaTitle); $this->verifyPasswordView($modelList);
$map['tab_game.online_status'] = 1;//开发者游戏上线状态 $map['tab_game.online_status'] = 1;//开发者游戏上线状态
$map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请 $map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请
@ -78,6 +78,7 @@ class GameDivideController extends BaseController
$this->assign('count', $count); $this->assign('count', $count);
$this->assign('serverType', I('server_type', 0)); $this->assign('serverType', I('server_type', 0));
$this->meta_title = $metaTitle; $this->meta_title = $metaTitle;
$this->assign('modelList', $modelList);
$this->display(); $this->display();
} }
} }

@ -66,14 +66,14 @@ class PromoteController extends BaseController
$promote_id = get_pid(); $promote_id = get_pid();
$field = 'id,game_name,server_name,user_account,nickname,promote_account,detail,create_time as update_time'; $field = 'id,game_name,server_name,user_account,nickname,promote_account,detail,create_time as update_time';
$rz_list = M("protect_log","tab_")->field($field)->where("promote_id = {$promote_id}")->limit('0,5')->order("create_time desc")->select(); //日志管理 $rz_list = M("protect_log", "tab_")->field($field)->where("promote_id = {$promote_id}")->limit('0,5')->order("create_time desc")->select(); //日志管理
$logCount = M('protect_log','tab_')->where("promote_id = {$promote_id}")->count(); $logCount = M('protect_log', 'tab_')->where("promote_id = {$promote_id}")->count();
$readLogCount = M('protect_log_read','tab_')->where("promote_id = {$promote_id}")->count(); $readLogCount = M('protect_log_read', 'tab_')->where("promote_id = {$promote_id}")->count();
$gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select(); $gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select();
$gg_Count = count($gg_data); $gg_Count = count($gg_data);
$gg_data = implode(',',array_column($gg_data,'id')); $gg_data = implode(',', array_column($gg_data, 'id'));
$gg_where = "promote_id = {$promote_id} and category_id=56"; $gg_where = "promote_id = {$promote_id} and category_id=56";
if ($gg_data) { if ($gg_data) {
@ -85,7 +85,7 @@ class PromoteController extends BaseController
$zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select(); $zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select();
$zx_Count = count($zx_data); $zx_Count = count($zx_data);
$zx_data = implode(',',array_column($zx_data,'id')); $zx_data = implode(',', array_column($zx_data, 'id'));
$zx_where = "promote_id = {$promote_id} and category_id=51"; $zx_where = "promote_id = {$promote_id} and category_id=51";
if ($zx_data) { if ($zx_data) {
$zx_where .= " and document_id IN({$zx_data})"; $zx_where .= " and document_id IN({$zx_data})";
@ -97,8 +97,8 @@ class PromoteController extends BaseController
$today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; $today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$today_open_server_list = M("server as sv", "tab_") $today_open_server_list = M("server as sv", "tab_")
->where( ->where(
array("sv.start_time" => array("BETWEEN", array($today_start, $today_end)), array("sv.start_time" => array("BETWEEN", array($today_start, $today_end)),
"sv.show_status" => 1)) "sv.show_status" => 1))
->join("left join tab_game gm on gm.id=sv.game_id") ->join("left join tab_game gm on gm.id=sv.game_id")
->field('sv.*,gm.icon') ->field('sv.*,gm.icon')
->order("sv.start_time desc") ->order("sv.start_time desc")
@ -122,29 +122,29 @@ class PromoteController extends BaseController
//计算当日用户充值数据 //计算当日用户充值数据
$map['_string'] = "promote_id = {$promote_id} or tab_promote.parent_id = {$promote_id} or tab_promote.chain like '%/{$promote_id}/%' "; $map['_string'] = "promote_id = {$promote_id} or tab_promote.parent_id = {$promote_id} or tab_promote.chain like '%/{$promote_id}/%' ";
$pay_time = " between 0 and ".time(); $pay_time = " between 0 and " . time();
$spendData = $this->caculateSpend($pay_time,$map['_string']); $spendData = $this->caculateSpend($pay_time, $map['_string']);
$promoteId = implode(',',$promoteId); $promoteId = implode(',', $promoteId);
if ($promoteId) { if ($promoteId) {
$user_count = M("user", "tab_")->where("promote_id IN({$promoteId})")->count(); $user_count = M("user", "tab_")->where("promote_id IN({$promoteId})")->count();
} else { } else {
$user_count = 0; $user_count = 0;
} }
$today=total(1); $today = total(1);
$yesterdays = total(5); $yesterdays = total(5);
$week=total(2); $week = total(2);
$mounth=total(3); $mounth = total(3);
//计算今日的统计数据 //计算今日的统计数据
$data=M('User','tab_') $data = M('User', 'tab_')
->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count, ->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count,
IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 , IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 ,
count(IF(register_time '.$yesterdays.',1,null)) as yesterday, count(IF(register_time ' . $yesterdays . ',1,null)) as yesterday,
count(IF(register_time '.$today.',1,null)) as today, count(IF(register_time ' . $today . ',1,null)) as today,
count(IF(register_time '.$week.',1,null)) as week, count(IF(register_time ' . $week . ',1,null)) as week,
count(IF(register_time '.$mounth.',1,null)) as mounth') count(IF(register_time ' . $mounth . ',1,null)) as mounth')
->join('tab_promote on promote_id = tab_promote.id','left') ->join('tab_promote on promote_id = tab_promote.id', 'left')
->where($map) ->where($map)
->group('promote_id1') ->group('promote_id1')
->having('promote_id != 0') ->having('promote_id != 0')
@ -152,42 +152,42 @@ class PromoteController extends BaseController
->find(); ->find();
// echo M('User','tab_')->_sql();die(); // echo M('User','tab_')->_sql();die();
$total_money = $this->pay_total(0, 0,$promoteId); $total_money = $this->pay_total(0, 0, $promoteId);
$today_add_user_money = $this->pay_total(1,1,$promoteId); $today_add_user_money = $this->pay_total(1, 1, $promoteId);
$month_add_user_money = $this->pay_total(3,1,$promoteId); $month_add_user_money = $this->pay_total(3, 1, $promoteId);
$yesterday_start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); $yesterday_start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
$yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
//计算昨天用户的统计数据,当日用户充值数据 //计算昨天用户的统计数据,当日用户充值数据
$pay_time = " between {$yesterday_start} and {$yesterday_end}"; $pay_time = " between {$yesterday_start} and {$yesterday_end}";
$createTime = ['between',array($yesterday_start,$yesterday_end-1)]; $createTime = ['between', array($yesterday_start, $yesterday_end - 1)];
$yesterdaySpendData = $this->caculateSpend($pay_time,$map['_string'],$createTime); $yesterdaySpendData = $this->caculateSpend($pay_time, $map['_string'], $createTime);
$todayAddSpendData = $this->caculateSpend($pay_time,$map['_string'],[],1); $todayAddSpendData = $this->caculateSpend($pay_time, $map['_string'], [], 1);
$mounthAddSpendData = $this->caculateSpend($pay_time,$map['_string'],[],2); $mounthAddSpendData = $this->caculateSpend($pay_time, $map['_string'], [], 2);
$yesterday_user_regist_count = M("user", "tab_")->where( $yesterday_user_regist_count = M("user", "tab_")->where(
array("promote_id" => array('in',$promoteId), array("promote_id" => array('in', $promoteId),
"register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end)))) "register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end))))
->count(); ->count();
$yesterday_total_money = $this->pay_total(5, 0,$promoteId); $yesterday_total_money = $this->pay_total(5, 0, $promoteId);
$today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; $today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$today_regist_user_count = M("user", "tab_") $today_regist_user_count = M("user", "tab_")
->where(array("promote_id" => array('in',$promoteId), ->where(array("promote_id" => array('in', $promoteId),
"register_time" => array("BETWEEN", array($today_start, $today_end)))) "register_time" => array("BETWEEN", array($today_start, $today_end))))
->count(); ->count();
$today_total_money = $this->pay_total(1, 0,$promoteId); $today_total_money = $this->pay_total(1, 0, $promoteId);
$this->assign('data',$data); $this->assign('data', $data);
// $this->assign('yesterdayData',$yesterdayData); // $this->assign('yesterdayData',$yesterdayData);
$this->assign('spendData',$spendData); $this->assign('spendData', $spendData);
$this->assign('yesterdaySpendData',$yesterdaySpendData); $this->assign('yesterdaySpendData', $yesterdaySpendData);
$this->assign('todayAddSpendData',$todayAddSpendData); $this->assign('todayAddSpendData', $todayAddSpendData);
$this->assign('mounthAddSpendData',$mounthAddSpendData); $this->assign('mounthAddSpendData', $mounthAddSpendData);
$this->assign("user_count", $user_count); $this->assign("user_count", $user_count);
@ -202,106 +202,107 @@ class PromoteController extends BaseController
$this->assign("menu_list", $quick_menu_list); $this->assign("menu_list", $quick_menu_list);
$this->assign("gg_list", $gg_list); $this->assign("gg_list", $gg_list);
$this->assign("gg_count", $gg_Count-$gg_ReadDocument); $this->assign("gg_count", $gg_Count - $gg_ReadDocument);
$this->assign("zx_list", $zx_list); $this->assign("zx_list", $zx_list);
$this->assign("zx_count", $zx_Count-$zx_ReadDocument); $this->assign("zx_count", $zx_Count - $zx_ReadDocument);
$this->assign("xx_list", $xx_list); $this->assign("xx_list", $xx_list);
$this->assign('rz_list', $rz_list); $this->assign('rz_list', $rz_list);
$this->assign("rz_count", $logCount-$readLogCount); $this->assign("rz_count", $logCount - $readLogCount);
$this->assign("today_open_server_list", $today_open_server_list); $this->assign("today_open_server_list", $today_open_server_list);
$this->assign("game_list", $game_list); $this->assign("game_list", $game_list);
$this->meta_title = "首页"; $this->meta_title = "首页";
$this->display(); $this->display();
} }
private function caculateSpend($pay_time,$condition,$create = [],$type = 0) { private function caculateSpend($pay_time, $condition, $create = [], $type = 0)
$spend=M('Spend','tab_'); {
$today=total(1); $spend = M('Spend', 'tab_');
$week=total(2); $today = total(1);
$mounth=total(3); $week = total(2);
$mounth = total(3);
$map1['promote_id'] = $map['promote_id']=array('gt',0);
$map1['pay_status'] = $map['pay_status']=1; $map1['promote_id'] = $map['promote_id'] = array('gt', 0);
$map1['pay_way'] = $map['pay_way'] = array('gt',0); $map1['pay_status'] = $map['pay_status'] = 1;
$map1['pay_way'] = $map['pay_way'] = array('gt', 0);
$userId = []; $userId = [];
$promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid()." or grand_id=". get_pid())->select(); $promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid() . " or grand_id=" . get_pid())->select();
$promoteId = array_column($promoteId,'id'); $promoteId = array_column($promoteId, 'id');
$promoteId = implode(',',$promoteId).",".get_pid(); $promoteId = implode(',', $promoteId) . "," . get_pid();
$whereUser['promote_id'] = ['IN',$promoteId]; $whereUser['promote_id'] = ['IN', $promoteId];
if ($type == 1) { if ($type == 1) {
$start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$whereUser['register_time'] = ['between',array($start,$end-1)]; $whereUser['register_time'] = ['between', array($start, $end - 1)];
$userId = M('user','tab_')->field('id')->where($whereUser)->select(); $userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
} else if ($type == 2) { } else if ($type == 2) {
$start = mktime(0, 0, 0, date('m'), 1, date('Y')); $start = mktime(0, 0, 0, date('m'), 1, date('Y'));
$end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1; $end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1;
$whereUser['register_time'] = ['between',array($start,$end-1)]; $whereUser['register_time'] = ['between', array($start, $end - 1)];
$userId = M('user','tab_')->field('id')->where($whereUser)->select(); $userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
} }
$userId = implode(',',array_column($userId,'id')); $userId = implode(',', array_column($userId, 'id'));
if ($userId) { if ($userId) {
$map1['user_id'] = $map['user_id']=['IN',$userId]; $map1['user_id'] = $map['user_id'] = ['IN', $userId];
} else if (!$userId&&$type!=0) { } else if (!$userId && $type != 0) {
return array('today'=>0,'mounth'=>0); return array('today' => 0, 'mounth' => 0);
} }
if ($create) { if ($create) {
$map['create_time'] = $create; $map['create_time'] = $create;
} }
$bindrecharge_data = M('bind_recharge','tab_') $bindrecharge_data = M('bind_recharge', 'tab_')
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
floor(sum(IF(create_time '.$pay_time.',real_amount,0))*100) as scount, floor(sum(IF(create_time ' . $pay_time . ',real_amount,0))*100) as scount,
floor(sum(IF(create_time '.$today.',real_amount,0))*100) as today, floor(sum(IF(create_time ' . $today . ',real_amount,0))*100) as today,
floor(sum(IF(create_time '.$week.',real_amount,0))*100) as week, floor(sum(IF(create_time ' . $week . ',real_amount,0))*100) as week,
floor(sum(IF(create_time '.$mounth.',real_amount,0))*100) as mounth') floor(sum(IF(create_time ' . $mounth . ',real_amount,0))*100) as mounth')
->where($map1) ->where($map1)
->group('promote_id') ->group('promote_id')
->select(false); ->select(false);
$deposit_data = M('deposit','tab_') $deposit_data = M('deposit', 'tab_')
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
floor(sum(IF(create_time '.$pay_time.',pay_amount,0))*100) as scount, floor(sum(IF(create_time ' . $pay_time . ',pay_amount,0))*100) as scount,
floor(sum(IF(create_time '.$today.',pay_amount,0))*100) as today, floor(sum(IF(create_time ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(create_time '.$week.',pay_amount,0))*100) as week, floor(sum(IF(create_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(create_time '.$mounth.',pay_amount,0))*100) as mounth') floor(sum(IF(create_time ' . $mounth . ',pay_amount,0))*100) as mounth')
// ->join('tab_user on tab_user.id = tab_spend.user_id','left') // ->join('tab_user on tab_user.id = tab_spend.user_id','left')
->where($map1) ->where($map1)
->group('promote_id') ->group('promote_id')
->select(false); ->select(false);
$spendData=$spend $spendData = $spend
->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, ->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time,
floor(sum(IF(pay_time '.$pay_time.',pay_amount,0))*100) as scount, floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as scount,
floor(sum(IF(pay_time '.$today.',pay_amount,0))*100) as today, floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(pay_time '.$week.',pay_amount,0))*100) as week, floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(pay_time '.$mounth.',pay_amount,0))*100) as mounth') floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
// ->join('tab_user on tab_user.id = tab_spend.user_id','left') // ->join('tab_user on tab_user.id = tab_spend.user_id','left')
->where($map) ->where($map)
->union(' ('.$bindrecharge_data.') ') ->union(' (' . $bindrecharge_data . ') ')
->union(' ('.$deposit_data.') ') ->union(' (' . $deposit_data . ') ')
->group('promote_id') ->group('promote_id')
->select(false); ->select(false);
$spendData = $spend->field('a.promote_account,a.promote_id,a.time,sum(a.scount) as count,sum(a.today) as today,sum(a.week) as week,sum(a.mounth) as mounth,IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1') $spendData = $spend->field('a.promote_account,a.promote_id,a.time,sum(a.scount) as count,sum(a.today) as today,sum(a.week) as week,sum(a.mounth) as mounth,IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1')
->join('tab_promote on promote_id = tab_promote.id','left') ->join('tab_promote on promote_id = tab_promote.id', 'left')
->where($condition) ->where($condition)
->table('('.$spendData.') as a')->group('promote_id1')->order('count desc,a.ordertime')->find(); ->table('(' . $spendData . ') as a')->group('promote_id1')->order('count desc,a.ordertime')->find();
$spendData['rand']=1; $spendData['rand'] = 1;
$spendData['count']=$spendData['count']/100; $spendData['count'] = $spendData['count'] / 100;
$spendData['today']=$spendData['today']/100; $spendData['today'] = $spendData['today'] / 100;
$spendData['week']=$spendData['week']/100; $spendData['week'] = $spendData['week'] / 100;
$spendData['mounth']=$spendData['mounth']/100; $spendData['mounth'] = $spendData['mounth'] / 100;
return $spendData; return $spendData;
} }
private function pay_total($type = 0, $newadd = 1,$promoteId="") private function pay_total($type = 0, $newadd = 1, $promoteId = "")
{ {
if ($_REQUEST['promote_id'] === null || $_REQUEST['promote_id'] === '0') { if ($_REQUEST['promote_id'] === null || $_REQUEST['promote_id'] === '0') {
$map['parent_id'] = get_pid(); $map['parent_id'] = get_pid();
@ -482,7 +483,7 @@ class PromoteController extends BaseController
} else { } else {
$menuData = M("promote_quick_menu ", "tab_")->where(array("promote_id" => get_pid()))->count(); $menuData = M("promote_quick_menu ", "tab_")->where(array("promote_id" => get_pid()))->count();
if ($menuData>=10) { if ($menuData >= 10) {
$this->ajaxReturn(['status' => 1, 'info' => '快捷菜单只能有10个'], "JSON"); $this->ajaxReturn(['status' => 1, 'info' => '快捷菜单只能有10个'], "JSON");
} }
M("promote_quick_menu ", "tab_")->add( M("promote_quick_menu ", "tab_")->add(
@ -524,12 +525,12 @@ class PromoteController extends BaseController
$count = M("document", "sys_")->where("category_id=56 and status=1")->count(); $count = M("document", "sys_")->where("category_id=56 and status=1")->count();
} }
$promote_id = get_pid(); $promote_id = get_pid();
$logCount = M('protect_log','tab_')->count(); $logCount = M('protect_log', 'tab_')->count();
$readLogCount = M('protect_log_read','tab_')->where("promote_id = {$promote_id}")->count(); $readLogCount = M('protect_log_read', 'tab_')->where("promote_id = {$promote_id}")->count();
$gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select(); $gg_data = M("document", "sys_")->where("category_id=56 and status=1")->order("update_time desc")->select();
$gg_Count = count($gg_data); $gg_Count = count($gg_data);
$gg_data = implode(',',array_column($gg_data,'id')); $gg_data = implode(',', array_column($gg_data, 'id'));
$gg_where = "promote_id = {$promote_id} and category_id=56"; $gg_where = "promote_id = {$promote_id} and category_id=56";
if ($gg_data) { if ($gg_data) {
@ -541,7 +542,7 @@ class PromoteController extends BaseController
$zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select(); $zx_data = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->select();
$zx_Count = count($zx_data); $zx_Count = count($zx_data);
$zx_data = implode(',',array_column($zx_data,'id')); $zx_data = implode(',', array_column($zx_data, 'id'));
$zx_where = "promote_id = {$promote_id} and category_id=51"; $zx_where = "promote_id = {$promote_id} and category_id=51";
if ($zx_data) { if ($zx_data) {
$zx_where .= " and document_id IN({$zx_data})"; $zx_where .= " and document_id IN({$zx_data})";
@ -558,9 +559,9 @@ class PromoteController extends BaseController
$this->meta_title = "公告列表"; $this->meta_title = "公告列表";
$this->assign("type", $type); $this->assign("type", $type);
$this->assign("data_list", $data_list); $this->assign("data_list", $data_list);
$this->assign("gg_count", $gg_Count-$gg_ReadDocument); $this->assign("gg_count", $gg_Count - $gg_ReadDocument);
$this->assign("zx_count", $zx_Count-$zx_ReadDocument); $this->assign("zx_count", $zx_Count - $zx_ReadDocument);
$this->assign("rz_count", $logCount-$readLogCount); $this->assign("rz_count", $logCount - $readLogCount);
$this->display(); $this->display();
} }
@ -837,7 +838,7 @@ class PromoteController extends BaseController
$map = []; $map = [];
$map['chain'] = ['like', $loginer['chain'] . $loginer['id'] . '/%']; $map['chain'] = ['like', $loginer['chain'] . $loginer['id'] . '/%'];
if ($promoteType == 0) { if ($promoteType == 0) {
$map['level'] = 2; $map['level'] = 2;
} elseif ($promoteType == 1) { } elseif ($promoteType == 1) {
@ -863,7 +864,7 @@ class PromoteController extends BaseController
} }
$query = M('promote', 'tab_')->where($map); $query = M('promote', 'tab_')->where($map);
list($records, $pagination, $count) = $this->paginate($query); list($records, $pagination, $count) = $this->paginate($query);
$ids = array_column($records, 'id'); $ids = array_column($records, 'id');
$countList = []; $countList = [];
@ -917,7 +918,7 @@ class PromoteController extends BaseController
} }
$status = $promoteService->addPromote($params, $parent); $status = $promoteService->addPromote($params, $parent);
if ($status) { if ($status) {
$this->ajaxReturn(['status' => 1, 'msg' => '添加成功']); $this->ajaxReturn(['status' => 1, 'msg' => '添加成功']);
} else { } else {
$this->ajaxReturn(['status' => 0, 'msg' => '添加失败']); $this->ajaxReturn(['status' => 0, 'msg' => '添加失败']);
} }
@ -926,7 +927,7 @@ class PromoteController extends BaseController
$loginer = $this->getLoginPromote(); $loginer = $this->getLoginPromote();
$promotes = null; $promotes = null;
$promoteColumns = ['id', 'account', 'real_name']; $promoteColumns = ['id', 'account', 'real_name'];
$promoteMap = ['chain' => ['like', $loginer['chain'] . $loginer['id'] . '/' . '%']]; $promoteMap = ['chain' => ['like', $loginer['chain'] . $loginer['id'] . '/' . '%']];
if ($loginer['level'] == 1) { if ($loginer['level'] == 1) {
if ($promoteType == 1) { if ($promoteType == 1) {
$promoteMap['level'] = 2; $promoteMap['level'] = 2;
@ -1857,9 +1858,15 @@ class PromoteController extends BaseController
//验证安全密码 //验证安全密码
$metaTitle = '设置'; $metaTitle = '设置';
$modelList = ['游戏管理', $metaTitle]; $modelList = ['游戏管理', $metaTitle];
$this->verifyPasswordView($modelList, $metaTitle); $res = $this->verifyPasswordView($modelList, ($_POST ? false : true));
if ($_POST) { if ($_POST) {
if ($res === false) {
$data['status'] = 0;
$data['msg'] = '权限异常';
$this->ajaxReturn($data);
}
$save['child_game_permission'] = I('post.child_game_permission'); $save['child_game_permission'] = I('post.child_game_permission');
$saveRes = D('Promote')->where(array('id' => PID))->save($save); $saveRes = D('Promote')->where(array('id' => PID))->save($save);
if ($saveRes === false) { if ($saveRes === false) {
@ -1877,6 +1884,7 @@ class PromoteController extends BaseController
$this->assign('data', $promoteData); $this->assign('data', $promoteData);
$this->meta_title = $metaTitle; $this->meta_title = $metaTitle;
$this->assign('modelList', $modelList);
$this->display(); $this->display();
} }
} }

@ -0,0 +1,184 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/index/index.new.css" rel="stylesheet" >
<style>
.form-group {
display: flex;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 120px;
height: 34px;
color: #515974;
}
.withdraw {
width: 200px;
height: 2.4rem;
border: 0;
border-radius: 5px;
color: #fff;
background-color: #358fe4;
cursor: pointer;
}
</style>
</block>
<block name="body">
<div class="page-overview promote-index-overview index-overview clearfix poll">
<ul>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi1.png"/></span></div> <div class="text text2"><p>历史收益</p><span>¥{$income.history_income}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi2.png"/></span></div> <div class="text text1"><p>本月收益</p><span>¥{$income.this_month_income}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi3.png"/></span></div> <div class="text text3"><p>昨日收益</p><span>¥{$income.yesterday_income}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi5.png"/></span></div> <div class="text text5"><p>账户余额</p><span>¥{$income.balance}</span></div> </li>
</ul>
</div>
<div style="margin-top: 2.4vh;">
<button class="withdraw" id="withdraw">提现</button>
</div>
<div class="page-list promote-index-list promote-index-list-news">
<div class="trunk-title-main"><span>{$meta_title}</span></div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<div class="form-group fl">
<label class="form-title select-title" style="position: relative;">时间:</label>
<div class="select-time">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="" value="{$initBegTime}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="" value="{$initEndTime}">
</div>
</div>
<div class="form-group normal_space fl">
<input type="submit" class="submit" id='submit' url="{:U('Finance/index','model='.$model['name'],false)}"
value="查询">
</div>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th>时间</th>
<th>收益</th>
<th>操作</th>
</tr>
<empty name="listData">
<tr><td colspan="3" style="text-align: center;height: 38vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<else />
<volist name="listData" id="data">
<tr>
<td>{$data.day}</td>
<td>{$data.income}</td>
<td><a href="{$data.url}">明细</a></td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/index/jquery.fxTab.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script>
$(function(){
var date = "";
$('#sdate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('#edate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left',
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('#submit').click(function () {
var sdate = Date.parse($('#sdate').val()) / 1000;
var edate = Date.parse($('#edate').val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间', {icon: 5});
return false;
}
if ((edate - sdate) > 2505600) {
layer.msg('时间间隔不能超过30天请重新选择日期', {icon: 5});
return false;
}
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$('#withdraw').click(function () {
var balance = parseFloat("{$income.balance}");
if (balance < 100) {
layer.msg('账户余额低于100元无法提现', {icon: 5});
return false;
}
var msg = "收益结算截止时间:{$yesterday}";
msg += "<br>";
msg += "提现金额:{$income.balance}元";
layer.confirm(msg, {
title: '信息',
btn: ['提交', '取消'],
}, function () {
$.ajax({
type: 'post',
url: '{:U("withdraw")}',
dataType: 'json',
data: {},
success: function (data) {
if (data.status == 1) {
layer.msg(data.msg, {icon: 1});
setTimeout(function(){
window.location.reload();
},2000);
} else {
layer.msg(data.msg, {icon: 5});
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
});
});
$(".select_gallery").select2();
});
</script>
</block>

@ -66,7 +66,15 @@
<div class="page-search normal_list query-recharge-search jssearch"> <div class="page-search normal_list query-recharge-search jssearch">
<div class="trunk-title"> <div class="trunk-title">
<div class="location"> <div class="location">
<div class="location-container">当前位置:<span>财务管理></span><span>{$meta_title}</span></div> <div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div> </div>
<img src="__IMG__/20180207/icon_chongzhi.png"> <img src="__IMG__/20180207/icon_chongzhi.png">
<span class="title_main">{$meta_title}</span> <span class="title_main">{$meta_title}</span>
@ -77,7 +85,7 @@
</div> </div>
<!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> --> <!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> -->
<div class="form-group normal_space" style="margin-left: 0;"> <div class="form-group normal_space" style="margin-left: 0;">
<input type="text" name="pay_order_number" class="txt normal_txt" placeholder="请输入游戏订单号" <input type="text" name="pay_order_number" class="txt normal_txt" placeholder="游戏订单号"
value="{:I('pay_order_number','')}"> value="{:I('pay_order_number','')}">
</div> </div>

@ -0,0 +1,223 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<link href="__CSS__/game_detailed.css" rel="stylesheet">
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.2" rel="stylesheet">
</block>
<block name="body">
<style>
@media screen and (max-width: 1500px) {
.normal_form {
padding-top: 45px;
}
.trunk-search .normal_txt {
width: 100px
}
.select2-container--default .select2-selection--single {
width: 125px;
}
.trunk-search .select-time .txt {
width: 100px;
}
.form-group .submit {
width: 55px;
}
}
.selected-color {
color: #2bd8ed;
}
.pointer-hand {
cursor: pointer;
}
.icon-spend {
position: relative;
font-size: 1.2rem;
top: 3px;
float: right;
right: 10px;
}
.th-hide {
display: none;
}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
.trunk-search {
padding-bottom: 10px;
}
.btn-role-border {
border-left: 0;
}
.normal_table tr td a {
cursor: pointer;
}
</style>
<div class="page-search normal_list query-recharge-search">
<div style="position: absolute;margin-top: -25px;color: #6a7082;">
<span class="back-btn" style="cursor: pointer;"><i class="iconfont iconreply"></i> 返回</span>
</div>
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_chongzhi.png">
<span class="title_main">{$meta_title}</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> -->
<div class="form-group normal_space" style="margin-left: 0;">
<label>游戏名称:</label>
<select id="game_id" name="game_id" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">全部</option>
<volist name=":getPromoteSearchGame()" id="vo">
<option value="{$vo.id}" title="{$vo.game_name}"
<if condition="I('game_id') eq $vo['id']">selected</if>
>{$vo.game_name} </option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<input type="text" name="user_account" class="txt normal_txt" placeholder="玩家账号"
value="{:I('user_account','')}">
</div>
<div class="form-group normal_space">
<input type="text" name="pay_order_number" class="txt normal_txt" placeholder="充值订单号"
value="{:I('pay_order_number','')}">
</div>
<div class="form-group normal_space">
<input type="hidden" name="id" value="{:I('get.id')}">
<input type="submit" class="submit" id='submit' url="{:U('Finance/withdrawDtl','model='.$model['name'],false)}"
value="查询">
</div>
<!-- </form> -->
</div>
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article" style="margin-left: 0;margin-right: 0;">
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>充值订单号</th>
<th>游戏</th>
<th>平台</th>
<th>玩家账号</th>
<th>订单总额</th>
<th>现金分成基数</th>
<th>平台币分成基数</th>
<th>平台币分成比例(直充|内充)</th>
<th>现金支付通道</th>
<th>收益</th>
<th>订单状态</th>
<th>充值时间</th>
</tr>
<empty name="listData">
<tr class="num2">
<td colspan="99" style="text-align: center;height: 45vh;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
</tr>
<else/>
<volist name="listData" id="vo">
<tr class="num2">
<td>{$vo.pay_order_number}</td>
<td>{$vo.game_name}</td>
<td>{:getSDKTypeName($vo['sdk_version'])}</td>
<td>{$vo.user_account}</td>
<td>{$vo.pay_amount}</td>
<if condition="$vo.pay_way eq -1">
<td>0</td>
<td>{$vo.pay_amount}</td>
<else/>
<td>{$vo.pay_amount}</td>
<td>0</td>
</if>
<td>{$vo.selle_ratio}%|{$vo.selle_ratio}%</td>
<td>{$vo.pay_way_name}</td>
<td>{$vo.income}</td>
<td>{$status}</td>
<td>{$vo.pay_time}</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
$().ready(function () {
$('.back-btn').on('click', function () {
location.href = "{:U('withdrawRecord')}";
});
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$(".select_gallery").select2();
});
</script>
</block>

@ -0,0 +1,267 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<link href="__CSS__/game_detailed.css" rel="stylesheet">
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.2" rel="stylesheet">
</block>
<block name="body">
<style>
@media screen and (max-width: 1500px) {
.normal_form {
padding-top: 45px;
}
.trunk-search .normal_txt {
width: 100px
}
.select2-container--default .select2-selection--single {
width: 125px;
}
.trunk-search .select-time .txt {
width: 100px;
}
.form-group .submit {
width: 55px;
}
}
.selected-color {
color: #2bd8ed;
}
.pointer-hand {
cursor: pointer;
}
.icon-spend {
position: relative;
font-size: 1.2rem;
top: 3px;
float: right;
right: 10px;
}
.th-hide {
display: none;
}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
.trunk-search {
padding-bottom: 10px;
}
.btn-role-border {
border-left: 0;
}
.normal_table tr td a {
cursor: pointer;
}
</style>
<div class="page-search normal_list query-recharge-search">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div>
<img src="__IMG__/20180207/icon_chongzhi.png">
<span class="title_main">{$meta_title}</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> -->
<div class="form-group normal_space" style="margin-left: 0;">
<input type="text" name="widthdraw_number" class="txt normal_txt" placeholder="提现订单号"
value="{:I('widthdraw_number','')}">
</div>
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">充值时间:</label>
<div class="select-time">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{$initBegTime}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{$initEndTime}">
</div>
</div>
<div class="form-group normal_space">
<input type="hidden" name="status" id="status" value="{$status}">
<input type="submit" class="submit" id='submit' url="{:U('Finance/withdrawRecord','model='.$model['name'],false)}"
value="查询">
</div>
<!-- </form> -->
</div>
<div class="tab marg_top20" style="margin-bottom: 20px;">
<div style="display: flex;">
<div class="btn btn-role <if condition='$status heq ""'>highlight</if>" status="">
<p>全部</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status heq 0'>highlight</if>" status="0">
<p>待审核</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status eq -1'>highlight</if>" status="-1">
<p>审核未通过</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status eq 1'>highlight</if>" status="1">
<p>汇款中</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status eq 2'>highlight</if>" status="2">
<p>已汇款</p>
</div>
</div>
</div>
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article" style="margin-left: 0;margin-right: 0;">
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>提现订单</th>
<th>提现日期</th>
<th>结算截止日期</th>
<th>收益金额</th>
<th>实际提现金额</th>
<th>提现状态</th>
<th>说明</th>
<th>操作</th>
</tr>
<empty name="listData">
<tr class="num2">
<td colspan="99" style="text-align: center;height: 45vh;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
</tr>
<else/>
<volist name="listData" id="vo">
<tr class="num2">
<td>{$vo.widthdraw_number}</td>
<td>{$vo.create_time}</td>
<td>{$vo.settlement_end_time}</td>
<td>{$vo.sum_money}</td>
<td>{$vo.sum_money}</td>
<td>{$vo.status}</td>
<td>{$vo.respond}</td>
<td>
<a href="{:U('withdrawDtl', array('id'=>$vo['id']))}">提现明细</a>
<a>汇款证明</a>
<a>结算单</a>
</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
$().ready(function () {
var date = "{$setdate}";
$('#sdate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('#edate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left',
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('.btn-role').on('click', function () {
var thisElement = $(this);
if (!thisElement.hasClass('highlight')) {
var status = thisElement.attr('status');
$('#status').val(status);
$('.btn-role').removeClass('highlight');
thisElement.addClass('highlight');
$('#submit').trigger('click');
}
});
$('#submit').click(function () {
var sdate = $('#sdate').val();
var edate = $('#edate').val();
if (Date.parse(sdate) > Date.parse(edate)) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$(".select_gallery").select2();
});
</script>
</block>

@ -111,7 +111,15 @@
<div class="page-list normal_list apply-index-list jssearch"> <div class="page-list normal_list apply-index-list jssearch">
<div class="trunk-title"> <div class="trunk-title">
<div class="location"> <div class="location">
<div class="location-container">当前位置:<span>游戏管理></span><span>{$meta_title}</span></div> <div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div> </div>
<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span> <img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span>
</div> </div>

@ -27,7 +27,15 @@
<div class="page-list normal_list apply-index-list"> <div class="page-list normal_list apply-index-list">
<div class="trunk-title"> <div class="trunk-title">
<div class="location"> <div class="location">
<div class="location-container">当前位置:<span>游戏管理></span><span>{$meta_title}</span></div> <div class="location-container">当前位置:
<volist name="modelList" id="vo" key="k">
<?php if ($k == count($modelList)) {
echo "<span>$vo</span>";
} else {
echo "<span>$vo></span>";
}?>
</volist>
</div>
</div> </div>
<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span> <img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span>
</div> </div>

@ -69,15 +69,14 @@
</div> </div>
<?php endif;?> <?php endif;?>
<?php if ($loginer['level'] == 1) :?>
<div class="subNav jssubNav"><i class="prev_icon icon_caiwu"></i><span>财务管理</span><i class="arrow_icon"></i></div> <div class="subNav jssubNav"><i class="prev_icon icon_caiwu"></i><span>财务管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent"> <div class="navContent jsnavContent">
<a href="{:U('Finance/index')}" class="<if condition='CONTROLLER_NAME eq Finance and ACTION_NAME eq index '>active</if> ">结算中心</a>
<a href="{:U('Finance/settlementDtl')}" class="<if condition='CONTROLLER_NAME eq Finance and ACTION_NAME eq settlementDtl '>active</if> ">结算明细</a> <a href="{:U('Finance/settlementDtl')}" class="<if condition='CONTROLLER_NAME eq Finance and ACTION_NAME eq settlementDtl '>active</if> ">结算明细</a>
<a href="{:U('Finance/withdrawRecord')}" class="<if condition='CONTROLLER_NAME eq Finance and (ACTION_NAME eq withdrawRecord or ACTION_NAME eq withdrawDtl) '>active</if> ">提现记录</a>
<lt name="Think.const.PRO_GRADE" value="3">
<a href="{:U('Query/son_earning')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq son_earning or ACTION_NAME eq son_list)'>active</if> ">子渠道结算</a>
</lt>
</div> </div>
<?php endif ;?>
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>游戏管理</span><i class="arrow_icon"></i></div> <div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>游戏管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent"> <div class="navContent jsnavContent">
<!-- <a href="{:U('Apply/app_index')}" class="<if condition='CONTROLLER_NAME eq Apply and ACTION_NAME eq app_index '>active</if> ">APP列表</a>--> <!-- <a href="{:U('Apply/app_index')}" class="<if condition='CONTROLLER_NAME eq Apply and ACTION_NAME eq app_index '>active</if> ">APP列表</a>-->

@ -59,7 +59,6 @@
</volist> </volist>
</div> </div>
</div> </div>
<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">{$meta_title}</span>
<span class="title_main">安全密码</span> <span class="title_main">安全密码</span>
</div> </div>
<div class="trunk-content article"> <div class="trunk-content article">

@ -336,5 +336,10 @@ CREATE TABLE `tab_spend_user_count` (
KEY `count_date` (`count_date`) USING BTREE KEY `count_date` (`count_date`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表'; ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表';
-- 2019-11-6 cxj
ALTER TABLE `tab_spend` ADD COLUMN `withdraw_id` int(11) NOT NULL DEFAULT 0 COMMENT '提现ID' AFTER `pay_url`;
ALTER TABLE `tab_withdraw` ADD COLUMN `settlement_end_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算截止时间' AFTER `old_promote_account`;
-- 2019-11-07 elf 迁移任务
ALTER TABLE `sys_shift_task` ADD COLUMN `shift_ids` varchar(255) NOT NULL DEFAULT '' COMMENT '迁移ID'; ALTER TABLE `sys_shift_task` ADD COLUMN `shift_ids` varchar(255) NOT NULL DEFAULT '' COMMENT '迁移ID';
ALTER TABLE `sys_shift_task` ADD COLUMN `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注'; ALTER TABLE `sys_shift_task` ADD COLUMN `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注';

@ -1,5 +1,11 @@
{ {
"require": { "require": {
"rodneyrehm/plist": "^2.0" "rodneyrehm/plist": "^2.0"
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
} }
} }

Loading…
Cancel
Save