From f8b93616cece026bf94398d03e10b51352e756ff Mon Sep 17 00:00:00 2001 From: liyang <316606755@qq.com> Date: Tue, 9 Mar 2021 20:58:18 +0800 Subject: [PATCH 01/37] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=B0=81=E8=A3=85?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/BaseController.class.php | 166 +++++++++++++++++- .../Controller/PromoteController.class.php | 1 + .../Home/View/default/Promote/edit_chlid.html | 13 ++ .../View/default/Public/promote_base.html | 33 +++- 4 files changed, 204 insertions(+), 9 deletions(-) diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index 3705e3848..9261013fd 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -5,12 +5,12 @@ namespace Home\Controller; use Base\Service\PromoteCompanyService; use Think\Controller; use Base\Service\PromoteService; - class BaseController extends HomeController { protected $promotePermissions; protected $loginPromote = null; protected $canViewUserRecharge = true; + protected $isOpenQuery =true; protected $permControlUrls = [ 'Home/Query/recharge', @@ -58,6 +58,8 @@ class BaseController extends HomeController $this->assign("grand_id", $loginer['grand_id']); $this->assign('canViewUserRecharge', $this->canViewUserRecharge); + $this->assign("menus", $this->getMenus($loginer,$this->isOpenQuery,$this->canViewUserRecharge)); + $result = M('site_apply', 'tab_')->where("promote_id=$pid")->getField('status'); if ($result['status'] == 1) { $this->assign('noapplysite', $result); @@ -431,4 +433,166 @@ class BaseController extends HomeController ->group('relation_game_id') ->select(); } + + function promote_is_active_class($promoteType) + { + return is_active_class( + ['Promote'], + ['children', 'addPromote', 'edit_chlid'], + function() use($promoteType) { + return $_GET["promote_type"] == $promoteType; + } + ); + } + /** + * 全部菜单 + * @return array[] + */ + function getMenus($loginer,$isOpenQuery,$canViewUserRecharge) + { + $menus =[ + [ + 'name' => '管理中心', + 'class'=>'prev_icon icon_guanli', + 'children'=>[ + ['name' => '部门长管理', 'url' => U('Promote/children', ['promote_type' => 0]), 'class'=>$this->promote_is_active_class(0),'perms'=>[ + 'level'=>[1] + ]], + ['name' => '组长管理', 'url' => U('Promote/children', ['promote_type' => 1]), 'class'=>$this->promote_is_active_class(1),'perms' => [ + 'level'=>[1,2,] + ]], + ['name' => '推广员管理', 'url' => U('Promote/children', ['promote_type' => 2]), 'class'=>$this->promote_is_active_class(2),'perms' => [ + 'level'=>[1,2,3] + ]] + ], + 'perms' => [ + 'level'=>[1,2,3], + ] + + ], + [ + 'name' => '数据管理', + 'class'=>'prev_icon icon_shujvi', + 'children'=>[ + ['name' => '每日概况', 'url' => U('Query/dailySummary'), 'class'=>is_active_class(['Query'], ['dailySummary']),], + ['name' => '数据汇总', 'url' => U('Query/summary'), 'class'=>is_active_class(['Query'], ['summary']),], + ['name' => '订单查询', 'url' => U('Query/recharge'), 'class'=>is_active_class(['Query'], ['recharge', 'viewSpendDetailed']),'perms' => [ + 'view-recharge'=>true + ]], + ['name' => '注册明细', 'url' => U('Query/register'), 'class'=>is_active_class(['Query'], ['register', 'viewRole']),], + ['name' => 'ARPU统计', 'url' => U('Query/arpu'), 'class'=>is_active_class(['Query'], ['arpu']),'perms' => [ + 'view-recharge'=>true + ]], + ['name' => '角色查询', 'url' => U('Query/userRoles'), 'class'=>is_active_class(['Query'], ['userRoles']),], + ['name' => '充值玩家', 'url' => U('Query/userRecharges'), 'class'=>is_active_class(['Query'], ['userRecharges']),'perms' => [ + 'view-recharge'=>true + ]], + ['name' => '团队/推广员业绩', 'url' => U('Query/achievement'), 'class'=>is_active_class(['Query'], ['achievement']),], + ['name' => 'IOS下载数统计', 'url' => U('Query/iosDownLoadData'), 'class'=>is_active_class(['Query'], ['iosDownLoadData']),], + ['name' => '用户留存率', 'url' => U('Query/userretention'), 'class'=>is_active_class(['Query'], ['userretention']),], + ['name' => '游戏分区数据汇总', 'url' => U('Query/gameData'), 'class'=>is_active_class(['Query'], ['gameData']),], + ], + 'perms' => [ + 'OpenQuery'=>$this->isOpenQuery, + ] + ], + [ + 'name' => '财务管理', + 'class'=>'prev_icon icon_caiwu', + 'children'=>[ + ['name' => '结算中心', 'url' => U('Finance/index'), 'class'=>is_active_class(['Finance'], ['index']),], + ['name' => '结算明细', 'url' => U('Finance/settlementDtl'), 'class'=>is_active_class(['Finance'], ['settlementDtl']),], + ['name' => '提现记录', 'url' => U('Finance/withdrawRecord'), 'class'=>is_active_class(['Finance'], ['withdrawRecord', 'withdrawDtl', 'settlementOrder']),],//// + ['name' => '公司结算', 'url' => U('Withdraw/index'), 'class'=>is_active_class(['Withdraw'], ['index', 'withdrawDetail', 'withdrawOrderDetail']),'perms' => [ + 'withdraw_show'=> 1 + ]]// + ], + 'perms' => [ + 'view-recharge'=>true, 'level'=>1 + ] + ], + [ + 'name' => '游戏管理', + 'class'=>'prev_icon icon_fenbao', + 'children'=>[ + ['name' => '专服管理', 'url' => U('Game/index'), 'class'=>is_active_class(['Game'], ['index']),], + ['name' => '混服管理', 'url' => U('Game/mix'), 'class'=>is_active_class(['Game'], ['mix']),], + ['name' => '分成比例', 'url' => U('GameDivide/index'), 'class'=>is_active_class(['GameDivide'], ['index']),], + ['name' => '设置', 'url' => U('Promote/setChildGamePermission'), 'class'=>is_active_class(['Promote'], ['setChildGamePermission']),],///// + ['name' => '资料专区', 'url' => U('Apply/feature'), 'class'=>is_active_class(['Apply'], ['feature']),] + ] + ], + [ + 'name' => '安全管理', + 'class'=>'prev_icon icon_fenbao', + 'children'=>[ + ['name' => '短信登录设置', 'url' => U('Safe/bindTel'), 'class'=>is_active_class(['Safe'], ['bindTel']),], + ['name' => '下载日志管理', 'url' => U('Download/listsIndex'), 'class'=>is_active_class(['Download'], ['listsIndex']),], + ['name' => '修改登录密码', 'url' => U('Safe/modifyloginpassword'), 'class'=>is_active_class(['Safe'], ['modifyloginpassword']),], + ['name' => '设置安全密码', 'url' => U('Safe/setSafeIndex'), 'class'=>is_active_class(['Safe'], ['setSafeIndex']),], + ['name' => '用户基本信息', 'url' => U('Safe/modifyBaseInfo'), 'class'=>is_active_class(['Safe'], ['modifyBaseInfo']),], + ['name' => '操作日志', 'url' => U('Safe/promoteLogs'), 'class'=>is_active_class(['Safe'], ['promoteLogs']),], + ] + ], + [ + 'name' => '测试资源', + 'class'=>'prev_icon icon_fenbao', + 'children'=>[ + ['name' => '测试资源申请', 'url' => U('TestingResource/index'), 'class'=>is_active_class(['TestingResource'], ['index']),], + ['name' => '测试资源申请记录', 'url' => U('TestingResource/batches'), 'class'=>is_active_class(['TestingResource'], ['batches']),], + ] + ], + [ + 'name' => '评级管理', + 'class'=>'prev_icon icon_fenbao', + 'children'=>[ + ['name' => '评级设定', 'url' => U('PromoteGrade/settings'), 'class'=>is_active_class(['PromoteGrade'], ['settings', 'setting']),], + ['name' => '>团队评级', 'url' => U('PromoteGrade/index'), 'class'=>is_active_class(['PromoteGrade'], ['index']),], + ] + ], + [ + 'name' => '平台币管理', + 'class'=>'prev_icon icon_fuli', + 'children'=>[ + ['name' => '我的平台币', 'url' => U('PromoteCoin/myCoin'), 'class'=>is_active_class(['PromoteCoin'], ['myCoin', 'coinRecord', 'coinRecordDesc']),], + ['name' => '平台币转移', 'url' => U('PromoteCoin/transferLogs'), 'class'=>is_active_class(['PromoteCoin'], ['shift', 'transferLogs']),], + ['name' => '平台币充值', 'url' => U('CoinOrder/order_list'), 'class'=>is_active_class(['CoinOrder'], ['order_list', 'order_add', 'order_detail']),], + ] + ], + [ + 'name' => '玩家管理', + 'class'=>'prev_icon icon_fuli', + 'children'=>[ + ['name' => '行为日志', 'url' => U('TestingResource/index'), 'class'=>is_active_class(['TestingResource'], ['index']),], + ] + ], + ]; + +// if ($loginer['level'] >= 4){ +// unset($menus[0]); +// } +// if ($loginer['level'] == 2){ +// unset($menus[0]['children'][0]); +// } +// if ($loginer['level'] == 3){ +// unset($menus[0]['children'][0]); +// unset($menus[0]['children'][1]); +// } + + foreach ($menus as $menu =>$v){ + if (isset($v['perms'])) + foreach ($v['children'] as $m){ + + } + } + + $permHandles = [ + 'level' => function($level, $levels) { + return in_array($level, $levels); + }, + 'view-recharge' => function ($canViewRecharge) { + reutrn $canViewRecharge; + } + ]; + } } diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index a7ce79580..f01709edb 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -1395,6 +1395,7 @@ class PromoteController extends BaseController $se['bank_account'] = $_REQUEST['bank_account']; $se['account_openin'] = $_REQUEST['account_openin']; $se['bank_area'] = $_REQUEST['s_province'] . ',' . $_REQUEST['s_city'] . ',' . $_REQUEST['s_county']; + $se['ts_over_manage'] = $_REQUEST['ts_over_manage']; $res = M("promote", "tab_")->where($map)->save($se); if ($res !== false) { diff --git a/Application/Home/View/default/Promote/edit_chlid.html b/Application/Home/View/default/Promote/edit_chlid.html index 86e011431..8943acbc3 100644 --- a/Application/Home/View/default/Promote/edit_chlid.html +++ b/Application/Home/View/default/Promote/edit_chlid.html @@ -79,6 +79,19 @@ + + 测试资源管理权限: + + + + + + + diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index b292b77dd..ca8a11d8f 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -37,10 +37,24 @@ - + –> - + <!––> @@ -231,6 +245,9 @@ $(this).next(".jsnavContent").slideToggle(300).siblings(".jsnavContent").slideUp(500); }); }); + var ts_over_manage = "" + + console.log(ts_over_manage); From 17cee767b76cabf8a4c4f4f2c360c2d1a9630cee Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 10 Mar 2021 20:22:18 +0800 Subject: [PATCH 02/37] =?UTF-8?q?=E5=AD=90=E7=AB=99=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SubSpendSetController.class.php | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 Application/Admin/Controller/SubSpendSetController.class.php diff --git a/Application/Admin/Controller/SubSpendSetController.class.php b/Application/Admin/Controller/SubSpendSetController.class.php new file mode 100644 index 000000000..26beae6df --- /dev/null +++ b/Application/Admin/Controller/SubSpendSetController.class.php @@ -0,0 +1,107 @@ +1, + "partner_type"=>["in",[0,PARTNER_TYPE]] + ]; + + public function _initialize() + { + $this->SubSpendModel = M("spend","tab_",SUBSITE_DB);//指定子库 + $this->MainSpendModel = M("spend","tab_");//指定子库 + $this->SubKvModel = M("Kv","sub_",SUBSITE_DB);//指定子库 + $this->LastSynTime = $this->SubKvModel->where("`key` = 'sub_spend_syn_time'")->getField("value"); + } + + public function setSubSpend($time) + { + if($time == '') die("时间不能为空"); + //判断日期格式 + $patten = "/^\d{4}[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])$/"; + if (!preg_match($patten, $time)) { + die("时间格式错误"); + } + if(strtotime($time)+86399-24*3600 > time()){ + die("时间不能大于当前"); + } + $this->SynTime = strtotime($time)+86399; + if($this->SynTime <= $this->LastSynTime){ + die("时间不能小于最后同步时间"); + } + $this->SynWhere['payed_time'] = ['between', [$this->LastSynTime-0+1,$this->SynTime]]; + + if($this->pageSetSpend()){ + $this->updateLastSynTime(); + }; + echo "sub_spend syn ok".PHP_EOL; + } + + public function recountSubSpend($begin,$end) + { + $patten = "/^\d{4}[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])$/"; + if (!preg_match($patten, $begin)) { + die("开始时间格式错误"); + } + if (!preg_match($patten, $end)) { + die("结束时间格式错误"); + } + if(strtotime($end) < strtotime($begin)){ + die("结束时间不能比开始时间小"); + } + if(strtotime($end)+86399 > $this->LastSynTime){ + die("结束时间不能大于最后同步时间"); + } + $end = strtotime($end)+86399; + $begin = strtotime($begin); + $this->SynWhere['payed_time'] = ['between', [$begin,$end]]; + if($this->delSubSpend() !== false){ + echo "delete sub_spend ok".PHP_EOL; + $this->pageSetSpend(); + } + echo "sub_spend update and syn ok".PHP_EOL; + } + //分页插入同步数据 + protected function pageSetSpend() + { + $count = $this->getSynCount(); + if(empty($count)) return true; + $pageCount = ceil($count/self::LIMIT); + for ($i=1; $i <= $pageCount; $i++) { + $tres = $this->MainSpendModel->where($this->SynWhere)->page($i,self::LIMIT)->select(); + $addRes = $this->SubSpendModel->addAll($tres); + echo "[{$i}/{$pageCount}] {$addRes}".PHP_EOL; + } + return true; + } + //删除本地已同步数据 + protected function delSubSpend() + { + return $this->SubSpendModel->where($this->SynWhere)->delete(); + } + //获取需要同步的数量 + protected function getSynCount() + { + return $this->MainSpendModel->where($this->SynWhere)->count(); + } + //更新最后同步时间 + protected function updateLastSynTime() + { + return $this->SubKvModel->where("`key` = 'sub_spend_syn_time'")->save(['value'=>$this->SynTime]); + } + + +} From 8b98460242f290ccda43eda8398c5cb07eef9c77 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 10 Mar 2021 20:23:41 +0800 Subject: [PATCH 03/37] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/SubSpendSetController.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Application/Admin/Controller/SubSpendSetController.class.php b/Application/Admin/Controller/SubSpendSetController.class.php index 26beae6df..f81ddbe20 100644 --- a/Application/Admin/Controller/SubSpendSetController.class.php +++ b/Application/Admin/Controller/SubSpendSetController.class.php @@ -4,6 +4,8 @@ namespace Admin\Controller; use Think\Controller; /** * 子站同步支付信息 + * @example 按日期同步: php wm.php SubSpendSet/setSubSpend/time/2019-09-31 + * @example 重算更新: php wm.php SubSpendSet/recountSubSpend/begin/2019-01-01/end/2019-09-31 * @author cz */ class SubSpendSetController extends Controller From bb10181cc5fc7ac5b7193a1b85759e75287aabe9 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 11 Mar 2021 18:23:18 +0800 Subject: [PATCH 04/37] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=90=E7=AB=99?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E8=AE=A2=E5=8D=95=E5=8F=8A=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 12 +- .../Controller/SubSpendController.class.php | 288 +++++++ Application/Admin/View/SubSpend/lists.html | 786 ++++++++++++++++++ 3 files changed, 1083 insertions(+), 3 deletions(-) create mode 100644 Application/Admin/Controller/SubSpendController.class.php create mode 100644 Application/Admin/View/SubSpend/lists.html diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index da7e1ef3d..f293def63 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1087,6 +1087,12 @@ class ExportController extends Controller $startTime = strtotime($startDate); $endTime = strtotime($endDate) + 86399; $map['pay_time'] = array('BETWEEN', array($startTime, $endTime)); + $is_sub_data = I("issubdata",0); + if($is_sub_data == 1){ + $SpendModel = M("spend","tab_",SUBSITE_DB); + }else{ + $SpendModel = M("spend","tab_"); + } unset($_REQUEST['timestart']); unset($_REQUEST['timeend']); @@ -1201,7 +1207,7 @@ class ExportController extends Controller D("Spend")->addSubsiteWhere($map); $map1 = $map; $map1['pay_status'] = 1; - $total = M('Spend','tab_')->where($map1)->sum('pay_amount'); + $total = $SpendModel->where($map1)->sum('pay_amount'); // var_dump($total);die(); $total=$total?$total:0; @@ -1277,7 +1283,7 @@ class ExportController extends Controller mb_convert_variables('GBK', 'UTF-8', $xlsCell); fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 - $accessNum = M('Spend',"tab_") + $accessNum = $SpendModel ->where($map) ->count(); @@ -1286,7 +1292,7 @@ class ExportController extends Controller // var_dump($count);die(); for($i = 1; $i <= $pages; $i++) { - $xlsData = M('Spend',"tab_") + $xlsData = $SpendModel ->field($fields) ->where($map) ->limit(($i-1)*$perSize ,$perSize) diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php new file mode 100644 index 000000000..658bd5a89 --- /dev/null +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -0,0 +1,288 @@ + + */ +class SubSpendController extends ThinkController +{ + const model_name = 'Spend'; + public $OpAuthList; + + public function lists() + { + list($is_sub_data, $startTime, $endTime) = $this->setSelectDate(); + // dump($is_sub_data); + // dump($startTime); + // dump($endTime); + // dd(1); + $map['pay_time'] = array('BETWEEN', array($startTime, $endTime)); + if (isset($_REQUEST['is_check'])) { + $map['is_check'] = (int)($_REQUEST['is_check']); + } + + if (isset($_REQUEST['user_account'])) { + $map['user_account'] = array('like', trim($_REQUEST['user_account'])); + unset($_REQUEST['user_account']); + } + if (isset($_REQUEST['spend_ip'])) { + $map['spend_ip'] = array('like', trim($_REQUEST['spend_ip']) . '%'); + unset($_REQUEST['spend_ip']); + } + if (isset($_REQUEST['game_name'])) { + if ($_REQUEST['game_name'] == '全部') { + unset($_REQUEST['game_name']); + } else { + $map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')]; + unset($_REQUEST['game_name']); + } + } + if (isset($_REQUEST['game_type']) && $_REQUEST['game_type']) { + $map['sdk_version'] = $_REQUEST['game_type']; + } + if (isset($_REQUEST['server_id'])) { + $map['server_id'] = $_REQUEST['server_id']; + unset($_REQUEST['server_id']); + } + if (isset($_REQUEST['pay_order_number'])) { + $map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number'])); + unset($_REQUEST['pay_order_number']); + } + if (isset($_REQUEST['extend'])) { + $map['extend'] = array('like', trim($_REQUEST['extend'])); + unset($_REQUEST['extend']); + } + if (isset($_REQUEST['pay_status'])) { + $map['pay_status'] = $_REQUEST['pay_status']; + unset($_REQUEST['pay_status']); + } + if (isset($_REQUEST['pay_way'])) { + if ($_REQUEST['pay_way'] == 2) { + $map['pay_way'] = ['in', '2,3,4']; + } else { + $map['pay_way'] = $_REQUEST['pay_way']; + } + unset($_REQUEST['pay_way']); + } + if (isset($_REQUEST['pay_game_status'])) { + $map['pay_game_status'] = $_REQUEST['pay_game_status']; + unset($_REQUEST['pay_game_status']); + } + + if ($_REQUEST['merchant_id']) { + $map['merchant_id'] = $_REQUEST['merchant_id']; + unset($_REQUEST['merchant_id']); + } + + $marketAdminId = 0; + $isMarketAdmin = isMarketAdmin(); + if ($isMarketAdmin) { + $userAuth = session('user_auth'); + $marketAdminId = $userAuth['uid']; + } else { + $marketAdminId = I('market_admin_id', 0); + } + if ($marketAdminId > 0) { + $map['market_admin_id'] = $marketAdminId; + } else { + setPowerPromoteIds($map,'promote_id'); + } + + if (isset($_REQUEST['promote_id'])) { + $promoteId = intval($_REQUEST['promote_id']); + if ($promoteId == 0) { + $map['promote_id'] = 0; + } else { + $promoteMap['chain'] = ['like', "%/$promoteId/%"]; + $promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true); + $promoteIds[] = $promoteId; + $map['promote_id'] = ['in', $promoteIds]; + } + } + if ($_REQUEST['data_order'] != '') { + $data_order = reset(explode(',', $_REQUEST['data_order'])); + $data_order_type = end(explode(',', $_REQUEST['data_order'])); + $this->assign('userarpu_order', $data_order); + $this->assign('userarpu_order_type', $data_order_type); + $sort = $data_order == 3 ? 'desc' : 'asc'; + $order = $data_order_type . ' ' . $sort; + } else { + $order = ' pay_time desc '; + } + if (I('platform_type', 0) != 0) { + $sy = I('platform_type', 0) == 1 ? '=' : '<>'; + $game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true); + $map['game_id'] = ['in',$game_id]; + } + + // if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) { + // $map1 = $map; + // $map1['pay_status'] = 1; + // } else { + // $map = '1 = 2'; + // $map1 = $map; + // } + $this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]); + D("Spend")->addSubsiteWhere($map); + + $map1 = $map; + $map1['pay_status'] = 1; + $total = null_to_0(M(self::model_name,"tab_")->where($map1)->sum('pay_amount')); + $this->assign('total', $total); + $this->meta_title = $this->m_title = '游戏充值'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find()); + + $data = $this->getSpendList($_GET["p"], $map, $order,$is_sub_data); + if (!empty($data['data'])) { + $adminUsernameList = getAdminUsernameList(array_column($data['data'], 'market_admin_id')); + foreach ($data['data'] as $key=>&$value) { + ($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):''; + $value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无'; + $value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']]; + //拆分游戏名称和设备类型 + $game_arr = explode("(", rtrim($value['game_name'], ")")); + $value['game_name'] = $game_arr[0]; + $value['sdk_version_name'] = $game_arr[1]; + } + } + + $this->assign('showMarketAdmin', session('user_auth')['show_market_admin']); + $this->assign('showPromote', session('user_auth')['show_promote']); + $this->assign('isMarketAdmin', $isMarketAdmin); + $this->assign('marketAdmins', getMarketAdmins()); + $this->assign('list_data', $data['data']); + $this->assign('_page', $data['page']); + $show_data_power = (is_administrator()|| session('user_auth')['show_data']); + $this->assign('show_data_power', $show_data_power); + + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + + $this->assign('menubtn',$this->menuAuth()); + $this->display(); + } + + protected function menuAuth() + { + $mentBtn = [ + "addStatement"=>"参与结算", + "removeStatement"=>"移出结算", + ]; + $resarr = []; + foreach ($mentBtn as $k => $v) { + if(IS_ROOT){ + $resarr[] = $v; + }else{ + if(in_array($k,$this->OpAuthList)){ + $resarr[] = $v; + } + } + } + return $resarr; + } + + public function addStatement() + { + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $this->editOrderIscheck($ids,2,1); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"操作成功" + )); + } + public function removeStatement() + { + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $this->editOrderIscheck($ids,1,2); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"操作成功" + )); + + } + protected function editOrderIscheck($ids,$oldval,$newval){ + $dbres = D(self::model_name)->where("id in ({$ids}) and is_check = '{$oldval}'")->select(); + if(empty($dbres)) return false; + + $changeIds = implode(",",array_column($dbres,"id")); + //执行操作 + $res = D(self::model_name)->where("id in ({$changeIds}) and is_check = '{$oldval}'")->save(['is_check'=>$newval]); + if(empty($res)) return false; + //日志 + if($newval == 1){ + $op_name = "加入结算"; + $key = "addStatement"; + }else{ + $op_name = "移出结算"; + $key = "removeStatement"; + } + addOperationLog(['op_type'=>1,'key'=>$key,"op_name"=>$op_name,"content"=>json_encode(["ids"=>$_REQUEST['ids'],"is_check"=>$newval])]); + return true; + } + protected function setSelectDate() + { + $startDate = empty($_REQUEST['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $_REQUEST['timestart']; + $endDate = empty($_REQUEST['timeend']) ? date('Y-m-d') : $_REQUEST['timeend']; + unset($_REQUEST['timestart']); + unset($_REQUEST['timeend']); + $startTime = strtotime($startDate); + $endTime = strtotime($endDate) + 86399; + $is_sub_data = false; + $lastSynTime = M("Kv","sub_",SUBSITE_DB)->where("`key` = 'sub_spend_syn_time'")->getField("value"); + if($lastSynTime >= $startTime && $lastSynTime < $endTime){ + $this->redirect(ACTION_NAME, array('timestart' => $startDate,"timeend"=>date('Y-m-d',$lastSynTime))); + } + if($lastSynTime >= $startTime && $lastSynTime <= $endTime){ + $is_sub_data = true; + $endTime = $lastSynTime; + } + if($lastSynTime > $endTime){ + $is_sub_data = true; + } + + $this->assign('startDate', date('Y-m-d',$startTime)); + $this->assign('endDate', date('Y-m-d',$endTime)); + $this->assign('isSubData', $is_sub_data ? 1 : 0); + $this->assign('lastSynTime', date('Y-m-d',$lastSynTime)); + return [$is_sub_data,$startTime,$endTime]; + } + + protected function getSpendList($p = 1, $map = array(), $order, $is_sub_data) + { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + if($is_sub_data){ + $SpendModel = M("spend","tab_",SUBSITE_DB); + }else{ + $SpendModel = M("spend","tab_"); + } + + $list = $SpendModel + ->where($map) + ->page($page, $row) + ->order($order ? $order : 'pay_time desc') + ->select(); + $count = $SpendModel->where($map)->count(); + + if($count < 20000){ + $page = set_pagination_all($count, $row); + }else{ + $page = set_pagination($count, $row); + } + $data['data'] = $list; + if ($page) { + $data['page'] = $page; + } + return $data; + } + +} diff --git a/Application/Admin/View/SubSpend/lists.html b/Application/Admin/View/SubSpend/lists.html new file mode 100644 index 000000000..9471afbe4 --- /dev/null +++ b/Application/Admin/View/SubSpend/lists.html @@ -0,0 +1,786 @@ + + + + + + + + + + + +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ + - +
+ + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + +
+ + - +
+
+ +
+ + + +
+ +
+ + +
+ +
+ +
+ +
+
+ + +
+ +
+ + + +
+ 搜索 +
+
+ +
+
+
+ + {$vo} + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
支付订单号CP订单号 + + 充值时间 + 支付时间玩家账号游戏名称设备类型所属推广员所属市场专员所属商户充值ip区服ID游戏区服角色ID角色名称订单金额 + + 实付金额 + 充值方式订单状态游戏通知状态是否参与结算操作
aOh! 暂时还没有内容!
+ + {$data.pay_order_number} + + {$data.pay_order_number|encryptStr} + + + + {$data.extend} + + {$data.extend|encryptStr} + + {:set_show_time($data['pay_time'])} + + {:set_show_time($data['payed_time'])} + + ------ + + + + {$data.user_account} + + {$data.user_account|encryptStr} + + ({$data.small_account}){$data.game_name}{$data.sdk_version_name} + C('OFFICIEL_CHANNEL') + + {$data['promote_account']} + + + {$data.market_admin_username}{:getMerchantName($data['merchant_id'])}{$data.spend_ip}— —— —{$data.server_id}{$data.server_name}— —— —{$data.game_player_id}{$data.game_player_name}{$data.cost|default=0.00}{$data.pay_amount}{:get_pay_way($data['pay_way'])} + {:get_info_status($data['pay_status'],9)} + + {:get_info_status($data['pay_status'],9)} + + + {:get_info_status($data['pay_game_status'],14)} + + — — + + {:get_info_status($data['pay_game_status'],14)} + + {$data.is_check_str} + + + + 补单 + + + 补单 + + + + +
+ + + 通知到账 + + +
汇总 + 当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))} + + 累计充值:{$total}(此处只汇总充值成功的订单) +
+
+
+
+ + 导出 + + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + From 1de381bccd1a9e843149ac28c3a1ef9b04214918 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 12 Mar 2021 14:26:26 +0800 Subject: [PATCH 05/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/SubSpendController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php index 658bd5a89..1ad95e6de 100644 --- a/Application/Admin/Controller/SubSpendController.class.php +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -205,7 +205,7 @@ class SubSpendController extends ThinkController } protected function editOrderIscheck($ids,$oldval,$newval){ - $dbres = D(self::model_name)->where("id in ({$ids}) and is_check = '{$oldval}'")->select(); + $dbres = M("spend","tab_",SUBSITE_DB)->where("id in ({$ids}) and is_check = '{$oldval}'")->select(); if(empty($dbres)) return false; $changeIds = implode(",",array_column($dbres,"id")); From 6790ab5fd352a827b02686f855c7354e52dd9bc3 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 15 Mar 2021 18:35:01 +0800 Subject: [PATCH 06/37] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=87=8D=E7=AE=97=E5=8F=8A=E5=9B=BA=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/SubSpendController.class.php | 48 ++++- .../SubSpendSetController.class.php | 2 - Application/Admin/View/SubSpend/lists.html | 188 ++++++++++++++++++ 3 files changed, 230 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php index 1ad95e6de..9f4cdb744 100644 --- a/Application/Admin/Controller/SubSpendController.class.php +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -160,16 +160,26 @@ class SubSpendController extends ThinkController $this->OpAuthList= getModuleControllerAuth(); } - $this->assign('menubtn',$this->menuAuth()); + $this->assign('menubtn',$this->menuAuth($is_sub_data)); $this->display(); } - protected function menuAuth() + protected function menuAuth($is_sub_data = false) { - $mentBtn = [ - "addStatement"=>"参与结算", - "removeStatement"=>"移出结算", - ]; + $is_can_add = D("CmdTasks")->isCanAddTask("SubSpendSet"); + if($is_can_add){ + $mentBtn = [ + "addSubSpendSet"=>"固定订单", + "updateSubSpend"=>"重固订单" + ]; + }else{ + $mentBtn = []; + } + if($is_sub_data){ + $mentBtn['changeSubSpend'] = "订单换绑"; + $mentBtn['addStatement'] = "参与结算"; + $mentBtn['removeStatement'] = "移出结算"; + } $resarr = []; foreach ($mentBtn as $k => $v) { if(IS_ROOT){ @@ -183,6 +193,32 @@ class SubSpendController extends ThinkController return $resarr; } + public function addSubSpendSet(){ + if(!isset($_REQUEST['time'])) $this->error("参数错误"); + $time = $_REQUEST['time']; + $params = "php ".SUBSITE_INDEX." SubSpendSet/setSubSpend/time/{$time}"; + $r = D("CmdTasks")->addTask("SubSpendSet",$params); + if($r){ + $this->ajaxReturn(["status"=>1,"info"=>"固化数据任务登记成功,请等待两三分钟后查看结果"]); + }else{ + $this->ajaxReturn(["status"=>0,"info"=>"固化数据任务登记错误"]); + } + } + + public function updateSubSpend(){ + if(!isset($_REQUEST['begin']) || !isset($_REQUEST['end'])) $this->error("参数错误"); + $begin = $_REQUEST['begin']; + $end = $_REQUEST['end']; + + $params = "php ".SUBSITE_INDEX." SubSpendSet/recountSubSpend/begin/{$begin}/end/{$end}"; + $r = D("CmdTasks")->addTask("SubSpendSet",$params); + if($r){ + $this->ajaxReturn(["status"=>1,"info"=>"重算任务登记成功,请等待两三分钟后查看结果"]); + }else{ + $this->ajaxReturn(["status"=>0,"info"=>"重算任务登记错误"]); + } + } + public function addStatement() { if(!isset($_REQUEST['ids'])) $this->error("参数错误"); diff --git a/Application/Admin/Controller/SubSpendSetController.class.php b/Application/Admin/Controller/SubSpendSetController.class.php index f81ddbe20..ea24935e1 100644 --- a/Application/Admin/Controller/SubSpendSetController.class.php +++ b/Application/Admin/Controller/SubSpendSetController.class.php @@ -104,6 +104,4 @@ class SubSpendSetController extends Controller { return $this->SubKvModel->where("`key` = 'sub_spend_syn_time'")->save(['value'=>$this->SynTime]); } - - } diff --git a/Application/Admin/View/SubSpend/lists.html b/Application/Admin/View/SubSpend/lists.html index 9471afbe4..c37277fc8 100644 --- a/Application/Admin/View/SubSpend/lists.html +++ b/Application/Admin/View/SubSpend/lists.html @@ -408,6 +408,50 @@ 已添加添加至常用设置 + + + @@ -428,10 +472,154 @@ $(".select_gallery").select2(); + + + + + + + + + + + + + + + + + + + +
+ 说明:换绑后的数据将归属到选择的公司 +
+
+ + +
+
+ +
+
+ +
+ + + + +
+ +
+ + +
+
所选订单统计:
+
+ + + + + + + + + + + + + + + + + + + + + +
公司金额
{$vo.company_name}{$vo.pay_amount}
合计:{$data['count']}
+
+
+ + +
+ From 8d871290f275eb788577002cee4d0373a0183c64 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 17 Mar 2021 11:13:51 +0800 Subject: [PATCH 09/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/SubSpendController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php index ca2127c1b..a38bbedd0 100644 --- a/Application/Admin/Controller/SubSpendController.class.php +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -305,7 +305,7 @@ class SubSpendController extends ThinkController foreach ($dbres as $value) { $office_pay_amount += ($value-0); } - $sendData['list'][]= ["company_name"=>DEFAULT_COMPANY,"pay_amount"=>$office_pay_amount]; + $sendData['list'][]= ["company_name"=>C('OFFICIEL_CHANNEL'),"pay_amount"=>$office_pay_amount]; $sendData['count'] += $office_pay_amount; } //获取所有公司 From c21b9f619e11b35ec340ac5964c4f57bb8f65803 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 17 Mar 2021 19:53:55 +0800 Subject: [PATCH 10/37] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=90=E7=AB=99?= =?UTF-8?q?=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementController.class.php | 32 +++++++ ...SubCompanyStatementSetController.class.php | 30 ++++--- .../Admin/View/CompanyStatement/lists.html | 90 +++++++++++++++++++ 3 files changed, 138 insertions(+), 14 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index cbc15fca6..5f1f5b67d 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -229,6 +229,13 @@ class CompanyStatementController extends ThinkController } $this->assign("IS_SUBSITE",IS_SUBSITE); + if(IS_SUBSITE){ + $SubKvModel = M("Kv","sub_",SUBSITE_DB);//指定子库 + $LastSynTime = $SubKvModel->where("`key` = 'sub_spend_syn_time'")->getField("value"); + $LastStatementTime = $SubKvModel->where("`key` = 'sub_company_statement'")->getField("value"); + $this->assign('lastSynTime',date('Y-m-d',$LastSynTime)); + $this->assign('lastStatementTime',date('Y-m-d',$LastStatementTime)); + } $this->assign('data',$data); $this->assign('count',$count); @@ -1734,6 +1741,24 @@ class CompanyStatementController extends ThinkController $this->ajaxReturn(array("success"=>"ok","data"=>[])); } + //子站新增结算 + public function subAddStatement(){ + if(!isset($_REQUEST['statement_time'])) $this->error("参数错误"); + $statement_time = $_REQUEST['statement_time']; + $end = date("Y-m-d",strtotime($statement_time)+ 86400); + $utime = strtotime($statement_time)+86399; + + $LastStatementTime = M("Kv","sub_",SUBSITE_DB)->where("`key` = 'sub_company_statement'")->getField("value"); + $begin = date("Y-m-d",$LastStatementTime-0+1); + + $params = "php ".SUBSITE_INDEX." SubCompanyStatementSet/setFreeDateCount/begin/{$begin}/end/{$end}/utime/{$utime}"; + $r = D("CmdTasks")->addTask("SubCompanyStatementSet",$params); + if($r){ + $this->ajaxReturn(["status"=>1,"info"=>"任务登记成功,请等待五分分钟后查看结果"]); + }else{ + $this->ajaxReturn(["status"=>0,"info"=>"任务登记错误"]); + } + } public function viewSpecialComplement() { @@ -2448,6 +2473,13 @@ class CompanyStatementController extends ThinkController "viewSpecialComplement"=>"特殊补点", "delStatement"=>"批量删除" ]; + if(IS_SUBSITE){ + unset($mentBtn['updateNewStatement']); + $is_can_add = D("CmdTasks")->isCanAddTask("SubCompanyStatementSet"); + if($is_can_add){ + $mentBtn['subAddStatement'] = "新增结算"; + } + } $resarr = []; foreach ($mentBtn as $k => $v) { if(IS_ROOT){ diff --git a/Application/Admin/Controller/SubCompanyStatementSetController.class.php b/Application/Admin/Controller/SubCompanyStatementSetController.class.php index 817319353..6a80f8639 100644 --- a/Application/Admin/Controller/SubCompanyStatementSetController.class.php +++ b/Application/Admin/Controller/SubCompanyStatementSetController.class.php @@ -33,7 +33,7 @@ class SubCompanyStatementSetController extends Controller { * @param string $company all/pc/cp/pu 全部 下游公司 上游 下游个人 * @return void */ - public function setFreeDateCount($begin,$end='',$company='all') + public function setFreeDateCount($begin,$end='',$utime=false,$company='all') { if($end == '') $end = $begin; //判断日期格式 @@ -58,6 +58,9 @@ class SubCompanyStatementSetController extends Controller { for($i=0;$i<$countdate;$i++){ $this->setDailyCount($datelist[$i],$company); } + if($utime){ + M("Kv","sub_",SUBSITE_DB)->where("`key` = 'sub_company_statement'")->save(["value"=>$utime]); + } } public function setDailyCount($stime="now",$company='all') { @@ -74,14 +77,14 @@ class SubCompanyStatementSetController extends Controller { $w = (int)date("w",$stime); if($w == 1){ if($company == "all"){ - echo $nowdate.":".PHP_EOL; - echo "--周结begin".PHP_EOL; + // echo $nowdate.":".PHP_EOL; + // echo "--周结begin".PHP_EOL; $this->cpStatement(0,$stime); - echo "∟----CP周结统计ok".PHP_EOL; + // echo "∟----CP周结统计ok".PHP_EOL; $this->promoteCompanyStatement(0,$stime); - echo "∟----推广公司周结统计ok".PHP_EOL; + // echo "∟----推广公司周结统计ok".PHP_EOL; } if($company == "cp"){ $this->cpStatement(0,$stime); @@ -94,19 +97,18 @@ class SubCompanyStatementSetController extends Controller { } if($d == 1){ if($company == "all"){ - echo $nowdate.":".PHP_EOL; - echo "--月结&补点begin".PHP_EOL; + // echo $nowdate.":".PHP_EOL; + // echo "--月结&补点begin".PHP_EOL; $this->cpStatement(1,$stime); - echo "∟----CP月结&补点统计ok".PHP_EOL; + // echo "∟----CP月结&补点统计ok".PHP_EOL; $this->promoteCompanyStatement(1,$stime); - $this->officeCompanyStatement($stime); //官方结算 - echo "∟----官方/推广公司月结统计ok".PHP_EOL; + // echo "∟----官方/推广公司月结统计ok".PHP_EOL; $this->promoteUserPool(1,$stime); - echo "∟----推广个人月结统计ok".PHP_EOL; + // echo "∟----推广个人月结统计ok".PHP_EOL; } if($company == "cp"){ $this->cpStatement(1,$stime); @@ -122,9 +124,9 @@ class SubCompanyStatementSetController extends Controller { echo "∟----推广个人月结&补点统计ok".PHP_EOL; } } - if($w != 1 && $d != 1){ - echo $nowdate."非月初,无需任何处理".PHP_EOL; - } + // if($w != 1 && $d != 1){ + // echo $nowdate."非月初,无需任何处理".PHP_EOL; + // } } /** * 上游结算 diff --git a/Application/Admin/View/CompanyStatement/lists.html b/Application/Admin/View/CompanyStatement/lists.html index 0d913da05..483915996 100644 --- a/Application/Admin/View/CompanyStatement/lists.html +++ b/Application/Admin/View/CompanyStatement/lists.html @@ -289,6 +289,28 @@ + @@ -743,6 +765,74 @@ } }); }) + //子站新增结算单 + $("#subAddStatement").click(function(){ + var html = $("#addSubStatementTpl").html(); + layer.open({ + type: 1, + title: "新增结算单", + maxWidth:720, + closeBtn: 1, + shadeClose: false, + content: html, + success:function(){ + $("#addSubStatementSubmit").off("click"); + $("#addSubStatementTime").datetimepicker({ + format: 'yyyy-mm-dd', + language: "zh-CN", + showMeridian:true, + pickDate:true, + minView: 2, + autoclose: true, + pickTime:true, + todayBtn:true, + }); + $("#addSubStatementSubmit").on("click",function(){ + var subtime= $("#addSubStatementTime").val(); + + if(subtime == '') { + layer.msg('请先选择要结算的时间'); + return false; + } + + var lastSynTime = Date.parse($("#lastSynTime").val())+86400000; + var lastStatementTime = Date.parse($("#lastStatementTime").val()); + + var subtimenum = Date.parse(subtime); + + if(subtimenum > lastSynTime) { + layer.msg('新增结算时间必须小于固定订单时间'); + return false; + } + if(subtimenum <= lastStatementTime) { + layer.msg('所选时间已结算'); + return false; + } + + $.ajax({ + type: "POST", + url: "{:U('subAddStatement')}", + dataType: 'json', + async: true, + data: {statement_time:subtime}, + success:function(data){ + + if(data.status==1){ + layer.msg("" + data.info + ""); + setTimeout(function(){ + window.location.reload(); + },1500); + }else{ + layer.alert(data.info) + } + } + }); + + }) + } + }); + }) + //查看批注 $(".viewRemark").click(function () { var remark = $(this).data("remark"); From 1b7dae2603feb41638b39d72880d891ae0cb61e5 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 17 Mar 2021 20:57:11 +0800 Subject: [PATCH 11/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Conf/config.php | 1 + .../SubCompanyStatementSetController.class.php | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Conf/config.php b/Application/Admin/Conf/config.php index 26d141df6..e3319f786 100644 --- a/Application/Admin/Conf/config.php +++ b/Application/Admin/Conf/config.php @@ -129,5 +129,6 @@ return array( "tab_reward_detail", "tab_reward_record", "tab_new_company_statement_info", + "tab_spend" ] ); \ No newline at end of file diff --git a/Application/Admin/Controller/SubCompanyStatementSetController.class.php b/Application/Admin/Controller/SubCompanyStatementSetController.class.php index 6a80f8639..af5e1671a 100644 --- a/Application/Admin/Controller/SubCompanyStatementSetController.class.php +++ b/Application/Admin/Controller/SubCompanyStatementSetController.class.php @@ -24,6 +24,15 @@ class SubCompanyStatementSetController extends Controller { echo "请先设置请求接口aggregate_cp_settlement_api的值".PHP_EOL;die; } $this->cpapihost = $cpapihost['value']; + $this->synGame(); + } + + //同步游戏表 + protected function synGame() + { + $mainGame = M("Game","tab_")->select(); + SM()->execute("truncate table tab_game"); + M("game","tab_",SUBSITE_DB)->addAll($mainGame); } /** * Undocumented function @@ -398,7 +407,7 @@ class SubCompanyStatementSetController extends Controller { $Promote = M("Promote","tab_"); - $Spend = M("Spend","tab_"); + $Spend = SM("Spend","tab_"); $spenMap = [ "s.pay_status"=>1, "s.payed_time"=>['between', [$begintime,$endtime]], @@ -616,7 +625,7 @@ class SubCompanyStatementSetController extends Controller { //获取推广员 if(count($idarr) == 0){return $res;} $Promote = M("Promote","tab_"); - $Spend = M("Spend","tab_"); + $Spend = SM("Spend","tab_"); $spenMap = [ "s.pay_status"=>1, "s.payed_time"=>['between', [$begintime,$endtime]], @@ -996,7 +1005,7 @@ class SubCompanyStatementSetController extends Controller { $res = []; //获取推广员 $Promote = M("Promote","tab_"); - $Spend = M("Spend","tab_"); + $Spend = SM("Spend","tab_"); $spenMap = [ "s.pay_status"=>1, "s.payed_time"=>['between', [$begintime,$endtime]], @@ -1023,7 +1032,7 @@ class SubCompanyStatementSetController extends Controller { $res = []; //获取推广员 $Promote = M("Promote","tab_"); - $Spend = M("Spend","tab_"); + $Spend = SM("Spend","tab_"); $spenMap = [ "s.pay_status"=>1, "s.payed_time"=>['between', [$begintime,$endtime]], From 4f14228bab96f06f10a2094b04ee0f705c6556fc Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 18 Mar 2021 11:50:48 +0800 Subject: [PATCH 12/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AD=90=E7=AB=99?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/SubSpendController.class.php | 2 +- Application/Admin/View/SubSpend/lists.html | 35 ++----------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php index a38bbedd0..f36630b48 100644 --- a/Application/Admin/Controller/SubSpendController.class.php +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -123,7 +123,7 @@ class SubSpendController extends ThinkController // $map = '1 = 2'; // $map1 = $map; // } - $this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]); + // $this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]); D("Spend")->addSubsiteWhere($map); $map1 = $map; diff --git a/Application/Admin/View/SubSpend/lists.html b/Application/Admin/View/SubSpend/lists.html index 6889b78da..f82eb1b85 100644 --- a/Application/Admin/View/SubSpend/lists.html +++ b/Application/Admin/View/SubSpend/lists.html @@ -142,7 +142,6 @@
-
- -
-
- {$data.pay_order_number} - - {$data.pay_order_number|encryptStr} - + - {$data.extend} - - {$data.extend|encryptStr} - {:set_show_time($data['pay_time'])} @@ -290,15 +273,10 @@ - - {$data.user_account} - - {$data.user_account|encryptStr} - + {$data.user_account} ({$data.small_account}) {$data.game_name} {$data.sdk_version_name} - C('OFFICIEL_CHANNEL') - - {$data.market_admin_username} - {:getMerchantName($data['merchant_id'])} {$data.spend_ip} @@ -377,7 +352,6 @@ - 汇总 @@ -387,16 +361,13 @@ -
- - 导出 - + 导出 {$_page|default=''}
From c2303a0676c5baa9310f37ec8d2fa0c8cba32afa Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 18 Mar 2021 15:03:59 +0800 Subject: [PATCH 13/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=8D=A2=E7=BB=91=E5=88=B0=E6=B1=9F=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/SubSpendController.class.php | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php index f36630b48..ba561f0d7 100644 --- a/Application/Admin/Controller/SubSpendController.class.php +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -253,13 +253,21 @@ class SubSpendController extends ThinkController if(!isset($_REQUEST['ids']) || !isset($_REQUEST['company_id']) ) $this->error("参数错误"); $ids = $_REQUEST['ids']; $company_id = $_REQUEST['company_id']; - //获取会长及adminid - $promote = M("promote","tab_")->field("id,account,admin_id")->where("company_id = '{$company_id}' and level = '1' and status = '1'")->find(); - $saveData = [ - "promote_id"=>$promote['id'], - "promote_account"=>$promote['account'], - "market_admin_id"=>$promote['admin_id'], - ]; + if($company_id == 0){ + $saveData = [ + "promote_id"=>0, + "promote_account"=>'官方渠道', + "market_admin_id"=>0, + ]; + }else{ + //获取会长及adminid + $promote = M("promote","tab_")->field("id,account,admin_id")->where("company_id = '{$company_id}' and level = '1' and status = '1'")->find(); + $saveData = [ + "promote_id"=>$promote['id'], + "promote_account"=>$promote['account'], + "market_admin_id"=>$promote['admin_id'], + ]; + } $where = [ "id"=>['in',$ids] ]; @@ -310,8 +318,7 @@ class SubSpendController extends ThinkController } //获取所有公司 $promoteCompany = M('promote_company','tab_')->field('id, company_name as name')->where(['status' => 1])->select(); - - + array_unshift($promoteCompany,['id'=>0,'name'=>C('OFFICIEL_CHANNEL')]); $this->assign('promoteCompany', $promoteCompany); $this->assign('data', $sendData); $this->assign('ids', $ids); From 7c460cdb470f951bf8fb5e069829b1968576851e Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 18 Mar 2021 18:15:54 +0800 Subject: [PATCH 14/37] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/SubSpendController.class.php | 292 +++++++++++++++++- Application/Admin/View/SubSpend/lists.html | 19 +- 2 files changed, 286 insertions(+), 25 deletions(-) diff --git a/Application/Admin/Controller/SubSpendController.class.php b/Application/Admin/Controller/SubSpendController.class.php index ba561f0d7..0ad202a02 100644 --- a/Application/Admin/Controller/SubSpendController.class.php +++ b/Application/Admin/Controller/SubSpendController.class.php @@ -75,26 +75,32 @@ class SubSpendController extends ThinkController unset($_REQUEST['merchant_id']); } - $marketAdminId = 0; - $isMarketAdmin = isMarketAdmin(); - if ($isMarketAdmin) { - $userAuth = session('user_auth'); - $marketAdminId = $userAuth['uid']; - } else { - $marketAdminId = I('market_admin_id', 0); - } - if ($marketAdminId > 0) { - $map['market_admin_id'] = $marketAdminId; - } else { - setPowerPromoteIds($map,'promote_id'); - } + // $marketAdminId = 0; + // $isMarketAdmin = isMarketAdmin(); + // if ($isMarketAdmin) { + // $userAuth = session('user_auth'); + // $marketAdminId = $userAuth['uid']; + // } else { + // $marketAdminId = I('market_admin_id', 0); + // } + // if ($marketAdminId > 0) { + // $map['market_admin_id'] = $marketAdminId; + // } else { + // setPowerPromoteIds($map,'promote_id'); + // } - if (isset($_REQUEST['promote_id'])) { - $promoteId = intval($_REQUEST['promote_id']); - if ($promoteId == 0) { + if (isset($_REQUEST['promote_id']) || isset($_REQUEST['company_id'])) { + $promoteId = I('promote_id',-1); + $companyId = I('company_id',-1); + if ($promoteId == 0 || $companyId == 0) { $map['promote_id'] = 0; } else { - $promoteMap['chain'] = ['like', "%/$promoteId/%"]; + if($companyId != -1){ + $promoteMap['company_id'] = $companyId; + } + if($promoteId != -1){ + $promoteMap['chain'] = ['like', "%/$promoteId/%"]; + } $promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true); $promoteIds[] = $promoteId; $map['promote_id'] = ['in', $promoteIds]; @@ -146,6 +152,10 @@ class SubSpendController extends ThinkController $value['sdk_version_name'] = $game_arr[1]; } } + + $promoteCompany = M('promote_company','tab_')->field('id, company_name as name')->where(['status' => 1])->select(); + array_unshift($promoteCompany,['id'=>0,'name'=>C('OFFICIEL_CHANNEL')]); + $this->assign('promoteCompany', $promoteCompany); $this->assign('showMarketAdmin', session('user_auth')['show_market_admin']); $this->assign('showPromote', session('user_auth')['show_promote']); @@ -163,6 +173,254 @@ class SubSpendController extends ThinkController $this->assign('menubtn',$this->menuAuth($is_sub_data)); $this->display(); } + public function exportList() + { + $xlsName = $_REQUEST['xlsname']; + $startDate = empty($_REQUEST['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $_REQUEST['timestart']; + $endDate = empty($_REQUEST['timeend']) ? date('Y-m-d') : $_REQUEST['timeend']; + + $startTime = strtotime($startDate); + $endTime = strtotime($endDate) + 86399; + $map['pay_time'] = array('BETWEEN', array($startTime, $endTime)); + $is_sub_data = I("issubdata",0); + $SpendModel = M("spend","tab_",SUBSITE_DB); + + unset($_REQUEST['timestart']); + unset($_REQUEST['timeend']); + + if (isset($_REQUEST['user_account'])) { + $map['user_account'] = array('like', trim($_REQUEST['user_account'])); + unset($_REQUEST['user_account']); + } + if (isset($_REQUEST['spend_ip'])) { + $map['spend_ip'] = array('like', trim($_REQUEST['spend_ip']) . '%'); + unset($_REQUEST['spend_ip']); + } + if (isset($_REQUEST['game_name'])) { + if ($_REQUEST['game_name'] == '全部') { + unset($_REQUEST['game_name']); + } else { + $map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')]; + unset($_REQUEST['game_name']); + } + } + if (isset($_REQUEST['game_type']) && $_REQUEST['game_type']) { + $map['sdk_version'] = $_REQUEST['game_type']; + } + if (isset($_REQUEST['server_id'])) { + $map['server_id'] = $_REQUEST['server_id']; + unset($_REQUEST['server_id']); + } + if (isset($_REQUEST['pay_order_number'])) { + $map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number'])); + unset($_REQUEST['pay_order_number']); + } + if (isset($_REQUEST['extend'])) { + $map['extend'] = array('like', trim($_REQUEST['extend'])); + unset($_REQUEST['extend']); + } + if (isset($_REQUEST['pay_status'])) { + $map['pay_status'] = $_REQUEST['pay_status']; + unset($_REQUEST['pay_status']); + } + if (isset($_REQUEST['pay_way'])) { + if ($_REQUEST['pay_way'] == 2) { + $map['pay_way'] = ['in', '2,3,4']; + } else { + $map['pay_way'] = $_REQUEST['pay_way']; + } + unset($_REQUEST['pay_way']); + } + + if (isset($_REQUEST['is_check'])) { + $map['is_check'] = (int)($_REQUEST['is_check']); + unset($_REQUEST['is_check']); + } + + if ($_REQUEST['merchant_id']) { + $map['merchant_id'] = $_REQUEST['merchant_id']; + unset($_REQUEST['merchant_id']); + } + + if (isset($_REQUEST['pay_game_status'])) { + $map['pay_game_status'] = $_REQUEST['pay_game_status']; + unset($_REQUEST['pay_game_status']); + } + + if (isset($_REQUEST['promote_id']) || isset($_REQUEST['company_id'])) { + $promoteId = I('promote_id',-1); + $companyId = I('company_id',-1); + if ($promoteId == 0 || $companyId == 0) { + $map['promote_id'] = 0; + } else { + if($companyId != -1){ + $promoteMap['company_id'] = $companyId; + } + if($promoteId != -1){ + $promoteMap['chain'] = ['like', "%/$promoteId/%"]; + } + $promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true); + $promoteIds[] = $promoteId; + $map['promote_id'] = ['in', $promoteIds]; + } + } + if ($_REQUEST['data_order'] != '') { + $data_order = reset(explode(',', $_REQUEST['data_order'])); + $data_order_type = end(explode(',', $_REQUEST['data_order'])); + $this->assign('userarpu_order', $data_order); + $this->assign('userarpu_order_type', $data_order_type); + $sort = $data_order == 3 ? 'desc' : 'asc'; + $order = $data_order_type . ' ' . $sort; + } else { + $order = ' pay_time desc '; + } + + if (I('platform_type', 0) != 0) { + $sy = I('platform_type', 0) == 1 ? '=' : '<>'; + $game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true); + $map['game_id'] = ['in',$game_id]; + } + + // if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) { + // $map1 = $map; + // $map1['pay_status'] = 1; + // } else { + // $map = '1 = 2'; + // $map1 = $map; + // } + D("Spend")->addSubsiteWhere($map); + $map1 = $map; + $map1['pay_status'] = 1; + $total = $SpendModel->where($map1)->sum('pay_amount'); +// var_dump($total);die(); + $total=$total?$total:0; + + + $headers = [ + 'pay_order_number' => '支付订单号', + 'extend' => 'CP订单号', + 'pay_time' => '充值时间', + 'payed_time' => '支付时间', + 'user_account' => '玩家账号', + 'game_name' => '游戏名称', + 'sdk_version' => '设备类型', + 'game_id' => '所属CP', + 'promote_account' => L('Subordinate_channel'), + '0 as company_name' => '所属推广公司', + 'market_admin_id' => '所属市场专员', + 'merchant_id' => '所属商户', + 'spend_ip' => '充值ip', + 'server_id' => '区服ID', + 'server_name' => '游戏区服', + 'game_player_id' => '角色ID', + 'game_player_name' => '角色名称', + 'cost' => '订单金额', + 'pay_amount' => '实付金额', + 'pay_way' => '充值方式', + 'pay_status' => L('Order_status'), + 'pay_game_status' => '游戏通知状态', + 'is_check' => '是否参与结算', + 'promote_id' => "消费"."{$total}", + ]; + + + $xlsCell = array_values($headers); + $fields = array_keys($headers); + // ----获取游戏的基本信息begin + //获取游戏公司 + $cpCompanyDb = M("partner","tab_")->field("id,partner")->order("id asc")->select(); + $cpCompany = []; + foreach ($cpCompanyDb as $index => $cp) { + $cpCompany[$cp['id']]=$cp['partner']; + } + unset($cpCompanyDb); + //获取所有游戏 + $gameDb = M("Game","tab_")->field("id,relation_game_name,partner_id")->order("id asc")->select(); + $gameInfo = []; + foreach ($gameDb as $index => $g) { + $partner_name = $cpCompany[$g['partner_id']]; + $g['partner_name'] = $partner_name; + $gameInfo[$g['id']]=$g; + } + unset($cpCompany); + unset($gameDb); + // ----获取游戏的基本信息end + + $csvFileName = $xlsName.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + + $accessNum = $SpendModel + ->where($map) + ->count(); + + + $perSize = 10000;//每次查询的条数 + $pages = ceil($accessNum / $perSize); + +// var_dump($count);die(); + for($i = 1; $i <= $pages; $i++) { + $xlsData = $SpendModel + ->field($fields) + ->where($map) + ->limit(($i-1)*$perSize ,$perSize) + ->order($order ? $order : 'pay_time desc') + ->select(); + if ($showMarketAdmin == 1) { + $adminUsernameList = getAdminUsernameList(array_column($xlsData, 'market_admin_id')); + } + $promoters = D('Promote')->where(['id'=>['in', array_unique(array_column($xlsData, 'promote_id'))]])->field('id, company_id')->select(); + $promoters = $promoters ? array_column($promoters, 'company_id', 'id') : []; + $companys = $promoters ? M('promote_company', 'tab_')->where(['id'=>['in', array_unique(array_values($promoters))]])->field('id, company_name')->select() : []; + $companys = $companys ? array_column($companys, 'company_name', 'id') : []; + + foreach($xlsData as $value) { + //游戏信息匹配 + $thisGameInfo = $gameInfo[$value["game_id"]]; + $value['game_name'] =$thisGameInfo['relation_game_name']; + $value['sdk_version'] = $value['sdk_version'] == 1 ? "安卓" : "苹果"; + $value['game_id'] = $thisGameInfo['partner_name']; + + $value['is_check'] = D("Spend")::IsCheckStr[$value['is_check']]; + + $value['company_name'] = $promoters[$value['promote_id']] == 0 ? C('OFFICIEL_CHANNEL') : ($companys[$promoters[$value['promote_id']]] ?? ''); + unset($value['promote_id']); + $value['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']); + if($value['pay_status'] == 1) { + $value['payed_time'] = date('Y-m-d H:i:s',$value['payed_time']); + }else { + $value['payed_time'] = "------"; + } + $value['merchant_id'] = getMerchantName($value['merchant_id']); + checkEncryptionAuth($value['user_account'],'spend_lists'); + ($value['promote_account']=='官方渠道'||$value['promote_account']=='自然注册')?($value['promote_account']=C('OFFICIEL_CHANNEL')):''; + $value['extend'] = $value['extend'].'`'; + $value['pay_way'] = get_pay_way($value['pay_way']); + $value['pay_status'] = get_info_status($value['pay_status'],9); + $value['pay_game_status'] = get_info_status($value['pay_game_status'],14); + $value['market_admin_id'] = $adminUsernameList[$value['market_admin_id']] ?? '无'; + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + } + unset($xlsData);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + fclose($fp); + //操作日志 + $GetData = $_GET; + unset($GetData['xlsname']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U('Spend/lists',$GetData),'menu'=>'充值-游戏订单-游戏充值-导出']); + } protected function menuAuth($is_sub_data = false) { diff --git a/Application/Admin/View/SubSpend/lists.html b/Application/Admin/View/SubSpend/lists.html index f82eb1b85..99cfbafbb 100644 --- a/Application/Admin/View/SubSpend/lists.html +++ b/Application/Admin/View/SubSpend/lists.html @@ -142,6 +142,16 @@
+ +
+ +
+
-
- -
-
+
+ +
@@ -115,6 +118,7 @@ 注册IP + 角色ID 最近登录时间 @@ -166,6 +170,7 @@ {$record.device_number} {$record.register_time} {$record.register_ip} + {$record.role_id} {$record.login_time} {$record.login_ip} From 5cd8ca285758bd4d913b2e76cad2396db9a37736 Mon Sep 17 00:00:00 2001 From: liyang <316606755@qq.com> Date: Fri, 19 Mar 2021 14:53:25 +0800 Subject: [PATCH 19/37] =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E3=80=81=E9=A2=9D=E5=A4=96=E9=A2=9D=E5=A4=96=E3=80=81=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=B5=84=E6=BA=90=E6=9D=83=E9=99=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/BaseController.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index a63a06a89..4817777a8 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -5,12 +5,13 @@ namespace Home\Controller; use Base\Service\PromoteCompanyService; use Think\Controller; use Base\Service\PromoteService; + class BaseController extends HomeController { protected $promotePermissions; protected $loginPromote = null; protected $canViewUserRecharge = true; - protected $isOpenQuery =true; + protected $permControlUrls = [ 'Home/Query/recharge', @@ -58,7 +59,6 @@ class BaseController extends HomeController $this->assign("grand_id", $loginer['grand_id']); $this->assign('canViewUserRecharge', $this->canViewUserRecharge); - $result = M('site_apply', 'tab_')->where("promote_id=$pid")->getField('status'); if ($result['status'] == 1) { $this->assign('noapplysite', $result); @@ -432,5 +432,4 @@ class BaseController extends HomeController ->group('relation_game_id') ->select(); } - } From 57abd846c605d03a4a66eb90bceb7317ca290c17 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 19 Mar 2021 17:04:01 +0800 Subject: [PATCH 20/37] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B4=A2=E5=8A=A1?= =?UTF-8?q?=E6=B1=87=E6=80=BB=E9=87=8D=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummaryController.class.php | 15 +-- .../Admin/View/FinancialSummary/index.html | 100 ++++++++++++++---- 2 files changed, 86 insertions(+), 29 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php index b75b0de48..0998a121f 100644 --- a/Application/Admin/Controller/FinancialSummaryController.class.php +++ b/Application/Admin/Controller/FinancialSummaryController.class.php @@ -29,13 +29,7 @@ class FinancialSummaryController extends AdminController if(!IS_ROOT){ $this->OpAuthList= getModuleControllerAuth(); } - $this->assign('menubtn',$this->menuAuth()); - $lastRecount = D("CmdTasks")->getTypeLastTask("FinancialSummary"); - if(!$lastRecount){ - $lastRecount = "无"; - } - $this->assign('lastRecount',$lastRecount); - + $this->assign('menubtn',$this->menuAuth()); $this->getYearList(); $this->getYearData(); $this->display(); @@ -43,9 +37,10 @@ class FinancialSummaryController extends AdminController } public function updateStatement() { - - $temp = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); - $params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}"; + if(!isset($_REQUEST['time'])) $this->error("参数错误"); + + $time = $_REQUEST['time']; + $params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$time}"; $r = D("CmdTasks")->addTask("FinancialSummary",$params); if($r){ $this->ajaxReturn(["success"=>"ok"]); diff --git a/Application/Admin/View/FinancialSummary/index.html b/Application/Admin/View/FinancialSummary/index.html index d24b8ff3a..9d912a930 100644 --- a/Application/Admin/View/FinancialSummary/index.html +++ b/Application/Admin/View/FinancialSummary/index.html @@ -225,6 +225,24 @@
+
@@ -285,26 +303,70 @@ window.location.href = url; }); $("#updateStatement").on("click",function(){ - layer.confirm("重算需要花费2分钟左右时间,并且只统计上个月信息,无需重算请取消,上次重算时间【{$lastRecount}】",{title:false}, function(index){ - $.ajax({ - type: 'post', - url: "{:U('updateStatement')}", - data:{}, - success: function(data) { - if(data.success){ - layer.alert('添加重算任务成功,请2分钟后刷新查看',function(){ - window.location.reload(); - }); - }else{ - layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成'); + var html = $("#updateStatementTpl").html(); + layer.open({ + type: 1, + title: "汇总重算", + maxWidth:720, + closeBtn: 1, + shadeClose: true, + content: html, + success:function(){ + $("#updateStatementSubmit").off("click"); + $("#updateStatementTime").datetimepicker({ + format: 'yyyy-mm', + language: "zh-CN", + showMeridian:true, + pickDate:true, + startView: 3, + minView: 3, + autoclose: true, + pickTime:true + }); + $("#updateStatementSubmit").on("click",function() { + var subtime= $("#updateStatementTime").val(); + if(subtime == ''){ + layer.msg('请先选择要重算的月份'); + return false; } - }, - error:function(){ - layer.alert("网络错误或超时"); - return false; - } - }); - }); + var subtimeArr = subtime.split("-"); + + var today = new Date(); + today.setTime(today.getTime()); + var year = today.getFullYear(); + var month = today.getMonth()+1; + + if(subtimeArr[0] > year){ + layer.msg('要重算的月份必须小于当前时间'); + return false; + } + if(subtimeArr[0] == year && subtimeArr[1] >= month){ + layer.msg('要重算的月份必须小于当前时间'); + return false; + } + + $.ajax({ + type: 'post', + url: "{:U('updateStatement')}", + data:{time:subtime}, + success: function(data) { + if(data.success){ + layer.alert('添加重算任务成功,请2分钟后刷新查看',function(){ + window.location.reload(); + }); + }else{ + layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成'); + } + }, + error:function(){ + layer.alert("网络错误或超时"); + return false; + } + }); + }); + + } + }); }) //回车自动提交 From 42a8fc94f769f9353fea2e6f4b4d5dff68fa4cfb Mon Sep 17 00:00:00 2001 From: liyang <316606755@qq.com> Date: Fri, 19 Mar 2021 18:32:19 +0800 Subject: [PATCH 21/37] =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=9F=A5=E8=AF=A2-?= =?UTF-8?q?=E6=9C=AC=E6=8E=A8=E5=B9=BF=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/QueryController.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 7894fbc41..189f23544 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1764,9 +1764,11 @@ class QueryController extends BaseController $map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; } if ($isSelf) { - $map['promote_id'] = $queryPromote['id']; + $map['role.promote_id'] = $queryPromote['id']; } + + $orderBy = 'create_time desc'; $sortNameData = ['login_time', 'create_time', 'role_level', 'register_time', 'role.promote_account']; if (!empty($sortName)) { @@ -1812,11 +1814,14 @@ class QueryController extends BaseController list($records, $pagination, $count) = $this->paginate($query->order($orderBy)); $countRow = $countQuery->field(['count(distinct user_id) user_count'])->find(); - + $subSql = M('user', 'tab_')->field('id')->where(['is_repeat' => 0])->select(false); $map['_string'] = str_replace('role.promote_id', 'promote_id', $map['_string']) . ' and user_id in (' . $subSql . ')'; + $map['promote_id'] = $map['role.promote_id']; + unset($map['role.promote_id']); $uniqueCountRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count, count(*) count'])->where($map)->find(); + /* $users = []; if (count($records) > 0) { $userIds = array_column($records, 'user_id'); From da588a3d86d5f24d98e1150863f0a71befcff062 Mon Sep 17 00:00:00 2001 From: liyang <316606755@qq.com> Date: Mon, 22 Mar 2021 10:51:30 +0800 Subject: [PATCH 22/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/QueryController.class.php | 2 +- Application/Home/View/default/TestingResource/batches.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 189f23544..ec413f8b3 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1844,7 +1844,7 @@ class QueryController extends BaseController $hideChar .= '*'; } - if($record['create_time'] == 0) { + if($records[$key]['create_time'] == 0) { $records[$key]['create_time'] = date('Y-m-d', $value['play_time']) . '
' . date('H:i:s', $value['play_time']); } else { $records[$key]['create_time'] = date('Y-m-d', $value['create_time']) . '
' . date('H:i:s', $value['create_time']); diff --git a/Application/Home/View/default/TestingResource/batches.html b/Application/Home/View/default/TestingResource/batches.html index 919674553..2578afd3a 100644 --- a/Application/Home/View/default/TestingResource/batches.html +++ b/Application/Home/View/default/TestingResource/batches.html @@ -84,7 +84,7 @@ +
@@ -535,48 +535,17 @@ body { $('#verify-quota').html(verifyQuota) $('#quota').html(quota-verifyQuota) } - $('#test_account').on({ - blur: function() { - var gameId = $('#game-select').val() - if (gameId == 0) { - return layer.msg('请选择游戏') - } - var serverId = $('#server-select').val() - if (serverId == 0) { - return layer.msg('请选择区服') - } - var userAccount = $('#test_account').val() - if (userAccount == '') { - return layer.msg('请输入测试资源账号') - } - getUserRoles(userAccount, gameId, serverId, function(roles, isTestingAccount) { - if (roles.length == 0) { - return layer.msg('当前账号在该区服未创建角色') - } - if (!isTestingAccount) { - return layer.msg('此账号非测试账号') - } - var html = ""; - for (var i in roles){ - html += "" - } - $("#role-select").html(html); - $("#role-select").select2(); - }) - } - }) - function getUserRoles(userAccount, gameId, serverId, callback) { + function getUserRoles(bindRoleId, gameId, callback) { $.ajax({ url: "{:U('getUserRoles')}", type: "post", - data: { user_account: userAccount, game_id: gameId, server_id: serverId }, + data: { role_id: bindRoleId, game_id: gameId }, dataType: 'json', success: function(result){ if (result.status == 1) { var roles = result.data.roles - var isTestingAccount = result.data.is_testing_account - callback(roles, isTestingAccount) + callback(roles) } else { layer.msg(result.message) } @@ -584,7 +553,7 @@ body { }) } - $('#bind_account').on({ + $('#bind_role_id').on({ blur: function () { var gameId = $('#game-select').val() if (gameId == 0) { @@ -594,16 +563,13 @@ body { if (serverId == 0) { return layer.msg('请选择区服') } - var userAccount = $('#bind_account').val() - if (userAccount == '') { - return layer.msg('请输入玩家账号') + var bindRoleId = $('#bind_role_id').val() + if (bindRoleId == '') { + return layer.msg('请输入角色ID') } - getUserRoles(userAccount, gameId, serverId, function(roles, isTestingAccount) { + getUserRoles(bindRoleId, gameId, function(roles) { if (roles.length == 0) { - return layer.msg('玩家账号在该区服未创建角色') - } - if (isTestingAccount) { - return layer.msg('此账号为测试账号,无法绑定') + return layer.msg('未查询到角色') } var html = ""; for (var i in roles){ diff --git a/Application/Base/Repository/TestingResourceRepository.class.php b/Application/Base/Repository/TestingResourceRepository.class.php index c4821b93e..a10ab1221 100644 --- a/Application/Base/Repository/TestingResourceRepository.class.php +++ b/Application/Base/Repository/TestingResourceRepository.class.php @@ -2,6 +2,7 @@ namespace Base\Repository; +use Base\Service\GameService; use Base\Tool\Registry; use Base\Service\PromoteService; @@ -222,7 +223,7 @@ class TestingResourceRepository 'provide_status' => $batch['provide_status'], 'provide_status_text' => $this->getProvideStatusText($batch['provide_status']), 'provide_time' => $batch['provide_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['provide_time']), - 'content' => $content, + 'content' => '', ]; } return $records; @@ -317,6 +318,7 @@ class TestingResourceRepository foreach ($roles as $role) { $bindingOrWhere[] = '(role_id="' . $role['role_id'] . '" and game_id=' . $role['game_id'] . ')'; } + $bindingOrWhereStr = '(' . implode(' or ', $bindingOrWhere) . ')'; $userIds = array_unique(array_column($roles, 'user_id')); $users = []; @@ -325,15 +327,30 @@ class TestingResourceRepository $applyRecords = []; $testingUsers = []; if (count($roles) > 0) { + $games = M('game', 'tab_')->field(['id', 'data_share'])->where(['id' => ['in', array_column($roles, 'game_id')]])->select(); + $games = index_by_column('id', $games); + + $gameRepository = new GameRepository(); + $baseGames = $gameRepository->getBaseGames(); + $testingUsers = M('testing_user', 'tab_')->where(['user_id' => ['in', $userIds]])->select(); $testingUsers = index_by_column('user_id', $testingUsers); $users = M('user', 'tab_')->field(['id', 'phone', 'lock_status'])->where(['id' => ['in', $userIds]])->select(); $users = index_by_column('id', $users); - $bindingRows = M('testing_binding', 'tab_')->where(['_string' => implode(' or ', $bindingOrWhere)])->select(); + $bindingRows = M('testing_binding', 'tab_')->where(['_string' => $bindingOrWhereStr])->select(); $bindingRoleIds = []; foreach ($bindingRows as $bindingRow) { $bindings[$this->getGameRoleId($bindingRow['game_id'], $bindingRow['role_id'])] = $bindingRow; $bindingRoleIds[] = $this->getGameRoleId($bindingRow['game_id'], $bindingRow['bind_role_id']); + $game = $games[$bindingRow['game_id']]; + $gameIds = [$bindingRow['game_id']]; + if ($game['data_share'] == 1) { + $baseGame = $gameRepository->getBaseGameByGameId($bindingRow['game_id'], $baseGames); + $gameIds = $gameRepository->getGameIdsByBaseGame($baseGame); + } + foreach ($gameIds as $gameId) { + $bindingRoleIds[] = $this->getGameRoleId($gameId, $bindingRow['bind_role_id']); + } } if (count($bindings) > 0) { $bindingRoles = M('user_play_info', 'tab_') @@ -347,7 +364,7 @@ class TestingResourceRepository ->field('sum(apply_amount) amount, game_id, role_id') ->where([ 'verify_status' => 0, - '_string' => implode(' or ', $bindingOrWhere) + '_string' => $bindingOrWhereStr, ]) ->group('game_id,role_id')->select(); $verifyRecords = []; @@ -359,7 +376,7 @@ class TestingResourceRepository ->field('sum(provide_amount) amount, game_id, role_id') ->where([ 'verify_status' => 1, - '_string' => implode(' or ', $bindingOrWhere) + '_string' => $bindingOrWhereStr, ]) ->group('game_id,role_id')->select(); $provideRecords = []; @@ -371,9 +388,8 @@ class TestingResourceRepository ->field('sum(provide_amount) amount, game_id, role_id') ->where([ 'verify_status' => 1, - '_string' => implode(' or ', $bindingOrWhere), - 'provide_time' => ['egt', strtotime(date('Y-m-d 00:00:00'))], - 'provide_time' => ['elt', strtotime(date('Y-m-d 23:59:59'))], + '_string' => $bindingOrWhereStr, + 'provide_time' => ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]], ]) ->group('game_id,role_id')->select(); $todayProvideRecords = []; @@ -384,7 +400,7 @@ class TestingResourceRepository $applyItems = M('testing_resource_batch', 'tab_') ->field('sum(apply_amount) amount, game_id, role_id') ->where([ - '_string' => implode(' or ', $bindingOrWhere), + '_string' => $bindingOrWhereStr, ]) ->group('game_id,role_id')->select(); $applyRecords = []; @@ -466,11 +482,19 @@ class TestingResourceRepository $testingUser = $testingUsers[$role['user_id']] ?? null; $binding = $bindings[$role['game_role_id']] ?? null; $bindingRole = null; + + $baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames); + if ($binding) { - $bindGameRoleId = $this->getGameRoleId($binding['game_id'], $binding['bind_role_id']); - $bindingRole = $bindingRoles[$bindGameRoleId] ? $bindingRoles[$bindGameRoleId] : null; + $gameIds = $gameRepository->getGameIdsByBaseGame($baseGame); + foreach ($gameIds as $gameId) { + $bindGameRoleId = $this->getGameRoleId($gameId, $binding['bind_role_id']); + if (isset($bindingRoles[$bindGameRoleId])) { + $bindingRole = $bindingRoles[$bindGameRoleId]; + break; + } + } } - $baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames); $gameSetting = null; if ($baseGame && isset($gameSettings[$baseGame['id']])) { $gameSetting = $gameSettings[$baseGame['id']]; diff --git a/Application/Base/Service/TestingResourceService.class.php b/Application/Base/Service/TestingResourceService.class.php index bd482148e..1fbccfdbd 100644 --- a/Application/Base/Service/TestingResourceService.class.php +++ b/Application/Base/Service/TestingResourceService.class.php @@ -2,6 +2,7 @@ namespace Base\Service; use Base\Facade\Request; +use Base\Repository\GameRepository; use Base\Tool\GameResource; use Base\Repository\TestingResourceRepository; use Base\Repository\SpendRepository; @@ -167,17 +168,16 @@ class TestingResourceService $spendRepository = new SpendRepository(); $spendMap = $spendRepository->withIsCheck($spendMap); - $spendQuota += M('spend', 'tab_') + $spendQuota = M('spend', 'tab_') ->where($spendMap) - ->group('game_id,game_player_id') ->sum('pay_amount'); $totalQuota += round($gameSetting['rate'] / 100 * $spendQuota, 2); } $providedQuota = M('testing_resource_batch', 'tab_') - ->where(['provide_status' => [in, [1, 2]], 'game_id' => $role['game_id'], 'role_id' => $role['role_id']]) + ->where(['provide_status' => ['in', [1, 2]], 'game_id' => $role['game_id'], 'role_id' => $role['role_id']]) ->sum('provide_amount'); $providingQuota = M('testing_resource_batch', 'tab_') - ->where(['verify_status' => [in, [0, 1]], 'provide_status' => 0, 'game_id' => $role['game_id'], 'role_id' => $role['role_id']]) + ->where(['verify_status' => ['in', [0, 1]], 'provide_status' => 0, 'game_id' => $role['game_id'], 'role_id' => $role['role_id']]) ->sum('apply_amount'); return round(floatval($totalQuota) - floatval($providedQuota) - floatval($providingQuota), 2); } @@ -300,9 +300,24 @@ class TestingResourceService throw new \Exception('测试角色所属推广员异常'); } + $game = M('game', 'tab_')->where(['id' => $gameId])->find(); + if (is_null($game)) { + throw new \Exception('游戏不存在'); + } + $gameIds = [$gameId]; + if ($game['data_share'] == 1) { + $gameRepository = new GameRepository(); + $baseGames = $gameRepository->getBaseGames(); + $baseGame = $gameRepository->getBaseGameByGameId($gameId, $baseGames); + if (is_null($baseGame)) { + throw new \Exception('游戏不存在'); + } + $gameIds = $gameRepository->getGameIdsByBaseGame($baseGame); + } + $bindRole = M('user_play_info', 'tab_') ->field(['id', 'role_id', 'user_id', 'promote_id']) - ->where(['game_role_id' => $bindGameRoleId]) + ->where(['role_id' => $bindRoleId, 'game_id' => ['in', $gameIds]]) ->find(); if (is_null($bindRole)) { throw new \Exception('玩家角色不存在'); diff --git a/Application/Home/Controller/TestingResourceController.class.php b/Application/Home/Controller/TestingResourceController.class.php index 1d8f5bea8..c9a014e3d 100644 --- a/Application/Home/Controller/TestingResourceController.class.php +++ b/Application/Home/Controller/TestingResourceController.class.php @@ -10,6 +10,7 @@ use Think\Model; use Base\Service\TestingResourceService; use Base\Repository\TestingResourceRepository; use Base\Repository\GameRepository; +use Base\Service\GameService; class TestingResourceController extends BaseController { @@ -135,11 +136,21 @@ class TestingResourceController extends BaseController $bindingRole = null; if ($role) { $servers = M('server', 'tab_')->field('id,server_name,server_id')->where(['game_id' => $role['game_id']])->order('server_id asc')->select(); + $game = M('game', 'tab_')->where(['id' => $role['game_id']])->find(['id', 'data_share']); $binding = M('testing_binding', 'tab_')->where(['game_id' => $role['game_id'], 'role_id' => $role['role_id']])->find(); if ($binding) { + + $gameIds = [$role['game_id']]; + if ($game['data_share'] == 1) { + $gameRepository = new GameRepository(); + $baseGames = $gameRepository->getBaseGames(); + $baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames); + $gameIds = $gameRepository->getGameIdsByBaseGame($baseGame); + } + $bindingRole = M('user_play_info', 'tab_') ->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name']) - ->where(['game_id' => $binding['game_id'], 'role_id' => $binding['bind_role_id']]) + ->where(['game_id' => ['in', $gameIds], 'role_id' => $binding['bind_role_id']]) ->find(); if ($bindingRole) { $bindingRole['binding_time'] = $binding['create_time']; @@ -230,25 +241,29 @@ class TestingResourceController extends BaseController public function getUserRoles() { $gameId = I('game_id', 0); - $serverId = I('server_id', 0); - $userAccount = I('user_account', ''); - $server = M('server', 'tab_')->field(['id', 'server_name', 'server_id'])->where(['id' => $serverId])->find(); - if (is_null($server)) { - return $this->ajaxReturn(['status' => 0, 'message' => '区服不存在']); - } + $roleId = I('role_id', 0); - $user = M('user', 'tab_')->field(['id', 'promote_id'])->where(['account' => $userAccount])->find(); - if (is_null($user)) { - return $this->ajaxReturn(['status' => 0, 'message' => '账号不存在']); + $game = M('game', 'tab_')->where(['id' => $gameId])->find(); + if (is_null($game)) { + return $this->ajaxReturn(['status' => 0, 'message' => '游戏不存在']); } - $testingUser = M('testing_user', 'tab_')->where(['user_account' => $userAccount])->find(); - $isTestingAccount = is_null($testingUser) ? false : true; - + $gameIds = [$gameId]; + if ($game['data_share'] == 1) { + $gameRepository = new GameRepository(); + $baseGames = $gameRepository->getBaseGames(); + $baseGame = $gameRepository->getBaseGameByGameId($gameId, $baseGames); + if (is_null($baseGame)) { + return $this->ajaxReturn(['status' => 0, 'message' => '游戏不存在']); + } + $gameIds = $gameRepository->getGameIdsByBaseGame($baseGame); + } + $roles = M('user_play_info', 'tab_') ->field(['id', 'role_id', 'role_name']) - ->where(['user_account' => $userAccount, 'game_id' => $gameId, 'server_id' => $server['server_id']]) + ->where(['role_id' => $roleId, 'game_id' => ['in', $gameIds]]) ->select(); - return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['roles' => $roles, 'is_testing_account' => $isTestingAccount]]); + + return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['roles' => $roles]]); } } \ No newline at end of file diff --git a/Application/Home/View/default/TestingResource/apply.html b/Application/Home/View/default/TestingResource/apply.html index b43622e30..0c52547e7 100644 --- a/Application/Home/View/default/TestingResource/apply.html +++ b/Application/Home/View/default/TestingResource/apply.html @@ -216,9 +216,9 @@
@@ -273,7 +273,7 @@