*/ class SpendController extends ThinkController { const model_name = 'Spend'; public function lists() { $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)); 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['pay_game_status'])) { $map['pay_game_status'] = $_REQUEST['pay_game_status']; unset($_REQUEST['pay_game_status']); } $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 (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"]); $map1 = $map; $map1['pay_status'] = 1; $total = null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); $ttotal = null_to_0(D(self::model_name)->where('pay_time' . total(1))->where(array('pay_status' => 1))->sum('pay_amount')); $ytotal = null_to_0(D(self::model_name)->where('pay_time' . total(5))->where(array('pay_status' => 1))->sum('pay_amount')); $this->assign('total', $total); $this->assign('ttotal', $ttotal); $this->assign('ytotal', $ytotal); $this->meta_title = $this->m_title = '游戏充值'; $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find()); $data = D(self::model_name)->lists($_GET["p"], $map, $order); $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']] ?? '无'; } $this->assign('isMarketAdmin', $isMarketAdmin); $this->assign('marketAdmins', getMarketAdmins()); $this->assign('startDate', $startDate); $this->assign('endDate', $endDate); $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); $this->display(); } /** * 充值补单功能 */ public function order_repair() { if (IS_AJAX) { } } }