/** * 环境初始化 * @param array $config * @return void */ public static function init(array $config = null) { if (is_array($config)) { self::$config = array_merge(self::$config, $config); } /** * 设置自动载入函数 */ if (self::$config['autoload']) { if (function_exists('__autoload')) { spl_autoload_register('__autoload'); } spl_autoload_register(array('Base_Common', 'autoload')); } /** * GPC */ if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { $_GET = self::stripslashesRecursive($_GET); $_POST = self::stripslashesRecursive($_POST); $_COOKIE = self::stripslashesRecursive($_COOKIE); reset($_GET); reset($_POST); reset($_COOKIE); } /** * 设置异常抛出 */ set_exception_handler(array('Base_Common', 'exceptionHandle')); /** * 设置时区 */ date_default_timezone_set(self::$config['timezone']); }
public function indexAction() { //检查权限 $PermissionCheck = $this->manager->checkMenuPermission(0); if ($PermissionCheck['return']) { $SexList = $this->oUser->getSexList(); $AuthStatusList = $this->oUser->getAuthStatus(); $AuthIdTypesList = $this->oUser->getAuthIdType(); $params['Sex'] = isset($SexList[strtoupper(trim($this->request->Sex))]) ? substr(strtoupper(trim($this->request->Sex)), 0, 8) : ""; $params['Name'] = urldecode(trim($this->request->Name)) ? substr(urldecode(trim($this->request->Name)), 0, 8) : ""; $params['NickName'] = urldecode(trim($this->request->NickName)) ? substr(urldecode(trim($this->request->NickName)), 0, 8) : ""; $params['AuthStatus'] = isset($AuthStatusList[strtoupper(trim($this->request->AuthStatus))]) ? substr(strtoupper(trim($this->request->AuthStatus)), 0, 8) : ""; $params['Page'] = abs(intval($this->request->Page)) ? abs(intval($this->request->Page)) : 1; $params['PageSize'] = 5; $params['getCount'] = 1; $UserList = $this->oUser->getUserLst($params); //导出EXCEL链接 $export_var = "<a href =" . Base_Common::getUrl('', 'xrace/user', 'user.list.download', $params) . "><导出表格></a>"; //翻页参数 $page_url = Base_Common::getUrl('', 'xrace/user', 'index', $params) . "&Page=~page~"; $page_content = base_common::multi($UserList['UserCount'], $page_url, $params['Page'], $params['PageSize'], 10, $maxpage = 100, $prevWord = '上一页', $nextWord = '下一页'); foreach ($UserList['UserList'] as $UserId => $UserInfo) { echo $UserInfo['auth_state'] . "<br>"; $UserList['UserList'][$UserId]['sex'] = isset($SexList[$UserInfo['sex']]) ? $SexList[$UserInfo['sex']] : "保密"; $UserList['UserList'][$UserId]['AuthStatus'] = isset($AuthStatusList[$UserInfo['auth_state']]) ? $AuthStatusList[$UserInfo['auth_state']] : "未知"; $UserList['UserList'][$UserId]['AuthStatus'] = $UserInfo['auth_state'] == "AUTHED" && isset($AuthIdTypesList[strtoupper(trim($UserInfo['id_type']))]) ? $UserList['UserList'][$UserId]['AuthStatus'] . "/" . $AuthIdTypesList[strtoupper(trim($UserInfo['id_type']))] : $UserList['UserList'][$UserId]['AuthStatus']; $UserList['UserList'][$UserId]['Birthday'] = is_null($UserInfo['birth_day']) ? "未知" : $UserInfo['birth_day']; } include $this->tpl('Xrace_User_UserList'); } else { $home = $this->sign; include $this->tpl('403'); } }
/** *问题浏览量更新 */ public function pageViewAction() { //基础元素,必须参与验证 $View['PageId'] = abs(intval($this->request->PageId)); $View['ViewIP'] = urldecode(trim($this->request->ViewIP)); $View['Time'] = abs(intval($this->request->Time)); //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = '5173'; $sign_to_check = base_common::check_sign($View, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($View['Time'] - time()) <= 600) { $View['ViewIP'] = Base_Common::ip2long($View['ViewIP']); $InsertLog = $this->oView->addViewLog($View); if ($InsertLog) { $result = array('return' => 1, 'comment' => "添加成功"); } else { $result = array('return' => 2, 'comment' => "添加失败"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } echo json_encode($result); }
public function insert() { $result = Base_Common::pputHttpSQS($this->getDbTable(), $this->logArr); if (!$result) { $fp = fopen(Base_Common::$config['vars_dir'] . 'error.log', 'a+'); fwrite($fp, var_export($this->logArr, true)); fclose($fp); } }
/** *账号生成 */ public function insertPvAction() { //基础元素,必须参与验证 $PV['PageId'] = abs(intval($this->request->PageId)); $PV['Time'] = abs(intval($this->request->Time)); $PV['IP'] = $this->request->IP ? $this->request->IP : "127.0.0.1"; $PV['Browser'] = $this->request->Browser; $PV['UserSourceId'] = abs(intval($this->request->UserSourceId)); $PV['UserSourceDetail'] = abs(intval($this->request->UserSourceDetail)); $PV['UserSourceProjectId'] = abs(intval($this->request->UserSourceProjectId)); $PV['UserSourceActionId'] = abs(intval($this->request->UserSourceActionId)); $PV['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = base_common::check_sign($PV, $p_sign); //不参与验证的元素 $PV['IP'] = Base_Common::ip2long($PV['IP']); //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($PV['Time'] - time()) <= 600) { unset($PV['ReturnType']); if ($PV['UserSourceId'] == 9 && $PV['UserSourceDetail'] == 24) { $insertLog = true; } else { $insertLog = $this->oPV->insertPvLog($PV); } if ($insertLog) { $result = array('return' => 1, 'comment' => "记录成功"); } else { $result = array('return' => 0, 'comment' => "记录失败"); } } else { $result = array('return' => 2, 'comment' => "时间有误"); } } else { $result = array('return' => 2, 'comment' => "验证失败,请检查URL"); } $PV['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($PV['ReturnType'] == 1) { echo json_encode($result); } }
/** * 移除cookie * @param string $key * @param string $url * @return void */ public static function remove($key, $url = null) { if (!isset($_COOKIE[$key])) { return; } $path = '/'; if (!empty($url)) { $parsed = parse_url($url); $path = empty($parsed['path']) ? '/' : Base_Common::url(null, $parsed['path']); } if (is_array($_COOKIE[$key])) { foreach ($_COOKIE[$key] as $name => $val) { setcookie("{$key}[{$name}]", '', time() - 2592000, $path); } } else { setcookie($key, '', time() - 2592000, $path); } }
/** *获取服务器列表登录 */ public function getServerByIpAction() { //基础元素,必须参与验证 $Config['ServerIp'] = $this->request->ServerIp; $Config['Time'] = abs(intval($this->request->Time)); $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = trim($this->request->sign); //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Config, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Config['Time'] - time()) <= 600) { if ($Config['ServerIp']) { $ServerIp = Base_Common::ip2long($Config['ServerIp']); $ServerInfo = $this->oServer->getByIp($ServerIp); if ($ServerInfo['ServerId']) { $result = array('return' => 1, 'ServerInfo' => $ServerInfo, 'comment' => '找到服务器'); } else { $result = array('return' => 2, 'comment' => '你所查询的IP不属于任何服务器'); } } else { $result = array('return' => 0, 'comment' => "请输入服务器IP"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } if ($Config['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['ServerInfo']['ServerId'] . "|" . iconv('UTF-8', 'GBK', $result['ServerInfo']['name']); } echo $r; } }
public function addSystemLog($QuestionId, $AuthorName, $OperatorName, $LogTypeId, $LogText) { $LogType = $this->config->sys_log_arr; $LogTypeId = intval($LogTypeId); if (isset($LogType[$LogTypeId])) { $tip = $LogType[$LogTypeId]; } else { return false; } $QuestionId = intval($QuestionId); //if($QuestionId == 0) //{ // return false; //} $log_id = Base_Common::get_log_sn(); $message = $tip . $LogText; $time = time(); $date = date("Ym", $time); $table_to_process = Base_Widget::getDbTable($this->table) . "_" . $date; $dataArr = array('id' => $log_id, 'AuthorName' => $AuthorName, 'qid' => $QuestionId, 'user' => $OperatorName, 'message' => $message, 'time' => $time); return $this->db->insert($table_to_process, $dataArr); }
public function authLogAction() { //检查权限 $PermissionCheck = $this->manager->checkMenuPermission(0); if ($PermissionCheck['return']) { //页面参数预处理 $params['StartDate'] = isset($this->request->StartDate) ? substr(strtoupper(trim($this->request->StartDate)), 0, 10) : date("Y-m-d", time()); $params['EndDate'] = isset($this->request->EndDate) ? substr(strtoupper(trim($this->request->EndDate)), 0, 10) : date("Y-m-d", time()); $params['AuthResult'] = isset($this->request->AuthResult) ? substr(strtoupper(trim($this->request->AuthResult)), 0, 8) : ""; $params['ManagerId'] = isset($this->request->ManagerId) ? intval($this->request->ManagerId) : 0; //分页参数 $params['Page'] = abs(intval($this->request->Page)) ? abs(intval($this->request->Page)) : 1; $params['PageSize'] = 2; //获取用户列表时需要获得记录总数 $params['getCount'] = 1; //获取实名认证记录的状态列表 $AuthLogIdStatusList = $this->oUser->getAuthLogStatusTypeList(); //获取所有管理员列表 $ManagerList = $this->manager->getAll('id,name'); //获取实名认证记录 $AuthLog = $this->oUser->getAuthLog($params); //导出EXCEL链接 $export_var = "<a href =" . Base_Common::getUrl('', 'xrace/user', 'auth.log.download', $params) . "><导出表格></a>"; //翻页参数 $page_url = Base_Common::getUrl('', 'xrace/user', 'auth.log', $params) . "&Page=~page~"; $page_content = base_common::multi($AuthLog['AuthLogCount'], $page_url, $params['Page'], $params['PageSize'], 10, $maxpage = 100, $prevWord = '上一页', $nextWord = '下一页'); //初始化一个空的用户数组 $UserList = array(); foreach ($AuthLog['AuthLog'] as $AuthId => $LogInfo) { //管理员账号 $AuthLog['AuthLog'][$AuthId]['ManagerName'] = isset($ManagerList[$LogInfo['op_uid']]) ? $ManagerList[$LogInfo['op_uid']]['name'] : "未知"; $AuthLog['AuthLog'][$AuthId]['AuthResultName'] = isset($AuthLogIdStatusList[$LogInfo['auth_result']]) ? $AuthLogIdStatusList[$LogInfo['auth_result']] : "未知"; // 如果管理员记录已经获取到 if (isset($UserList[$LogInfo['user_id']])) { $ManagerInfo = $UserList[$LogInfo['user_id']]; } else { $ManagerInfo = $this->oUser->getUserInfo($LogInfo['user_id'], "name"); } $AuthLog['AuthLog'][$AuthId]['UserName'] = $ManagerInfo['name']; //实名认证提交的照片 $AuthLog['AuthLog'][$AuthId]['submit_img1'] = isset($AuthLog['AuthLog'][$AuthId]['submit_img1']) ? urldecode($AuthLog['AuthLog'][$AuthId]['submit_img1']) : ""; $AuthLog['AuthLog'][$AuthId]['submit_img2'] = isset($AuthLog['AuthLog'][$AuthId]['submit_img2']) ? urldecode($AuthLog['AuthLog'][$AuthId]['submit_img2']) : ""; } //模板渲染 include $this->tpl('Xrace_User_AuthLog'); } else { $home = $this->sign; include $this->tpl('403'); } }
public function getItemPickUpCount($StartTime, $EndTime, $UserId, $ServerId, $oWherePartnerPermission, $ItemListText) { //查询列 $select_fields = array('PickUpCount' => 'count(*)'); //初始化查询条件 $whereStartTime = $StartTime ? " ItemPickUpTime >= '" . strtotime($StartTime) . "' " : ""; $whereEndTime = $EndTime ? " ItemPickUpTime <= '" . strtotime($EndTime) . "' " : ""; $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : ""; $whereItemID = $ItemListText ? " ItemID in ( " . $ItemListText . " )" : ""; $whereUser = $UserId ? " UserId = " . $UserId . " " : ""; $whereCondition = array($whereStartTime, $whereEndTime, $whereUser, $whereServer, $oWherePartnerPermission, $whereItemID); //生成查询列 $fields = Base_common::getSqlFields($select_fields); //生成条件列 $where = Base_common::getSqlWhere($whereCondition); if ($UserId) { $position = Base_Common::getUserDataPositionById($UserId); $table_to_process = Base_Common::getUserTable($this->table_list['pickitem_user'], $position); } else { $Date = date("Ymd", strtotime($StartTime)); $table_to_process = Base_Widget::getDbTable($this->table_list['pickitem']) . "_" . $Date; } $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where; $PickUpCount = $this->db->getOne($sql, false); if ($PickUpCount) { return $PickUpCount; } else { return 0; } }
public function UserLoginSumDate($UserId, $oWherePartnerPermission) { //初始化查询条件 $whereCondition = array($oWherePartnerPermission); $where = Base_common::getSqlWhere($whereCondition); $position = Base_Common::getUserDataPositionById($UserId); $table_to_process = Base_Widget::getDbTable($this->table_user) . "_" . $position['db_fix']; $sql = "SELECT sum(`LogoutTime`-`LoginTime`) as `LoingTime` FROM {$table_to_process} WHERE `UserId` = {$UserId} and `LogoutTime` > 0 and `LogoutTime` > `LoginTime` " . $where; return $this->db->getOne($sql, false); }
public function upload($path) { $this->savePath = $path; if (!is_dir($this->fileDir . $this->savePath) && !mkdir($this->fileDir . $this->savePath)) { throw new Base_Exception(sprintf('目录 %s 不存在', $this->fileDir . $this->savePath), 403); } @chmod($this->fileDir . $this->savePath); if (!is_writeable($this->fileDir . $this->savePath)) { throw new Base_Exception(sprintf('目录 %s 不可写', $this->fileDir . $this->savePath), 403); } foreach ($this->fileArr as $k => $file) { if (!self::isUploadedFile($file['tmp_name'])) { $this->resultArr[$k]['errno'] = 1; $this->resultArr[$k]['description'] = '文件上传失败'; continue; } $suffix = Base_Common::fileSuffix($file['name']); $isImage = in_array($suffix, $this->allowImageExtArr); // if ($this->onlyAllowImage && !$isImage) { // $this->resultArr[$k]['errno'] = 2; // $this->resultArr[$k]['description'] = '不允许上传非图片类型文件'; // continue; // } if (!in_array($suffix, $this->allowFileExtArr)) { $this->resultArr[$k]['errno'] = 3; $this->resultArr[$k]['description'] = '类型文件不允许'; continue; } if ($file['size'] > $this->maxFileSize) { $this->resultArr[$k]['errno'] = 4; $this->resultArr[$k]['description'] = '文件大小超过限制'; continue; } $filename = $file['name']; $target = $this->fileDir . $this->savePath . '/' . $filename; $target_root = $this->fileUrl . "/" . $this->savePath . '/' . $filename; if (move_uploaded_file($file['tmp_name'], $target) || @copy($file['tmp_name'], $target)) { $this->resultArr[$k]['errno'] = 0; $this->resultArr[$k]['description'] = '文件上传成功'; $this->resultArr[$k]['path'] = $target; $this->resultArr[$k]['path_root'] = $target_root; $this->uploadedFileArr[] = array('name' => $file['name'], 'url' => $this->savePath . $filename, 'type' => $file['type'], 'size' => $file['size'], 'description' => $file['description'], 'is_image' => $isImage); } else { $this->resultArr[$k]['errno'] = 5; $this->resultArr[$k]['description'] = '文件上传失败'; } } return $this; }
public function detailAction() { //检查权限 $this->manager->checkMenuPermission($this->sign, Widget_Manager::MENU_PURVIEW_UPDATE); $SourceProjectId = intval($this->request->SourceProjectId); $SourceProject = $this->oSourceProject->getRow($SourceProjectId, '*'); $SourceProjectDetail = $this->oSourceProject->getDetail($SourceProjectId); $SourceList = $this->oSource->getAll(); $SourceDetailList = $this->oSourceDetail->getAll(0); //下载参数 $export = $this->request->export ? intval($this->request->export) : 0; $links = 'http://passport.wjyx.com/?c=media&PageId=2'; foreach ($SourceProjectDetail as $key => $value) { $SourceProjectDetail[$key]['SourceName'] = $SourceList[$value['SourceId']]['name']; $SourceProjectDetail[$key]['SourceDetailName'] = $value['SourceDetail'] ? $SourceDetailList[$value['SourceDetail']]['name'] : "<font color = 'red'>全部</font>"; $SourceProjectDetail[$key]['SourceUrl'] = $links . "&UserSourceId=" . $value['SourceId'] . "&UserSourceDetail=" . $value['SourceDetail'] . "&UserSourceProjectId=" . $value['SourceProjectId']; //$SourceProjectDetail[$key]['SourceUrl'] = "&UserSourceId=".$value['SourceId']."UserSourceDetail".$value['SourceDetail']."UserSourceProjectId".$value['SourceProjectId']; // $SourceProjectDetail[$key]['SourceUrl'] = Base_Common::my_authcode($SourceProjectDetail[$key]['SourceUrl'],'','limaogame'); } $param['SourceProjectId'] = $SourceProjectId; $execlParam = $param + array("export" => 1); $export_var = "<a href =" . Base_Common::getUrl('', 'config/source/project', 'detail', $execlParam) . "><导出表格></a>"; if ($export == 1) { $oExcel = new Third_Excel(); $FileName = '广告位列表--' . $SourceProject['name']; //标题栏 $title = array("广告商", "广告位", "连接参数"); $oExcel->download($FileName)->addSheet('广告位列表'); $oExcel->addRows(array($title)); foreach ($SourceProjectDetail as $key => $sourceproject_detail) { //生成单行数据 $t['SourceName'] = $sourceproject_detail['SourceName']; $t['SourceDetailName'] = $sourceproject_detail['SourceDetailName']; $t['SourceUrl'] = $sourceproject_detail['SourceUrl']; $oExcel->addRows(array($t)); unset($t); } //结束excel $oExcel->closeSheet()->close(); } include $this->tpl('Config_Source_Project_Detail_list'); }
public function getPvpLogTotal($whereTime) { $table_to_process = Base_Widget::getDbTable($this->table_pvp_log_total); $sql = "truncate {$table_to_process}"; $this->db->query($sql); for ($i = 0; $i <= 255; $i++) { $position = Base_Common::getUserDataPositionById(sprintf("%03d", $i)); $table_to_get = Base_Common::getUserTable($this->table_pvp_log_user, $position); $sql = "replace into {$table_to_process} (ServerId,UserId,Won,PvpCount) select ServerId,UserId,Won,Count(*) from {$table_to_get} where {$whereTime} group by ServerId,UserId,Won"; echo $this->db->query($sql) . "-"; } }
function getOperatorFromVadmin($OperatorName, $Detail = "") { Base_Common::getLocalIP(); $array = array('CurrentIp' => $IP, 'OpLoginId' => $OperatorName); $Data = json_encode($array); $key = "987654321!@#\$%"; $txt = "6" . $Data . $key; $sign = md5(strtoupper($txt)); $Data = urlencode(base64_encode($Data)); $url = "http://tradeservice.5173esb.com/CommService/CommonRequest.ashx?OperationType=6&Data={$Data}&Sign={$sign}"; $return = file_get_contents($url); $return_arr = json_decode(base64_decode($return), true); if (is_array($return_arr)) { $OperatorInfo = json_decode($return_arr['JsonData'], true); if ($OperatorInfo['OpLoginId'] != "") { $Operator = array('photo' => $OperatorInfo['OpAvatar'], 'QQ' => $OperatorInfo['OPQQ'], 'mobile' => $OperatorInfo['OPMObile'], 'tel' => $OperatorInfo['OPTel'], 'weixin' => $OperatorInfo['OPWeiXin'], 'name' => $OperatorInfo['OPName'], 'cno' => $OperatorInfo['OpRealName'], 'login_name' => $OperatorInfo['OpLoginId'], 'weixinPicUrl' => $OperatorInfo['OPWeiXinPicUrl'], 'weixinPicUrl_officer' => $OperatorInfo['OPWeiXinPicUrl2'], 'xnGroupId' => $OperatorInfo['OPSmallCanUID'], 'xnGroupId_officer' => $OperatorInfo['OPSmallCanUID2'], 'photo_officer' => $OperatorInfo['OpAvatar2'], 'qq_url' => $OperatorInfo['OPQQIdKey'] == "" ? "" : 'http://sighttp.qq.com/authd?IDKEY=' . $OperatorInfo['OPQQIdKey'], 'qq_url_officer' => $OperatorInfo['OPQQIdKey2'] == "" ? "" : 'http://sighttp.qq.com/authd?IDKEY=' . $OperatorInfo['OPQQIdKey2'], 'QQ_officer' => $OperatorInfo['OPQQ2'], 'mobile_officer' => $OperatorInfo['OPMObile2'], 'tel_officer' => $OperatorInfo['OPTel2'], 'weixin_officer' => $OperatorInfo['OPWeiXin2'], 'name_officer' => $OperatorInfo['OPName2'], 'cno_officer' => $OperatorInfo['OpRealName2'], 'login_name_officer' => $OperatorInfo['OpLoginId2'], 'qq_link_type' => $OperatorInfo['IsNewPopQQ'] == 0 ? 'js' : 'http'); //去除所需列表之外的数据 $t = explode(",", $Detail); if (count($t) > 1) { foreach ($Operator as $key => $value) { if (!in_array($key, $t)) { unset($Operator[$key]); } } } return $Operator; } else { return false; } } else { return false; } }
public function raceSportsTypeInsertAction() { //检查权限 $PermissionCheck = $this->manager->checkMenuPermission("RaceStageModify"); if ($PermissionCheck['return']) { //分站ID $RaceStageId = intval($this->request->RaceStageId); //分组ID $RaceGroupId = intval($this->request->RaceGroupId); //比赛ID $RaceId = intval($this->request->RaceId); //运动类型ID $SportsTypeId = intval($this->request->SportsTypeId); //需要添加的运动类型置于哪个位置之后,默认为开头 $After = isset($this->request->After) ? intval($this->request->After) : -1; //获取当前分站信息 $RaceStageInfo = $this->oRace->getRaceStage($RaceStageId, '*'); //解包压缩数组 $RaceStageInfo['comment'] = json_decode($RaceStageInfo['comment'], true); //如果当前分站未配置了当前分组 if (!isset($RaceStageInfo['comment']['SelectedRaceGroup'][$RaceGroupId])) { $response = array('errno' => 1); } else { //获取赛事分组信息 $RaceGroupInfo = $this->oRace->getRaceGroup($RaceGroupId, '*'); //如果赛事分组尚未配置 if (!$RaceGroupInfo['RaceGroupId']) { $response = array('errno' => 2); } else { $this->oSports = new Xrace_Sports(); //获取运动类型信息 $SportsTypeInfo = $this->oSports->getSportsType($SportsTypeId, '*'); //如果未获取到有效的运动类型 if (!isset($SportsTypeInfo['SportsTypeId'])) { $response = array('errno' => 3); } else { //获取比赛信息 $RaceInfo = $this->oRace->getRaceInfo($RaceId); //如果有获取到比赛信息 并且 赛事分站ID和赛事分组ID相符 if (isset($RaceInfo['RaceId']) && $RaceStageId == $RaceInfo['RaceStageId'] && $RaceGroupId == $RaceInfo['RaceGroupId']) { //数据解包 $RaceInfo['comment'] = isset($RaceInfo['comment']) ? json_decode($RaceInfo['comment'], true) : array(); //初始运动类型信息列表 $RaceInfo['comment']['DetailList'] = isset($RaceInfo['comment']['DetailList']) ? $RaceInfo['comment']['DetailList'] : array(); //运动类型列表排序 ksort($RaceInfo['comment']['DetailList']); //如果添加在某个元素之后 且 元素下标不越界 if ($After >= 0 && $After <= count($RaceInfo['comment']['DetailList'])) { //添加元素 $RaceInfo['comment']['DetailList'] = Base_Common::array_insert($RaceInfo['comment']['DetailList'], array('SportsTypeId' => $SportsTypeId), $After + 1); } elseif ($After == -1) { //添加元素 $RaceInfo['comment']['DetailList'] = Base_Common::array_insert($RaceInfo['comment']['DetailList'], array('SportsTypeId' => $SportsTypeId), $After + 1); } else { //默认为在表尾部添加元素 $RaceInfo['comment']['DetailList'][count($RaceInfo['comment']['DetailList'])] = array('SportsTypeId' => $SportsTypeId); } //数据打包 $RaceInfo['comment'] = json_encode($RaceInfo['comment']); //更新比赛 $res = $this->oRace->updateRace($RaceId, $RaceInfo); $response = $res ? array('errno' => 0) : array('errno' => 9); } } } } echo json_encode($response); } else { $home = $this->sign; include $this->tpl('403'); } }
/** *根据cookie信息获取未登录用户的服务记录数量 */ public function serviceLogUnloggedAction() { //基础元素,必须参与验证 $User['QuickAsk'] = urldecode(trim($this->request->QuickAsk)); $User['Time'] = abs(intval($this->request->Time)); $User['NewCount'] = abs(intval($this->request->NewCount)) ? abs(intval($this->request->NewCount)) : 3; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = '5173'; $sign_to_check = base_common::check_sign($User, $p_sign); //不参与验证的元素 $oMenCache = new Base_Cache_Memcache("Complaint"); $QuestionStatusList = $this->config->QuestionStatusList; $QuestionTypeList = $this->config->QuestionTypeList; //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($User['Time'] - time()) <= 600) { //初始化结果数组 $QuestionTypeArr = array('ask', 'suggest', 'complain'); foreach ($QuestionTypeArr as $key => $value) { $CategoryInfo = $this->oCategory->getCategoryByQuestionType($value, 'name'); $ServiceNum[$value] = array('Num' => 0, 'Content' => "我的" . $CategoryInfo['name'] . "记录"); } $NewLog = array(); $ask_type = unserialize(stripslashes($User['QuickAsk'])); $IdArr = array($ask_type['zx'], $ask_type['jy']); foreach ($IdArr as $key => $value) { if (trim($value) == "") { unset($IdArr[$key]); } } if (count($IdArr)) { //获取咨询数量 $ServiceNum['ask']['List'] = $this->oQuestion->getServiceQuestionList(array('IdList' => implode(",", $IdArr), 'QuestionType' => 'ask', 'Parent' => 0, 'Revocation' => 0)); $ServiceNum['ask']['Num'] = count($ServiceNum['ask']['List']); //从缓存服务器上获取是否有新未读数据 foreach ($ServiceNum['ask']['List'] as $key => $QuestionInfo) { $M = $oMenCache->get('fw' . $QuestionInfo['QuestionId']); if ($M) { $ServiceNum['ask']['New'] = 1; } //echo $QuestionInfo['QuestionId']."-".$QuestionInfo['status']."<br>"; if ($QuestionInfo['status'] == 1) { $NewLog[$QuestionInfo['time']][] = array('QuestionId' => $QuestionInfo['QuestionId'], 'QuestionType' => 'ask'); } } unset($ServiceNum['ask']['List']); //获取建议数量 $ServiceNum['suggest']['List'] = $this->oQuestion->getServiceQuestionList(array('IdList' => implode(",", $IdArr), 'QuestionType' => 'suggest', 'Parent' => 0, 'Revocation' => 0)); $ServiceNum['suggest']['Num'] = count($ServiceNum['suggest']['List']); //从缓存服务器上获取是否有新未读数据 foreach ($ServiceNum['suggest']['List'] as $key => $QuestionInfo) { $M = $oMenCache->get('fw' . $QuestionInfo['QuestionId']); if ($M) { $ServiceNum['suggest']['New'] = 1; } if ($QuestionInfo['status'] == 1) { $NewLog[$QuestionInfo['time']][] = array('QuestionId' => $QuestionInfo['QuestionId'], 'QuestionType' => 'suggest'); } } unset($ServiceNum['suggest']['List']); } else { $ServiceNum['ask']['Num'] = 0; $ServiceNum['suggest']['Num'] = 0; } $IdList = $ask_type['ts']; if (count(explode(',', $IdList)) >= 1 && $IdList != "") { //获取投诉数量 $ServiceNum['complain']['List'] = $this->oComplain->getComplainServiceList(array('IdList' => $IdList, 'Public' => '0,2')); $ServiceNum['complain']['Num'] = count($ServiceNum['complain']['List']); //从缓存服务器上获取是否有新未读数据 foreach ($ServiceNum['complain']['List'] as $key => $QuestionInfo) { $M = $oMenCache->get('ts' . $QuestionInfo['QuestionId']); if ($M) { $ServiceNum['complain']['New'] = 1; } if (in_array($QuestionInfo['status'], array(0, 4))) { $NewLog[$QuestionInfo['time']][] = array('QuestionId' => $QuestionInfo['QuestionId'], 'QuestionType' => 'complain'); } } unset($ServiceNum['complain']['List']); } else { $ServiceNum['complain']['Num'] = 0; } krsort($NewLog); $i = 0; $NewServiceList = array(); foreach ($NewLog as $Time => $TimeList) { foreach ($TimeList as $key => $Question) { if ($i < $User['NewCount']) { switch ($Question['QuestionType']) { case "ask": $QuestionInfo = $this->oQuestion->getQuestion($Question['QuestionId'], "id,description,time,atime,status,qtype"); //生成问题链接 $QuestionInfo['QuestionUrl'] = $this->oQuestion->getQuestionLink($QuestionInfo['id'], "question"); //复制问题分类 $QuestionInfo['QuestionType'] = $Question['QuestionType']; //生成问题状态 if ($QuestionInfo['status'] == 1) { $QuestionInfo['QuestionStatus'] = 1; } else { $QuestionInfo['QuestionStatus'] = 2; } $NewServiceList[] = $QuestionInfo; break; case "suggest": $QuestionInfo = $this->oQuestion->getQuestion($Question['QuestionId'], "id,description,time,atime,status,qtype"); //生成问题链接 $QuestionInfo['QuestionUrl'] = $this->oQuestion->getQuestionLink($QuestionInfo['id'], "question"); //复制问题分类 $QuestionInfo['QuestionType'] = $Question['QuestionType']; //生成问题状态 if ($QuestionInfo['status'] == 1) { $QuestionInfo['QuestionStatus'] = 1; } else { $QuestionInfo['QuestionStatus'] = 2; } $NewServiceList[] = $QuestionInfo; break; case "complain": $QuestionInfo = $this->oComplain->getComplain($Question['QuestionId'], "id,description,time,atime,status,qtype"); //生成问题链接 $QuestionInfo['QuestionUrl'] = $this->oComplain->getQuestionLink($QuestionInfo['id'], "complain"); //复制问题分类 $QuestionInfo['QuestionType'] = $Question['QuestionType']; //生成问题状态 if (in_array($QuestionInfo['status'], array(0, 4))) { $QuestionInfo['QuestionStatus'] = 1; } elseif (in_array($QuestionInfo['status'], array(1, 3))) { $QuestionInfo['QuestionStatus'] = 2; } if ($QuestionInfo['status'] == 2) { $QuestionInfo['QuestionStatus'] = 3; } $NewServiceList[] = $QuestionInfo; break; } } $i++; } } foreach ($NewServiceList as $key => $QuestionInfo) { if (!isset($QtypeList[$QuestionInfo['qtype']])) { $QtypeList[$QuestionInfo['qtype']] = $this->oQtype->getQtypeById($QuestionInfo['qtype']); } $NewServiceList[$key]['Qtype'] = $QtypeList[$QuestionInfo['qtype']]['name']; //格式化提问时间 $NewServiceList[$key]['AddTime'] = date("Y-m-d H:i", $QuestionInfo['time']); //格式化回答时间 $NewServiceList[$key]['AnswerTimeLag'] = $QuestionInfo['QuestionStatus'] >= 2 && $QuestionInfo['atime'] ? Base_Common::timeLagToText($QuestionInfo['time'], $QuestionInfo['atime']) : "-"; //获取问题状态名称 $NewServiceList[$key]['QuestionStatusName'] = $QuestionStatusList[$QuestionInfo['QuestionStatus']]; //格式化问题内容 $NewServiceList[$key]['Content'] = Base_Common::cutstr($QuestionInfo['description'], 14); //获取问题分类 $CategoryInfo = $QuestionTypeList[$QuestionInfo['QuestionType']]; //获取问题主分类 $NewServiceList[$key]['QuestionType'] = $CategoryInfo; unset($NewServiceList[$key]['description']); } //服务记录详情页面信息 $ServiceLogDetail = array('Url' => 'http://sc.5173.com/index.php?question/my_ask.html', 'Content' => '查看全部服务记录'); //入口信息 $ServiceEntrance = array('Url' => 'http://sc.5173.com/index.php?question/ask_skip.html', 'Content' => '我要提问'); $result = array('return' => 1, 'ServiceNum' => $ServiceNum, 'ServiceLogDetail' => $ServiceLogDetail, 'ServiceEntrance' => $ServiceEntrance, 'NewServiceList' => $NewServiceList); } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } echo json_encode($result); }
public function machineMapAction() { $sign = "?ctl=config/depot&ac=machine.map"; $this->manager->checkMenuPermission($this->sign, Widget_Manager::MENU_PURVIEW_SELECT); $export = $this->request->export ? intval($this->request->export) : 0; $DepotParame['export'] = 1; $DepotList = $this->oDepot->getAll(); //用于设置默认的页面参数 $DepotIdStr = Base_Common::getArrList($DepotList); $DepotArr = explode(",", $DepotIdStr); //页面参数 $DepotId = $this->request->DepotId ? $this->request->DepotId : $DepotArr[0]; $DepotX = $this->request->X; $DepotXList = $this->getDepotX($DepotId); $DepotName = $DepotList[$DepotId]['name']; if ($DepotId && $DepotX) { $DepotParame['DepotId'] = $DepotId; $DepotParame['X'] = $DepotX; $CageList = $this->oCage->getCageListParams($DepotId, $DepotX); $MachineFields = "MachineId,MachineCode,EstateCode,Position,Size,LocalIP,WebIP,Purpose,Flag"; foreach ($CageList as $CageId => $CageInfo) { $MachineList = $this->oMachine->getMachineByCageId($CageId, $MachineFields); $SizeList = array(); for ($i = 1; $i <= $CageInfo["Size"]; $i++) { $SizeList[$i] = 0; } foreach ($MachineList as $key => $MachineInfo) { $MachineInfo['LocalIP'] = long2ip($MachineInfo['LocalIP']); $MachineInfo['WebIP'] = long2ip($MachineInfo['WebIP']); $SizeList[$MachineInfo['Position']] = $MachineInfo; for ($i = $MachineInfo['Position']; $i <= $MachineInfo['Position'] + $MachineInfo['Size'] - 1; $i++) { if ($i > $MachineInfo['Position']) { unset($SizeList[$i]); } } ksort($SizeList); $CageList[$CageId]['SizeList'] = $SizeList; } } } $imgPath = __APP_ROOT_DIR__ . "admin/html/img/machine/"; //导出表格 $export_var = "<a href =" . Base_Common::getUrl('', 'config/depot', 'machine.map', $DepotParame) . "><导出表格></a>"; if ($export == 1) { /*header("Content-type:application/vnd.ms-excel;charset=UTF-8"); header("Content-Disposition:attachment;filename=test_data.xls"); foreach($CageList as $CageId=> $CageInfo) { echo "<table>"; echo "<tr><td>编号:{$CageInfo['CageCode']}</td></tr>"; echo "<tr><td>电量:{$CageInfo['Current']}A</td></tr>"; echo "<tr><td>实际电量:{$CageInfo['ActualCurrent']}A</td></tr>"; foreach($CageInfo['SizeList'] as $k=> $v) { if($v == 0) { echo "<tr><td></td></tr>"; }else{ if($v['Flag']==1) { echo "<tr><td><img title='内网IP:".$v['LocalIP']." 外网IP:".$v['WebIP']."' src='{$imgPath}server/server".$v['Size'].".png' style='height:".($v['Size']*15)."px' /></td></tr>"; }elseif($v['Flag']==2)//交换机 { echo "<tr><td><img title='内网IP:".$v['MachineCode']."外网IP:".$v['WebIP']."' src='{$imgPath}exchange/exchange".$v['Size'].".png' style='height:".($v['Size']*15)."px' /></td></tr>"; }elseif($v['Flag']==3)//防火墙 { echo "<tr><td><img title='内网IP:".$v['MachineCode']."外网IP:".$v['WebIP']."' src='{$imgPath}router/router".$v['Size'].".png' style='height:".($v['Size']*15)."px' /></td></tr>"; }elseif($v['Flag']==4)//路由器 { echo "<tr><td><img title='内网IP:".$v['MachineCode']."外网IP:".$v['WebIP']."' src='{$imgPath}router/router".$v['Size'].".png' style='height:".($v['Size']*15)."px' /></td></tr>"; } } } echo "</table>"; }*/ /*$FileName='机器列表图'; $oExcel = new Third_Excel(); $oExcel->download($FileName)->addSheet('机器列表图'); include $this->tpl('Config_Depot_MapList3');lll $oExcel->closeSheet()->close(); */ header("Content-type:application/vnd.ms-excel;charset=UTF-8"); header("Content-Disposition:attachment;filename=MachineMap.xls"); include $this->tpl('Config_Depot_MapExecl'); } else { include $this->tpl('Config_Depot_MapList'); } }
public function getUserExchangeCount($UserId, $AppId, $PartnerId, $ServerId, $StartDate, $EndDate, $ExchangeStatus) { //查询列 $select_fields = array('ExchangeCount' => 'count(*)'); //初始化查询条件 $whereStartDate = $StartDate ? " CreateExchangeTime >= " . strtotime($StartDate) . " " : ""; $whereEndDate = $EndDate ? " CreateExchangeTime <= " . (strtotime($EndDate) + 86400 - 1) . " " : ""; $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : ""; $wherePartner = $PartnerId ? " PartnerId = " . $PartnerId . " " : ""; $whereApp = $AppId ? " AppId = " . $AppId . " " : ""; $whereUser = $UserId ? " UserId = " . $UserId . " " : ""; $whereCondition = array($whereStartDate, $whereEndDate, $whereServer, $wherePartner, $whereApp, $whereUser); if ($ExchangeStatus == 0) { //进行中 $table_to_process = Base_Widget::getDbTable($this->table_exchange_queue); } elseif ($ExchangeStatus == 1) { //已成功 $position = Base_Common::getUserDataPositionById($UserId); $table_to_process = Base_Widget::getDbTable($this->table_user) . "_user_" . $position['db_fix']; } else { //已失败 $table_to_process = Base_Widget::getDbTable($this->table_exchange_queue_error); } //生成查询列 $fields = Base_common::getSqlFields($select_fields); //生成条件列 $where = Base_common::getSqlWhere($whereCondition); $StatArr = array('ExchangeCount' => 0); $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where; $ExchangeCount = $this->db->getRow($sql, false); if (isset($ExchangeCount)) { $StatArr['ExchangeCount'] += $ExchangeCount['ExchangeCount']; } return $StatArr; }
public function raceStageGroupSportsTypeAddAction() { //检查权限 $PermissionCheck = $this->manager->checkMenuPermission("RaceStageModify"); if ($PermissionCheck['return']) { $RaceStageId = intval($this->request->RaceStageId); $RaceGroupId = intval($this->request->RaceGroupId); $SportsTypeId = intval($this->request->SportsTypeId); $After = isset($this->request->After) ? intval($this->request->After) : 0; echo "After:" . $After; //获取当前分站信息 $oRaceStage = $this->oRace->getRaceStage($RaceStageId, '*'); //解包压缩数组 $oRaceStage['comment'] = json_decode($oRaceStage['comment'], true); //如果当前分站未配置了当前分组 if (!isset($oRaceStage['comment']['SelectedRaceGroup'][$RaceGroupId])) { //跳转到分站列表页面 $this->response->redirect($this->sign); } //获取赛事分组信息 $oRaceGroup = $this->oRace->getRaceGroup($RaceGroupId, '*'); //如果赛事分组尚未配置 if (!$oRaceGroup['RaceGroupId']) { //跳转到分站列表页面 $this->response->redirect($this->sign); } $this->oSports = new Xrace_Sports(); $oSportsType = $this->oSports->getSportsType($SportsTypeId, '*'); if (!isset($oSportsType['SportsTypeId'])) { $url = Base_Common::getUrl('', 'xrace/race.stage', 'race.stage.group.detail', array('RaceStageId' => $RaceStageId, 'RaceGroupId' => $RaceGroupId)); $this->response->redirect($url); } //获取分站分组配置详情 $RaceStageGroupInfo = $this->oRace->getRaceStageGroup($RaceStageId, $RaceGroupId); //默认开始时间 $StartTime = date("Y-m-d H:i:s", time() + 86400); //默认结束时间 $EndTime = date("Y-m-d H:i:s", time() + 86400 * 2); //如果尚未配置分站分组详情,则用默认空数组替代 if (!is_array($RaceStageGroupInfo)) { $RaceStageGroupInfo = array('PriceList' => 0, 'SingleUser' => 1, 'TeamUser' => 1, 'StartTime' => $StartTime, 'EndTime' => $EndTime, 'comment' => ""); $NewDetail = 1; } $RaceStageGroupInfo['comment'] = json_decode($RaceStageGroupInfo['comment'], true); $RaceStageGroupInfo['comment']['DetailList'] = isset($RaceStageGroupInfo['comment']['DetailList']) ? $RaceStageGroupInfo['comment']['DetailList'] : array(); ksort($RaceStageGroupInfo['comment']['DetailList']); //如果添加在某个元素之后 且 元素下标不越界 if ($After >= 0 && $After < count(count($RaceStageGroupInfo['comment']['DetailList']))) { //添加元素 $RaceStageGroupInfo['comment']['DetailList'] = Base_Common::array_insert($RaceStageGroupInfo['comment']['DetailList'], array('SportsTypeId' => $SportsTypeId), $After + 1); } else { //默认为在表尾部添加元素 $RaceStageGroupInfo['comment']['DetailList'][count($RaceStageGroupInfo['comment']['DetailList'])] = array('SportsTypeId' => $SportsTypeId); } //生成修改后的元素列表 $RaceStageGroupInfo['RaceStageId'] = $RaceStageId; $RaceStageGroupInfo['RaceGroupId'] = $RaceGroupId; $RaceStageGroupInfo['comment'] = json_encode($RaceStageGroupInfo['comment']); //如果认为需要新建数据 if (isset($NewDetail)) { //插入新的数据 $res = $this->oRace->insertRaceStageGroup($RaceStageGroupInfo); } else { //更新数据 $res = $this->oRace->updateRaceStageGroup($RaceStageId, $RaceGroupId, $RaceStageGroupInfo); } $url = Base_Common::getUrl('', 'xrace/race.stage', 'race.stage.group.detail', array('RaceStageId' => $RaceStageId, 'RaceGroupId' => $RaceGroupId)); $this->response->redirect($url); } else { $home = $this->sign; include $this->tpl('403'); } }
public function createKa91OrderAction() { //基础元素,必须参与验证 $Order['UserName'] = $this->request->UserName; $Order['OrderTime'] = abs(intval($this->request->OrderTime)); $Order['ServerId'] = abs(intval($this->request->ServerId)) ? abs(intval($this->request->ServerId)) : 101001001; $Order['SubPassageId'] = $this->request->SubPassageId ? $this->request->SubPassageId : ""; $Order['Coin'] = abs(intval($this->request->Coin)) ? abs(intval($this->request->Coin)) : 0; $Order['OrderIP'] = $this->request->OrderIP ? $this->request->OrderIP : "127.0.0.1"; $Order['PayIP'] = $this->request->PayIP ? $this->request->PayIP : "127.0.0.1"; $Order['PayTime'] = abs(intval($this->request->PayTime)); $Order['StageOrder'] = $this->request->StageOrder; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Order, $p_sign); //不参与验证的元素 $Order['OrderIP'] = Base_Common::ip2long($Order['OrderIP']); $Order['PayIP'] = Base_Common::ip2long($Order['PayIP']); if (in_array($_SERVER["REMOTE_ADDR"], array('61.145.117.183', '61.145.117.184', '219.136.252.38', '121.9.211.6'))) { //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { if ($Order['ServerId']) { //验证用户名有效性 if ($Order['UserName']) { //验证时间戳,时差超过600秒即认为非法 if (abs($Order['PayTime'] - time()) <= 600) { //查询用户 $UserInfo = $this->oUser->GetUserByName($Order['UserName']); if ($UserInfo['UserId']) { $Order['PayUserId'] = $UserInfo['UserId']; $Order['AcceptUserId'] = $UserInfo['UserId']; //获取服务器信息 $ServerInfo = $this->oServer->getRow($Order['ServerId']); if ($ServerInfo['ServerId']) { if ($ServerInfo['AppId'] && $ServerInfo['PartnerId']) { $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']); //验证游戏-平台信息 $PartnerInfo = $this->oPartnerApp->getRow($bind); if ($PartnerInfo['AppId'] && $PartnerInfo['PartnerId']) { $AppInfo = $this->oApp->getRow($PartnerInfo['AppId']); if ($AppInfo['AppId']) { //获取支付方式信息 $PassageInfo = $this->oPassage->getByPassage("Ka91"); if ($PassageInfo['passage_id']) { $checkStageOrder = $this->oPay->getKa91StageOrder($Order['StageOrder']); if ($checkStageOrder['StageOrder']) { $result = array('return' => 1, 'OrderId' => $checkStageOrder['OrderId'], 'comment' => "已经执行过,无需重复执行"); } else { $Order['PassageId'] = $PassageInfo['passage_id']; $Order['AppId'] = $ServerInfo['AppId']; $Order['PartnerId'] = $ServerInfo['PartnerId']; $Order['Amount'] = $PassageInfo['finance_rate'] * $Order['Coin']; $Order['Credit'] = $PassageInfo['finance_rate'] * $Order['Coin']; $Order['ExchangeRate'] = $AppInfo['exchange_rate']; $Order['AppCoin'] = $AppInfo['exchange_rate'] * $Order['Coin']; $Order['OrderStatus'] = 1; $Order['UserSourceId'] = $UserInfo['UserSourceId']; $Order['UserSourceDetail'] = $UserInfo['UserSourceDetail']; $Order['UserSourceProjectId'] = $UserInfo['UserSourceProjectId']; $Order['UserSourceActionId'] = $UserInfo['UserSourceActionId']; $Order['UserRegTime'] = $UserInfo['UserRegTime']; $Pay['PayUserId'] = $Order['PayUserId']; $Pay['AcceptUserId'] = $Order['AcceptUserId']; $Pay['PassageId'] = $Order['PassageId']; $Pay['SubPassageId'] = $Order['SubPassageId']; $Pay['PayIP'] = $Order['PayIP']; $Pay['AppId'] = $Order['AppId']; $Pay['PartnerId'] = $Order['PartnerId']; $Pay['PayTime'] = $Order['PayTime']; $Pay['PayedTime'] = $Order['PayTime']; $Pay['Coin'] = $Order['Coin']; $Pay['Amount'] = $Order['Amount']; $Pay['Credit'] = $Order['Credit']; $Pay['StageOrder'] = $Order['StageOrder']; $Pay['UserSourceId'] = $Order['UserSourceId']; $Pay['UserSourceDetail'] = $Order['UserSourceDetail']; $Pay['UserSourceProjectId'] = $Order['UserSourceProjectId']; $Pay['UserSourceActionId'] = $Order['UserSourceActionId']; $Pay['UserRegTime'] = $Order['UserRegTime']; unset($Order['StageOrder'], $Order['UserName']); $Ka91Pay = $this->oPay->createKa91Pay($Order, $Pay); if (intval($Ka91Pay)) { $result = array('return' => 1, 'OrderId' => $Ka91Pay, 'comment' => "充值成功"); $this->oExchange->createExchangeQueueByOrder(array('OrderId' => $Ka91Pay)); } else { $result = array('return' => 2, 'comment' => "充值失败"); } } } else { $result = array('return' => 0, 'comment' => "您所选择的支付方式不存在"); } } else { $result = array('return' => 0, 'comment' => "您所选择的游戏不存在"); } } else { $result = array('return' => 0, 'comment' => "您所选择的游戏-平台不存在"); } } else { $result = array('return' => 0, 'comment' => "您所选择的服务器配置不完整"); } } else { $result = array('return' => 0, 'comment' => "您所选择的服务器不存在"); } } else { $result = array('return' => 2, 'comment' => "用户不存在"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 2, 'comment' => "请输入接收方用户账号"); } } else { $result = array('return' => 0, 'comment' => "请输入服务器"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } } else { $result = array('return' => 0, 'comment' => "您的IP不在可允许的列表之内"); } echo json_encode($result); }
public function checkIpAction() { $type = trim($this->request->type); //LocalIP 或者 WebIP $ip = Base_Common::ip2long($this->request->ip); $MachineId = $this->request->MachineId ? abs($this->request->MachineId) : 0; if (!empty($ip)) { if ($MachineId) { //有MachineId 表示是修改页面的 $array = array($type => $ip); $checkIPList = $this->oMachine->getByParam($array, "MachineId," . $type); if (count($checkIPList) == 0 || count($checkIPList) == 1 && $checkIPList[0]["MachineId"] == $MachineId) { echo "yes"; } else { echo "no"; } } else { $return = $this->oMachine->getRowByKey($type, $ip); if ($return) { echo "no"; } else { echo "yes"; } } } }
public function getPayDetailCount($StartTime, $EndTime, $UserId, $oWherePartnerPermission, $PassageId) { //查询列 $select_fields = array('OrderCount' => 'count(*)'); //分类统计列 //初始化查询条件 $whereStartTime = $StartTime ? " PayTime >= " . strtotime($StartTime) . " " : ""; $whereEndTime = $EndTime ? " PayTime <= " . strtotime($EndTime) . " " : ""; $whereUser = $UserId ? " AcceptUserId = " . $UserId . " " : ""; $wherePassage = $PassageId ? " PassageId = " . $PassageId . " " : ""; $whereCondition = array($whereUser, $whereStartTime, $whereEndTime, $oWherePartnerPermission, $wherePassage); //生成查询列 $fields = Base_common::getSqlFields($select_fields); //生成条件列 $where = Base_common::getSqlWhere($whereCondition); if ($UserId) { $position = Base_Common::getUserDataPositionById($UserId); $table_to_process = Base_Widget::getDbTable($this->table_user) . "_" . $position['db_fix']; } else { $Date = date("Ym", strtotime($StartTime)); $table_to_process = Base_Widget::getDbTable($this->table_date) . "_" . $Date; } $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where; $PayCount = $this->db->getOne($sql, false); if ($PayCount) { return $PayCount; } else { return 0; } }
public function getQuestionDetail($QuestionId) { //获取问题的ID和父ID $QuestionInfo = $this->getComplain($QuestionId, 'id,author,time,qtype,view,status,description,resolve,photo,call_time,call_type,loginId,receive_time,comment,public,assess,sync,rtime'); //问题获取到 $CallTypeList = $this->config->CallTypeList; //格式化问题内容 if ($QuestionInfo['id']) { //解包压缩数组 $Comment = unserialize($QuestionInfo['comment']); //如果问题分类已经被转换 if ($Comment['convert']['to_id'] > 0) { $QuestionDetail = array('QuestionId' => $Comment['convert']['to_id'], 'QuestionType' => $Comment['convert']['to_type'], 'Transformed' => 1); } else { $QuestionDetail = array('QuestionId' => intval($QuestionInfo['id']), 'QuestionContent' => $QuestionInfo['description'], 'QuestionResolve' => $QuestionInfo['resolve'], 'AuthorName' => $QuestionInfo['author'], 'QuestionTime' => date("Y-m-d H:i:s", $QuestionInfo['time']), 'QuestionAttatch' => $QuestionInfo['photo'], 'Views' => $QuestionInfo['view'], 'QtypeId' => $QuestionInfo['qtype'], 'CallType' => $QuestionInfo['call_time'] > 0 ? $CallTypeList[$QuestionInfo['call_type']] : "", 'CallTime' => $QuestionInfo['call_time'] > 0 ? date("Y-m-d H:i:s", $QuestionInfo['call_time']) : 0, 'QuestionStauts' => $this->processStatus($QuestionInfo['status']), 'QuestionStatus' => $this->processStatus($QuestionInfo['status']), 'AcceptTime' => date("Y-m-d H:i:s", $QuestionInfo['receive_time']), 'Hidden' => $QuestionInfo['public'], 'AcceptOperatorName' => $QuestionInfo['loginId'], 'AssessStatus' => $QuestionInfo['assess'], "Sync" => $QuestionInfo['sync'], "RevokeTime" => date("Y-m-d H:i:s", $QuestionInfo['rtime'])); //获取回答内容 $AnswerInfo = $this->getAnswer($QuestionDetail['QuestionId']); //如果获取到回答 if ($AnswerInfo['id']) { $QuestionDetail['Answer'] = array('OperatorName' => $AnswerInfo['contact'], 'AnswerTime' => date("Y-m-d H:i:s", $AnswerInfo['time']), 'AnswerContent' => $AnswerInfo['content']); $QuestionDetail['AnswerLag'] = Base_Common::timeLagToText($QuestionInfo['time'], $AnswerInfo['time']); } } } else { return false; } return $QuestionDetail; }
?> </td> <td><?php echo sprintf('%3.4f', $area['currency_rate']); ?> </td> <td><a href="javascript:;" onclick="areaModify(<?php echo $area['AreaId']; ?> );">修改</a> |<a href="javascript:;" onclick="promptDelete('<?php echo $area['AreaId']; ?> ','<?php echo $area['name']; ?> ')">删除</a> </td> </tr> <?php } } ?> </table> </fieldset> </dl> <?php include Base_Common::tpl('contentFooter');
public function getNpcItemPurchaseDetailCount($StartTime, $EndTime, $UserId, $ServerId, $MoneyType, $oWherePartnerPermission, $ItemListText) { //查询列 $select_fields = array('PurchaseCount' => 'count(*)'); //初始化查询条件 $whereStartTime = $StartTime ? " NpcPurchaseTime >= '" . strtotime($StartTime) . "' " : ""; $whereEndTime = $EndTime ? " NpcPurchaseTime <= '" . strtotime($EndTime) . "' " : ""; $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : ""; $whereItemID = $ItemListText ? " ItemID in ( " . $ItemListText . " )" : ""; $whereUser = $UserId ? " UserId = " . $UserId . " " : ""; $whereMoney = $MoneyType ? " MoneyType = " . $MoneyType . " " : ""; $groups = Base_common::getGroupBy($group_fields); $whereCondition = array($whereStartTime, $whereEndTime, $whereUser, $whereMoney, $whereServer, $oWherePartnerPermission, $whereItemID); //生成查询列 $fields = Base_common::getSqlFields($select_fields); //生成条件列 $where = Base_common::getSqlWhere($whereCondition); if ($UserId) { $position = Base_Common::getUserDataPositionById($UserId); $table_to_process = Base_Widget::getDbTable($this->table_npc_item_purchase) . "_user_" . $position['db_fix']; } else { $Date = date("Ym", strtotime($StartTime)); $table_to_process = Base_Widget::getDbTable($this->table_npc_item_purchase) . "_" . $Date; } $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where; $PurchaseCount = $this->db->getOne($sql, false); if ($PurchaseCount) { return $PurchaseCount; } else { return 0; } }
public function InsertCharacterKickOff($KickOffArr) { $this->db->begin(); $position = Base_Common::getUserDataPositionById($KickOffArr['UserId']); $table_user = Base_Common::getUserTable($this->character_kick_off, $position); $user = $this->db->insert($table_user, $KickOffArr); $Date = date("Ym", $KickOffArr['KickOffTime']); $table_date = $this->CreateCharacterKickOffLog($Date); $oSocketType = @(include __APP_ROOT_DIR__ . "/etc/SocketType.php"); $oSocketQueue = new Config_SocketQueue(); $uType = 60221; $TypeInfo = $oSocketType[$uType]; if ($TypeInfo['Type']) { $DataArr = array('PackFormat' => $TypeInfo['PackFormat'], 'Length' => $TypeInfo['Length'], 'Length2' => 0, 'uType' => $uType, 'MsgLevel' => 0, 'Line' => 0, 'UserID' => $KickOffArr['UserId'], 'KickOffReason' => $KickOffArr['KickOffReason'], 'Serial' => $KickOffArr['KickOffId']); } $DataArr = array('ServerId' => $KickOffArr['ServerId'], 'uType' => $uType, 'UserId' => $DataArr['UserID'], 'MessegeContent' => serialize($DataArr), 'QueueTime' => time(), 'SendTime' => 0); $addQueue = $oSocketQueue->insert($DataArr); $log = $this->db->insert($table_date, $KickOffArr); if ($user && $log && $addQueue) { $this->db->commit(); return true; } else { $this->db->rollBack(); return false; } }
/** *生成订单 */ public function createOrderAction() { //基础元素,必须参与验证 $Order['PayUserId'] = abs(intval($this->request->PayUserId)); $Order['AcceptUserId'] = abs(intval($this->request->AcceptUserId)); $Order['OrderTime'] = abs(intval($this->request->OrderTime)); $Order['ServerId'] = abs(intval($this->request->ServerId)) ? abs(intval($this->request->ServerId)) : 101001001; $Order['PassageId'] = abs(intval($this->request->PassageId)) ? abs(intval($this->request->PassageId)) : 0; $Order['SubPassageId'] = $this->request->SubPassageId ? $this->request->SubPassageId : ""; $Order['Coin'] = abs(intval($this->request->Coin)) ? abs(intval($this->request->Coin)) : 0; $Order['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; $Order['OrderIP'] = $this->request->OrderIP ? $this->request->OrderIP : "127.0.0.1"; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; //print_R($Order); $sign_to_check = Base_common::check_sign($Order, $p_sign); //不参与验证的元素 $Order['OrderIP'] = Base_Common::ip2long($Order['OrderIP']); //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { if ($Order['ServerId']) { //验证用户名有效性 if ($Order['AcceptUserId']) { if ($Order['PassageId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($Order['OrderTime'] - time()) <= 600) { //查询用户 $AcceptUserInfo = $this->oUser->GetUserById($Order['AcceptUserId']); if ($AcceptUserInfo['UserId']) { //如果指定支付方 if ($Order['PayUserId']) { //查询用户 $PayUserInfo = $this->oUser->GetUserById($Order['PayUserId']); } //如果不指定支付方或者支付方确定存在 if ($PayUserInfo['UserId'] || $Order['PayUserId'] == 0) { //获取服务器信息 $ServerInfo = $this->oServer->getRow($Order['ServerId']); if ($ServerInfo['ServerId']) { if ($ServerInfo['AppId'] && $ServerInfo['PartnerId']) { $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']); //验证游戏-平台信息 $PartnerInfo = $this->oPartnerApp->getRow($bind); if ($PartnerInfo['AppId'] && $PartnerInfo['PartnerId']) { $AppInfo = $this->oApp->getRow($PartnerInfo['AppId']); if ($AppInfo['AppId']) { //获取支付方式信息 $PassageInfo = $this->oPassage->getRow($Order['PassageId']); if ($PassageInfo['passage_id']) { $Order['AppId'] = $ServerInfo['AppId']; $Order['PartnerId'] = $ServerInfo['PartnerId']; $Order['Amount'] = $PassageInfo['finance_rate'] * $Order['Coin']; $Order['Credit'] = $PassageInfo['finance_rate'] * $Order['Coin']; $Order['ExchangeRate'] = $AppInfo['exchange_rate']; $Order['AppCoin'] = $AppInfo['exchange_rate'] * $Order['Coin']; $Order['OrderStatus'] = 0; $Order['UserSourceId'] = $AcceptUserInfo['UserSourceId']; $Order['UserSourceDetail'] = $AcceptUserInfo['UserSourceDetail']; $Order['UserSourceProjectId'] = $AcceptUserInfo['UserSourceProjectId']; $Order['UserSourceActionId'] = $AcceptUserInfo['UserSourceActionId']; $Order['UserRegTime'] = $AcceptUserInfo['UserRegTime']; unset($Order['ReturnType']); $createOrder = $this->oOrder->createOrder($Order); if (intval($createOrder)) { $result = array('return' => 1, 'OrderId' => $createOrder, 'comment' => "下单成功"); } else { $result = array('return' => 2, 'comment' => "下单失败"); } } else { $result = array('return' => 0, 'comment' => "您所选择的支付方式不存在"); } } else { $result = array('return' => 0, 'comment' => "您所选择的游戏不存在"); } } else { $result = array('return' => 0, 'comment' => "您所选择的游戏-平台不存在"); } } else { $result = array('return' => 0, 'comment' => "您所选择的服务器配置不完整"); } } else { $result = array('return' => 0, 'comment' => "您所选择的服务器不存在"); } } else { $result = array('return' => 0, 'comment' => "支付方用户不存在"); } } else { $result = array('return' => 2, 'comment' => "接收方用户不存在"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "请选择支付方式"); } } else { $result = array('return' => 2, 'comment' => "请输入接收方用户ID"); } } else { $result = array('return' => 0, 'comment' => "请输入服务器"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } $Order['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($Order['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['LoginId'] . "|" . $result['adult']; } echo $r; } }
$this->manager->name(); ?> </h4> </li> <li> <!--span class="act act-success">10</span--> <h5><a href="javascript:;" onclick="repwd('<?php $this->manager->id(); ?> ');" title="修改密码">修改密码</a></h5> </li> <li> <!--span class="act act-danger">85</span--> <h5><button class="btn btn-info" onclick="location.href='<?php $this->manager->logoutUrl(); ?> '">安全退出</button></h5> </li> </ul> </div> <div id="side_accordion" class="accordion"> <div class="push"></div> </div> </div> </div> </div> </div> </div> <?php include Base_Common::tpl('footer');
public function createPayAction() { //基础元素,必须参与验证 $Pay['OrderId'] = $this->request->OrderId; $Pay['PassageId'] = abs(intval($this->request->PassageId)); $Pay['SubPassageId'] = $this->request->SubPassageId ? $this->request->SubPassageId : ""; $Pay['PayTime'] = abs(intval($this->request->PayTime)) ? abs(intval($this->request->PayTime)) : time(); $Pay['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; $Pay['PayIP'] = $this->request->PayIP ? $this->request->PayIP : "127.0.0.1"; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Pay, $p_sign); //不参与验证的元素 $Pay['PayIP'] = Base_Common::ip2long($Pay['PayIP']); //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //检查订单号 if ($Pay['OrderId']) { if (abs($Pay['PayTime'] - time()) <= 600) { //查询订单 $OrderInfo = $this->oOrder->getRow($Pay['OrderId']); //如果订单未作废 if ($OrderInfo['OrderId']) { if ($OrderInfo['OrderStatus'] == 0) { //如果指定支付方 if ($OrderInfo['PayUserId']) { //查询用户 $PayUserInfo = $this->oUser->GetUserById($OrderInfo['PayUserId']); } //如果不指定支付方或者支付方确定存在 if ($PayUserInfo['UserId'] || $Order['PayUserId'] == 0) { //检查收款方用户 $AcceptUserInfo = $this->oUser->GetUserById($OrderInfo['AcceptUserId']); if ($AcceptUserInfo['UserId']) { if ($Pay['PassageId'] != $OrderInfo['PassageId']) { $PassageInfo = $this->oPassage->getRow($Pay['PassageId']); } else { $PassageInfo = $this->oPassage->getRow($OrderInfo['PassageId']); } //获取支付方式信息 if ($PassageInfo['passage_id']) { //检查服务器配置 $ServerInfo = $this->oServer->getRow($OrderInfo['ServerId']); if ($ServerInfo['ServerId']) { if ($ServerInfo['PartnerId'] && $ServerInfo['AppId']) { $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']); //验证游戏-运营商信息 $PartnerAppInfo = $this->oPartnerApp->getRow($bind); if ($PartnerAppInfo['AppId'] && $PartnerAppInfo['PartnerId']) { //验证游戏信息 $AppInfo = $this->oApp->getRow($ServerInfo['AppId']); if ($AppInfo['AppId']) { //检测运营商信息 $PartnerInfo = $this->oPartner->getRow($ServerInfo['PartnerId']); if ($PartnerInfo['PartnerId']) { //如果关联支付订单存在 if ($OrderInfo['PayId']) { $result = array('return' => 0, 'comment' => "该订单已经支付完毕"); } else { $OrderUpdateArr = array('PayIp' => $Pay['PayIP'], 'PassageId' => $Pay['PassageId'], 'PayTime' => $Pay['PayTime']); $OrderUpdate = $this->oOrder->updateOrder($Pay['OrderId'], $OrderInfo['AcceptUserId'], $OrderUpdateArr); $PassageClassName = "Lm_Pay_Passage_" . $PassageInfo['passage']; $oPayPassage = new $PassageClassName(); $PayUrl = $oPayPassage->createPay($AppInfo, $PartnerInfo, $ServerInfo, $PassageInfo, $OrderInfo, $Pay); $result = array('return' => 1, 'PayUrl' => $PayUrl, 'StageUrl' => $PassageInfo['StageUrl'], 'comment' => "该订单可以继续支付"); } } else { $result = array('return' => 0, 'comment' => "所选择的游戏不存在"); } } else { $result = array('return' => 0, 'comment' => "所选择的游戏不存在"); } } else { $result = array('return' => 0, 'comment' => "所选择的游戏-运营商不存在"); } } else { $result = array('return' => 0, 'comment' => "所选择的服务器配置不完整"); } } else { $result = array('return' => 0, 'comment' => "所选择的服务器不存在"); } } else { $result = array('return' => 0, 'comment' => "支付方式不存在"); } } else { $result = array('return' => 0, 'comment' => "收款方用户不存在"); } } else { $result = array('return' => 0, 'comment' => "支付方用户不存在"); } } else { if ($OrderInfo['OrderStatus'] == -1) { $result = array('return' => 0, 'comment' => "该订单已经作废"); } elseif ($OrderInfo['OrderStatus'] > 1) { $result = array('return' => 0, 'comment' => "该订单已经支付完毕"); } } } else { $result = array('return' => 0, 'comment' => "该订单不存在"); } } else { $result = array('return' => 0, 'comment' => "时间错误"); } } else { $result = array('return' => 0, 'comment' => "请输入订单号"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } $Pay['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($Pay['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['LoginId'] . "|" . $result['adult']; } } }