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 ' + + '; + + + + + + + +