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 commonQuestionAction() { //基础元素,必须参与验证 $Common['Time'] = abs(intval($this->request->Time)); $Common['Count'] = abs(intval($this->request->Count)); //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = '5173'; $sign_to_check = base_common::check_sign($Common, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Common['Time'] - time()) <= 600) { //查询当前正在生效的公告列表 $oMenCache = new Base_Cache_Memcache("Complaint"); $M = $oMenCache->get('CurrentBoradCast_' . $Common['Count']); if ($M) { $CommonQustionList = json_decode($M, true); } else { $CommonQustionList = $this->oBroadCast->getCurrentCommonQustion($Common, "url as Url,title as Content"); $oMenCache->set('CurrentBoradCast_' . $Common['Count'], json_encode($CommonQustionList), 3600); } $result = array('return' => 1, 'CommonQustionList' => $CommonQustionList); } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } echo json_encode($result); }
/** *问题浏览量更新 */ 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 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); } }
/** *获取当前正在生效的公告列表 */ public function quicklinkAction() { //基础元素,必须参与验证 $QuickLink['Time'] = abs(intval($this->request->Time)); $QuickLink['LinkType'] = trim($this->request->LinkType); //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = '5173'; $sign_to_check = base_common::check_sign($QuickLink, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($QuickLink['Time'] - time()) <= 600) { //查询当前正在生效的公告列表 $oMenCache = new Base_Cache_Memcache("Complaint"); $M = $oMenCache->get('QuickLink_' . $QuickLink['LinkType']); if ($M) { $ParentQuickLink = json_decode($M, true); } else { $ParentQuickLink = $this->oQuickLink->getQuickLinkByType($QuickLink['LinkType'], "LinkName,LinkUrl,LinkIcon,Id"); if ($ParentQuickLink['Id']) { $ParentQuickLink['QuickLinkList'] = $this->oQuickLink->getQuickLinkByParent($ParentQuickLink['Id'], "LinkName,LinkUrl,LinkIcon,Id"); $oMenCache->set('QuickLink_' . $QuickLink['LinkType'], json_encode($ParentQuickLink), 3600); } else { $result = array('return' => 0, 'comment' => "无此分类"); } } $result = array('return' => 1, 'QuickLinkList' => $ParentQuickLink); //echo "<pre>"; //print_R($ParentQuickLink); } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } echo json_encode($result); }
public function sendUserResetPasswordMail($UserId, $UserMail) { $this->db->begin(); $UserInfo = $this->GetUserById($UserId); $AsignResetTime = time(); $ResetPasswordLog = array('UserId' => $UserId, 'PartnerId' => $UserInfo['PartnerId'], 'AsignResetTime' => $AsignResetTime, 'ResetStatus' => 0, 'ResetType' => 1); $ResetLog = $this->createResetPassword($ResetPasswordLog); if ($ResetLog) { $User = array('UserId' => $UserId, 'PartnerId' => $UserInfo['PartnerId'], 'EndTime' => $AsignResetTime + 86400, 'UserMail' => $UserMail, 'ResetId' => $ResetLog); $User['sign'] = base_common::check_sign($User, "resetpassword"); $ResetUrl = $this->config->passporturl . Base_Common::getUrl('', '', '', $User) . "&c=forgot_password&m=reset_by_email"; $UrlList = array('ResetUrl' => array('href' => $ResetUrl, 'txt' => $ResetUrl)); $MailContent = array('UserMail' => $UserMail, 'UserName' => $UserInfo['UserName'], 'UrlList' => $UrlList, 'title' => "用户密码找回"); $MailType = "ResetPassWord"; $oMail = new Lm_Mail(); $mail = $oMail->createMail($MailType, $UserId, $MailContent); if ($mail) { $this->db->commit(); return $ResetLog; } else { $this->db->rollBack(); return false; } } else { $this->db->rollBack(); return false; } }
public function RevokeQuestion($Question, $Update = 1) { //获取问题内容 $QuestionInfo = $this->GetComplain($Question['QuestionId'], "id,description,status,sync,comment,author"); //如果获取到问题 if ($QuestionInfo['id']) { $oMenCache = new Base_Cache_Memcache("Complaint"); $Setting = $oMenCache->get('setting'); //如果投诉单已经同步到投诉 if ($QuestionInfo['sync'] == 1) { //如果问题状态未初始创建 或者 开关允许任何状态撤销 if ($QuestionInfo['status'] == 0 || $Setting['complainSwitch']) { //解包备注字段 $Comment = unserialize($QuestionInfo['comment']); //备注内容加入撤销信息 $time = time(); $Comment['revoke'] = array('rtime' => $time, 'revokeReason' => $Question['RevokeReason'], 'ip' => $Question['IP']); //更新投诉记录的状态 $UpdateArr = array('status' => 2, 'rtime' => $time, 'comment' => serialize($Comment)); //如果需要更新 if ($Update) { $updateComplain = $this->updateComplain($QuestionInfo['id'], $UpdateArr); } else { $updateComplain = 1; } //如果更新成功 if ($updateComplain) { //从搜索引擎删除数据 base_common::delete_search('c_' . $QuestionInfo['id']); //推送信息到投诉 $CommonConfig = (require dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/CommonConfig/commonConfig.php"); $data = "scid=" . $QuestionInfo['id'] . "&uid=" . urlencode($QuestionInfo['author']) . "&ip=" . $Question['IP'] . "&revokeTime=" . $time . "&revokeReason=" . urlencode($Question['RevokeReason']) . "&sign=" . $CommonConfig['COMPLAIN_SIGN']; $Revoke = base_common::do_post($this->config->ComplainRevokeUrl, $data); $RevokeArr = json_decode($Revoke, true); //如果推送到投诉失败 if ($RevokeArr['return'] != 1) { //记入重试队列 $RevokeQueue = array('scid' => $QuestionInfo['id'], 'uid' => $Question['UserName'], 'ip' => $Question['IP'], 'revokeTime' => $time, 'revokeReason' => $Question['RevokeReason']); $this->addRevokeQueue($RevokeQueue); } return true; } else { return false; } } else { return false; } } else { return false; } } else { return false; } }
public function rebuildSearchAction() { set_time_limit(0); $StartDate = $this->request->StartDate; $EndDate = $this->request->EndDate; $History = intval($this->request->History); $QuestionTypeArr = array('ask', 'suggest'); foreach ($QuestionTypeArr as $Key => $QuestionType) { $count = 1; $page = 1; $pagesize = 1000; while ($count > 0) { $ConditionList = array('QuestionType' => $QuestionType, 'History' => $History, 'StartDate' => $StartDate, 'EndDate' => $EndDate, 'Page' => $page, 'PageSize' => $pagesize, 'Parent' => 0, 'Revocation' => 0, 'hidden' => 1, 'Accepted' => -1, 'Help' => -1); $fields = "id,description,time,atime"; $SearchData = $this->oQuestion->getQuestionList($ConditionList, $fields, "desc"); $page++; $count = count($SearchData['QuestionList']); if ($count > 0) { foreach ($SearchData['QuestionList'] as $key => $data) { $data['title'] = $data['description']; $data['tag'] = json_encode(array(), true); $data['question_type'] = 'question'; $set_serach = base_common::set_search($data); $log = $QuestionType . ": Id:" . $data['id'] . "-" . $set_serach->getHttpStatus() . "\r\n"; $fileName = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/file/searchLog.txt"; file_put_contents($fileName, $log, FILE_APPEND); echo $log; } } echo $count . "\n"; sleep(1); } } $count = 1; $page = 1; $pagesize = 1000; while ($count > 0) { $ConditionList = array('StartDate' => $StartDate, 'EndDate' => $EndDate, 'Page' => $page, 'PageSize' => $pagesize, 'Public' => 0); $fields = "id,description,time,atime,status"; $SearchData = $this->oComplain->getComplainList($ConditionList, $fields); $page++; $count = count($SearchData['QuestionList']); echo $count . "-" . $SearchData['QuestionNum'] . "\n"; if ($count > 0) { foreach ($SearchData['QuestionList'] as $key => $data) { $data['title'] = $data['escription']; $data['tag'] = json_encode(array(), true); $data['id'] = "c_" . $data['id']; $data['question_type'] = 'complain'; $data['atime'] = $data['status'] == 2 ? -1 : $data['atime']; unset($data['status']); $set_serach = base_common::set_search($data); $log = "complain: Id:" . $data['id'] . "-" . $set_serach->getHttpStatus() . "\r\n"; $fileName = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/file/searchLog.txt"; file_put_contents($fileName, $log, FILE_APPEND); echo $log; } } sleep(1); } }
/** *用户ID方式参与抽奖 */ public function getLotoInfoAction() { //基础元素,必须参与验证 $User['Time'] = abs(intval($this->request->Time)); $User['LotoId'] = abs(intval($this->request->LotoId)); $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'loto'; $sign_to_check = base_common::check_sign($User, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { if ($User['LotoId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($User['Time'] - time()) <= 600) { $LotoInfo = $this->oLoto->getRow($User['LotoId']); if ($LotoInfo['LotoId']) { $PrizeList = $this->oPrize->getAll($LotoInfo['LotoId']); $result = array('return' => 1, 'PrizeList' => $PrizeList, 'LotoInfo' => $LotoInfo); } else { $result = array('return' => 2, 'comment' => "无此抽奖批次"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 2, 'comment' => "请选择抽奖批次"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($User['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['LotoId'] . "|" . $result['adult']; } echo $r; } }
/** *用户ID方式登录 */ public function getLastLoginAction() { //基础元素,必须参与验证 $User['UserId'] = abs(intval($this->request->UserId)); $User['Time'] = abs(intval($this->request->Time)); $User['ServerId'] = $this->request->ServerId; $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = base_common::check_sign($User, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证用户名有效性 if ($User['UserId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($User['Time'] - time()) <= 600) { //查询用户 $LoginLog = $this->oLogin->getLoginDetail(0, 0, $User['UserId'], $User['ServerId'], 0, 1, 1); $result = array('return' => 1, 'LoginLog' => $LoginLog['LoginDetail']); } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 2, 'comment' => "请输入用户ID"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($User['ReturnType'] == 1) { echo json_encode($result); } }
public function UserLogin($User, $UserInfo) { $oUser = new Lm_User(); $AppList = @(include __APP_ROOT_DIR__ . "/etc/App.php"); $PartnerAppList = @(include __APP_ROOT_DIR__ . "/etc/PartnerApp.php"); $ServerList = @(include __APP_ROOT_DIR__ . "/etc/Server.php"); if ($UserInfo['UserId']) { if ($UserInfo['UserPassWord'] != "0") { if ($User['UserPassWord'] == $UserInfo['UserPassWord']) { unset($User['UserPassWord'], $User['ReturnType']); //判断用户所选服务器大区是否存在 $ServerInfo = $ServerList[$User['ServerId']]; if ($ServerInfo['ServerId']) { $Comment = json_decode($ServerInfo['Comment'], true); if (isset($Comment['IpListBlack'][$User['UserLoginIP']])) { $result = array('return' => 0, 'comment' => "您的IP已经被限制登录"); } else { //判断当前时间是否在开服之前 if (time() >= intval($ServerInfo['LoginStart']) || isset($Comment['IpListWhite'][$User['UserLoginIP']])) { //判断当前时间是否处于停机维护 if (time() > $ServerInfo['NextEnd'] && time() < $ServerInfo['NextStart'] && !isset($Comment['IpListWhite'][$User['UserLoginIP']])) { $result = array('return' => 0, 'comment' => "您所选的服务器处于停机维护中"); } else { //判断服务器信息附带的游戏-运营商信息是否合法 $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']); $PartnerInfo = $PartnerAppList[$ServerInfo['AppId']][$ServerInfo['PartnerId']]; if ($PartnerInfo['AppId'] && $PartnerInfo['PartnerId']) { $is_freeze = $oUser->getCharacterFreeze($UserInfo['UserId'], $ServerInfo['ServerId']); if (!$is_freeze['FreezeCount']) { $Active = 0; if ($PartnerInfo['IsActive'] == 1) { $UserActive = $oUser->getUserActive($UserInfo['UserId'], $ServerInfo['AppId'], $ServerInfo['PartnerId']); $Active = count($UserActive) ? 1 : 0; } else { $Active = 1; } //检查用户是否激活 if ($Active) { $AppInfo = $AppList[$ServerInfo['AppId']]; //检查游戏配置是否存在 if ($AppInfo['AppId']) { $Comment = json_decode($AppInfo['comment'], true); //检查是否由平台生成登陆ID if ($Comment['create_loginid']) { $FirstLogin = $this->getFirstLogin($UserInfo['UserId'], $ServerInfo['AppId'], $ServerInfo['PartnerId'], $ServerInfo['ServerId']); $User['AppId'] = $ServerInfo['AppId']; $User['PartnerId'] = $ServerInfo['PartnerId']; $User['UserSourceId'] = $UserInfo['UserSourceId']; $User['UserSourceDetail'] = $UserInfo['UserSourceDetail']; $User['UserSourceActionId'] = $UserInfo['UserSourceActionId']; $User['UserSourceProjectId'] = $UserInfo['UserSourceProjectId']; $User['UserRegTime'] = $UserInfo['UserRegTime']; $User['FirstLoginTime'] = $FirstLogin ? $FirstLogin : $User['LoginTime']; $AddLog = $this->InsertLoginLog($User, $UserInfo['UserName']); //获取用户生日信息 $UserBirthday = $oUser->GetUserCommunication($User['UserId'], "UserBirthDay"); //根据用户生日信息判断是否为成年(1成年,0未成年,2为空) $adult = base_common::checkAdult($UserBirthday['UserBirthDay']); //返回用户ID,不包含(23000) if ($AddLog) { $result = array('return' => 1, 'LoginId' => $AddLog, 'UserId' => $UserInfo['UserId'], 'adult' => $adult, 'comment' => "登录成功"); } else { $result = array('return' => 2, 'comment' => "登录失败"); } } else { $UserBirthday = $oUser->GetUserCommunication($User['UserId'], "UserBirthDay"); //根据用户生日信息判断是否为成年(1成年,0未成年,2为空) $adult = base_common::checkAdult($UserBirthday['UserBirthDay']); $result = array('return' => 1, 'LoginId' => 0, 'UserId' => $UserInfo['UserId'], 'adult' => $adult, 'comment' => "登录成功"); } } else { $result = array('return' => 2, 'comment' => "无此游戏"); } } else { $result = array('return' => 0, 'comment' => "您尚未激活"); } } else { $result = array('return' => 2, 'comment' => "账号处于" . $is_freeze['FreezeCount'] . "次封停中<br>" . date("Y-m-d H:i:s", $is_freeze['MaxTime']) . "前禁止登陆"); } } else { $result = array('return' => 2, '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' => "账号或密码错误"); } return $result; }
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 getVideoTypeListAction() { //基础元素,必须参与验证 $Video['Time'] = abs(intval($this->request->Time)); $Video['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = base_common::check_sign($Video, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Video['Time'] - time()) <= 600) { $oVideoType = new Config_Video_Type(); $VideoTypeList = $oVideoType->getAll(); $result = array('return' => 1, 'VideoTypeList' => $VideoTypeList); } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 2, 'comment' => "验证失败,请检查URL"); } echo json_encode($result); }
/** *设定用户角色为默认角色 */ public function setUserCharacterDefaultAction() { //基础元素,必须参与验证 $User['UserId'] = abs(intval($this->request->UserId)); $User['AppId'] = abs(intval($this->request->AppId)); $User['PartnerId'] = abs(intval($this->request->PartnerId)); $User['ServerId'] = $this->request->ServerId; $User['Time'] = abs(intval($this->request->Time)); $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = base_common::check_sign($User, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证用户名有效性 if ($User['UserId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($User['Time'] - time()) <= 600) { //查询用户 $UserInfo = $this->oUser->GetUserById($User['UserId']); if ($UserInfo['UserId']) { $CharacterList = $this->oCharacter->getUserCharacterList($User['UserId'], $User['AppId'], $User['PartnerId']); if (count($CharacterList) > 0) { if (isset($CharacterList[$User['ServerId']])) { foreach ($CharacterList as $Server => $CharacterInfo) { $Comment = json_decode($CharacterInfo['Comment'], true); if ($CharacterInfo['ServerId'] == $User['ServerId']) { $Comment['default'] = 1; } else { $Comment['default'] = 0; } $bind = array('Comment' => json_encode($Comment)); $update = $this->oCharacter->updateCharacterInfo($User['UserId'], $Server, $bind); } $result = array('return' => 1, 'comment' => "更新完毕"); } else { $result = array('return' => 0, 'comment' => "无此角色"); } } else { $result = array('return' => 0, 'comment' => "无角色"); } } else { $result = array('return' => 2, 'comment' => "无此用户"); } } else { $result = array('return' => 2, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "请选择用户"); } } else { $result = array('return' => 2, 'comment' => "验证失败,请检查URL"); } $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($User['ReturnType'] == 1) { echo json_encode($result); } }
/** *重建问题缓存 */ public function rebuildQuestionDetailAction() { //基础元素,必须参与验证 $Question['QuestionId'] = abs(intval($this->request->QuestionId)); $Question['QuestionType'] = urldecode(trim($this->request->QuestionType)); $Question['Time'] = abs(intval($this->request->Time)); $oMenCache = new Base_Cache_Memcache("Complaint"); //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = '5173'; $sign_to_check = base_common::check_sign($Question, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Question['Time'] - time()) <= 600) { //问题类型为咨询|建议 if ($Question['QuestionType'] == "question") { //获取封装完毕的问题详情 $QuestionDetail = $this->oQuestion->ProcessQuestionDetail($Question); } elseif ($Question['QuestionType'] == "complain") { //获取封装完毕的问题详情 $QuestionDetail = $this->oComplain->ProcessComplainDetail($Question); } if ($QuestionDetail['QuestionId']) { $oMenCache->set('QuestionDetail_' . $Question['QuestionType'] . "_" . $Question['QuestionId'], json_encode($QuestionDetail), 300); $result = array('return' => 1); } else { $result = array('return' => 0, 'comment' => "无此问题"); } } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } echo json_encode($result); }
public function ipListAction() { //检查当前页面权限 $sign = '?ctl=config/machine&ac=ip.list'; $this->manager->checkMenuPermission($sign, Widget_Manager::MENU_PURVIEW_SELECT); $CageList = $this->CageList; $DepotId = $this->request->DepotId; $export = $this->request->export ? intval($this->request->export) : 0; $page = $this->request->page ? intval($this->request->page) : 1; $pageSize = $export ? 0 : 20; $DepotList = $this->DepotList; $ServerList = $this->ServerList; $PartnerList = $this->PartnerList; $param = array(); if ($DepotId) { $param['DepotId'] = $DepotId; $CageIdList = Base_Common::getArrList($CageList[$DepotId]); } $MachineList = $this->oMachine->getIpList($CageIdList, ($page - 1) * $pageSize, $pageSize); $MachineArr = $MachineList['MachineDetail']; foreach ($MachineArr as $MachineId => &$MachineInfo) { $MachineInfo['PartnerName'] = $PartnerList[$ServerList[$MachineInfo['ServerId']]['PartnerId']]['name']; $MachineInfo['LocalIP'] = long2ip($MachineInfo['LocalIP']); $MachineInfo['WebIP'] = long2ip($MachineInfo['WebIP']); $MachineInfo['Purpose'] = $MachineInfo['Purpose']; } //翻页 $pageParam = $param + array("export" => 0); $page_url = Base_Common::getUrl('', 'config/machine', 'ip.list', $pageParam) . "&page=~page~"; $page_content = base_common::multi($MachineList['MachineCount'], $page_url, $page, $pagesize, 10, $maxpage = 100, $prevWord = '上一页', $nextWord = '下一页'); //表格导出 $execlParam = $param + array("export" => 1); $export_var = "<a href =" . Base_Common::getUrl('', 'config/machine', 'ip.list', $execlParam) . "><导出表格></a>"; if ($export == 1) { $oExcel = new Third_Excel(); $FileName = 'IP地址信息'; $oExcel->download($FileName)->addSheet('IP地址信息'); //标题栏 $title = array("序列号", "资产编号", "内网IP", "外网IP", "项目", "用途"); $oExcel->addRows(array($title)); foreach ($MachineArr as $MachineCode => $MachineInfot) { //生成单行数据 $t = array(); $t['MachineCode'] = $MachineInfot['MachineCode']; $t['EstateCode'] = $MachineInfot['EstateCode']; $t['LocalIP'] = $MachineInfot['LocalIP']; $t['WebIP'] = $MachineInfot['WebIP']; $t['PartnerName'] = $MachineInfot['PartnerName']; $t['Purpose'] = $MachineInfot['Purpose']; $oExcel->addRows(array($t)); unset($t); } $oExcel->closeSheet()->close(); } include $this->tpl('Config_Machine_ipList'); }
public function genPackCodeLogAction() { set_time_limit(0); $pagesize = 10; //检查当前页面权限 $sign = '?ctl=config/product/pack&ac=gen.pack.code.log'; $this->manager->checkMenuPermission($sign, Widget_Manager::MENU_PURVIEW_SELECT); //页面输入变量 $AppId = intval($this->request->AppId); $PartnerId = intval($this->request->PartnerId); $GenNum = intval($this->request->GenNum) ? intval($this->request->GenNum) : 100; $AreaId = $this->request->AreaId ? intval($this->request->AreaId) : 0; $app_type = $this->request->app_type ? intval($this->request->app_type) : 0; $partner_type = $this->request->partner_type ? intval($this->request->partner_type) : 0; $is_abroad = $this->request->is_abroad ? intval($this->request->is_abroad) : 0; $page = intval(max($this->request->page, 1)); //时间范围初始化 $StartDate = $this->request->StartDate ? $this->request->StartDate : date("Y-m-01", time()); $EndDate = $this->request->EndDate ? $this->request->EndDate : date("Y-m-d", time()); $ProductPackArr = $this->oProductPack->getAll($AppId); $ProductPackId = $this->request->ProductPackId ? intval($this->request->ProductPackId) : 0; //初始化图表配置 $Input = array('AppId' => $AppId, 'PartnerId' => $PartnerId, 'is_abroad' => $is_abroad, 'AreaId' => $AreaId, 'app_type' => $app_type, 'partner_type' => $partner_type, 'ProductPackId' => $ProductPackId, 'export' => 1); //初始化游戏列表 $permitted_app = $this->permitted_app; //初始化合作商列表 $permitted_partner = array(); //初始化服务器列表 $permitted_server = array(); $AreaList = $this->AreaList; //获取当前地区列表 $AreaList = $this->oArea->getAbroad($is_abroad, $AreaList); //生成允许的地区id数组 if ($app_type > 0) { //筛选是否平台产品 $permitted_app = $this->oApp->getApp($app_type, $permitted_app); } if ($AppId > 0) { //获取可查看的权限总表 $permitted_partner = $this->oPermission->getPartner($this->manager->data_groups, $AppId, 'PartnerId,name,AreaId'); //根据合作方式筛选 $permitted_partner = $this->oPartnerApp->getPermittedPartnerByPartnerType($partner_type, $permitted_partner); //根据所在地区筛选 $permitted_partner = $this->oPartnerApp->getPermittedPartnerByPartnerArea($AreaList, $permitted_partner); } //获取用于查询的权限sql语句 $oWherePartnerPermission = $this->oPermission->getWherePermittedPartner($this->manager->data_groups, $AppId, $PartnerId, $app_type, $partner_type, $AreaList, $AreaId, $is_abroad, ''); $GenLog = $this->oProductPack->getGenLog(0, 0, $ProductPackId, 0, $oWherePartnerPermission, ($page - 1) * $pagesize, $pagesize); $page_url = Base_Common::getUrl('', 'config/product/pack', 'gen.pack.code.log', $Input) . "&page=~page~"; $page_content = base_common::multi($GenLog['GenLogCount'], $page_url, $page, $pagesize, 10, $maxpage = 100, $prevWord = '上一页', $nextWord = '下一页'); if (count($GenLog['GenLog'])) { foreach ($GenLog['GenLog'] as $GenId => $GenInfo) { $GenLog['GenLog'][$GenId]['AppName'] = $permitted_app[$GenInfo['AppId']]['name']; if (!isset($PartnerInfo[$GenInfo['PartnerId']])) { $PartnerInfo[$GenInfo['PartnerId']] = $this->oPartner->getRow($GenInfo['PartnerId']); } if (!isset($ManagerInfo[$GenInfo['ManagerId']])) { $ManagerInfo[$GenInfo['ManagerId']] = $this->manager->getRow($GenInfo['ManagerId']); } $GenLog['GenLog'][$GenId]['PartnerName'] = $PartnerInfo[$GenInfo['PartnerId']]['name']; $GenLog['GenLog'][$GenId]['ManagerName'] = $ManagerInfo[$GenInfo['ManagerId']]['name']; if (!isset($ProductPackList[$GenInfo['ProductPackId']])) { $ProductPackList[$GenInfo['ProductPackId']] = $this->oProductPack->getRow($GenInfo['ProductPackId']); $Comment = json_decode($ProductPackList[$GenInfo['ProductPackId']]['Comment'], true); if (is_array($Comment)) { unset($ProductList); unset($TypeList); unset($ProductInfo); foreach ($Comment as $Type => $TypeInfo) { foreach ($TypeInfo as $ProductId => $Count) { if (!isset($ProductInfo[$Type][$AppId][$ProductId])) { if ($Type == "hero") { $ProductInfo[$Type][$AppId][$ProductId] = $this->oHero->getRow($ProductId, $AppId, '*'); } elseif ($Type == "skin") { $ProductInfo[$Type][$AppId][$ProductId] = $this->oSkin->getRow($ProductId, $AppId, '*'); } elseif ($Type == "product") { $ProductInfo[$Type][$AppId][$ProductId] = $this->oProduct->getRow($ProductId, $AppId, '*'); } elseif ($Type == "money") { $ProductInfo[$Type][$AppId][$ProductId] = $this->oMoney->getRow($ProductId, $AppId, '*'); } elseif ($Type == "appcoin") { $AppInfo = $this->oApp->getRow($AppId); $Comment = json_decode($AppInfo['comment'], true); $ProductInfo[$Type][$AppId][$ProductId]['name'] = $Comment['coin_name']; } } $ProductList[$Type]['detail'][$ProductId] = $ProductInfo[$Type][$AppId][$ProductId]['name'] . "*" . $Count . "个"; } $TypeList[$Type] = implode(",", $ProductList[$Type]['detail']); } $ProductPackArr[$AppId][$GenInfo['ProductPackId']]['ProductListText'] = implode(",", $TypeList); } else { $ProductPackArr[$AppId][$GenInfo['ProductPackId']]['ProductListText'] = "无道具"; } } $GenLog['GenLog'][$GenId]['PackName'] = $ProductPackList[$GenInfo['ProductPackId']]['name']; $GenLog['GenLog'][$GenId]['ProductListText'] = $ProductPackArr[$GenInfo['AppId']][$GenInfo['ProductPackId']]['ProductListText']; $GenLog['GenLog'][$GenId]['ExportUrl'] = "<a href =" . Base_Common::getUrl('', 'config/product/pack', 'download.pack.code', array('export' => 1, 'GenId' => $GenId)) . "><导出礼包码></a>"; } } $page_title = "礼包码生成记录"; $page_form_action = $sign; //调取模板 include $this->tpl('Config_Product_Pack_GenLog'); }
/** *获取调研的内容 */ public function answerResearchAction() { //基础元素,必须参与验证 $User['UserId'] = abs(intval($this->request->UserId)); $User['ResearchId'] = abs(intval($this->request->ResearchId)); $User['AnswerTime'] = abs(intval($this->request->AnswerTime)); $User['Answer'] = urldecode($this->request->Answer); $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $P_Sign = 'lm'; $sign_to_check = base_common::check_sign($User, $P_Sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { if ($User['Answer']) { //验证用户名有效性 if ($User['ResearchId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($User['AnswerTime'] - time()) <= 600) { //查询调研信息 $ResearchInfo = $this->oResearch->getRow($User['ResearchId']); if ($ResearchInfo['ResearchId']) { //查询用户 $UserInfo = $this->oUser->GetUserById($User['UserId']); if ($UserInfo['UserId']) { $Answer = json_decode($User['Answer'], true); $QuestionInfo = $this->oQuestion->getAll($User['ResearchId']); if (isset($Answer)) { foreach ($Answer[$User['ResearchId']] as $QuestionId => $AnswerList) { if (isset($QuestionInfo[$QuestionId])) { $AnswerArr = array('UserId' => $User['UserId'], 'QuestionId' => $QuestionId, 'AnswerTime' => $User['AnswerTime'], 'Answer' => implode('|', $AnswerList)); $log = $this->oQuestion->InsertAnswerLog($AnswerArr, $User['ResearchId']); } } } } else { $result = array('return' => 2, 'comment' => "无此用户"); } } else { $result = array('return' => 2, '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"); } $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($User['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['LotoId'] . "|" . $result['adult']; } echo $r; } }
/** *密保问题答案 */ public function authUserSecurityAnswerAction() { //基础元素,必须参与验证 $User['UserId'] = abs(intval($this->request->UserId)); $User['QuestionId'] = $this->request->QuestionId; $User['Answer'] = urldecode($this->request->Answer); $User['Time'] = abs(intval($this->request->Time)); $User['PartnerId'] = abs(intval($this->request->PartnerId)) ? abs(intval($this->request->PartnerId)) : 1; $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = base_common::check_sign($User, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证用户名有效性 if ($User['UserId']) { //验证时间戳,时差超过600秒即认为非法 if (abs($User['Time'] - time()) <= 600) { if ($User['Answer']) { if ($User['QuestionId']) { //获取用户信息 $UserInfo = $this->oUser->GetUserById($User['UserId']); if ($UserInfo['UserId']) { if ($UserInfo['PartnerId'] == $User['PartnerId']) { $PartnerInfo = $this->oPartner->getRow($UserInfo['PartnerId']); if ($PartnerInfo['PartnerId']) { if ($UserInfo['PartnerId'] == $User['PartnerId']) { $QuestionInfo = $this->oSecurityAnswer->getRow($User['QuestionId']); if ($QuestionInfo['QuestionId']) { //检查用户是否已经输入密保问题 $UserAnswer = $this->oUser->getUserQuestionAnswer($User['UserId'], $User['QuestionId']); $Answer = $UserAnswer['Answer']; if (md5($Answer) == $User['Answer']) { $result = array('return' => 1, '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 { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "请输入用户ID"); } } else { $result = array('return' => 2, 'comment' => "验证失败,请检查URL"); } $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; if ($User['ReturnType'] == 1) { echo json_encode($result); } else { $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']); if ($result['return'] == 1) { $r = $r . "|" . $result['UserId']; } echo $r; } }
/** *根据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 questionDetailAction() { //基础元素,必须参与验证 $List['QuestionId'] = abs(intval($this->request->QuestionId)); $List['QuestionType'] = urldecode(trim($this->request->QuestionType)); $List['UserName'] = urldecode(trim($this->request->UserName)); $List['QuickAsk'] = urldecode(trim($this->request->QuickAsk)); $List['Time'] = abs(intval($this->request->Time)); $oMenCache = new Base_Cache_Memcache("Complaint"); $Setting = $oMenCache->get('setting'); //URL验证码 $sign = $this->request->sign; //私钥,以后要移开到数据库存储 $p_sign = '5173'; $sign_to_check = base_common::check_sign($List, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($List['Time'] - time()) <= 600) { //问题类型为咨询|建议 if ($List['QuestionType'] == "question") { //获取缓存 $M = $oMenCache->get('QuestionDetail_' . $List['QuestionType'] . "_" . $List['QuestionId']); if ($M) { $QuestionDetail = json_decode($M, true); //如果缓存内的数据不正确 if (!$QuestionDetail['QuestionId']) { //获取封装完毕的问题详情 $QuestionDetail = $this->oQuestion->ProcessQuestionDetail($List); } } else { //获取封装完毕的问题详情 $QuestionDetail = $this->oQuestion->ProcessQuestionDetail($List); } if ($QuestionDetail['QuestionId']) { //写入缓存 $oMenCache->set('QuestionDetail_' . $List['QuestionType'] . "_" . $List['QuestionId'], json_encode($QuestionDetail), 300); //如果已经被转换分类 if ($QuestionDetail['Transformed'] == 1) { //获取转换后的分类信息 $CategoryInfo = $this->oCategory->getCategoryByQuestionType($QuestionDetail['QuestionType']); //提示跳转 $result = array('return' => 2, 'action' => $this->oQuestion->getQuestionLink($QuestionDetail['QuestionId'], $QuestionDetail['QuestionType']), 'comment' => "此问题已经被转换为" . $CategoryInfo['name']); } else { //cookie验证 $CookieAuthor = $this->oUser->authorUserByCookie($List['QuickAsk'], 'zx,jy', $QuestionDetail['QuestionId']); //用户名验证 $UserAuthor = $this->oUser->authorUserByName($List['UserName'], $QuestionDetail['AuthorName']); //用户名验证不通过 并且 COOKIE验证不通过 if (!$UserAuthor) { if (!$CookieAuthor) { $QuestionDetail['AuthorName'] = Base_Common::cutstr($QuestionDetail['AuthorName'], 2, '**'); } } //如果问题不是隐私状态 if ($QuestionDetail['Hidden'] == 1) { //登陆用户 并且 账号不一致 if (!$UserAuthor) { //不显示附件信息 $QuestionDetail['QuestionAttatch'] = ""; //如果浏览器记录中无该问题提问记录 if (!$CookieAuthor) { //取消追问资格 $QuestionDetail['SubQuestion'] = 0; //取消评价资格 $QuestionDetail['Assess'] = 0; //不显示评价 unset($QuestionDetail['AssessStatus']); } } $result = array('return' => 1, 'QuestionDetail' => $QuestionDetail); //缓存中清除新处理的问题标记 if ($CookieAuthor || $UserAuthor) { //缓存中清除新处理的问题标记 $oMenCache->remove('fw' . $List['QuestionId']); } } else { //登陆用户 并且 账号不一致 if (!$UserAuthor) { //不显示附件信息 $QuestionDetail['QuestionAttatch'] = ""; //如果浏览器记录中无该问题提问记录 if (!$CookieAuthor) { //取消追问资格 $QuestionDetail['SubQuestion'] = 0; //取消评价资格 $QuestionDetail['Assess'] = 0; //不显示评价 unset($QuestionDetail['AssessStatus']); } } $result = array('return' => 1, 'QuestionDetail' => $QuestionDetail); //如果cookie验证通过 或者 用户验证通过 if ($CookieAuthor || $UserAuthor) { //缓存中清除新处理的问题标记 $oMenCache->remove('fw' . $List['QuestionId']); } else { $result = array('return' => 2, 'action' => 'login', 'comment' => "此问题的状态为:用户自己可见,请登录"); } } } } else { $result = array('return' => 0, 'comment' => "无此问题"); } } elseif ($List['QuestionType'] == "complain") { //获取缓存 $M = $oMenCache->get('QuestionDetail_' . $List['QuestionType'] . "_" . $List['QuestionId']); if ($M) { $QuestionDetail = json_decode($M, true); //如果缓存内的数据不正确 if (!$QuestionDetail['QuestionId']) { //获取封装完毕的问题详情 $QuestionDetail = $this->oComplain->ProcessComplainDetail($List); } } else { //获取封装完毕的问题详情 $QuestionDetail = $this->oComplain->ProcessComplainDetail($List); } if ($QuestionDetail['QuestionId']) { //写入缓存 $oMenCache->set('QuestionDetail_' . $List['QuestionType'] . "_" . $List['QuestionId'], json_encode($QuestionDetail), 300); //如果已经被转换分类 if ($QuestionDetail['Transformed'] == 1) { //如果问题被转换为咨询/建议 if (in_array($QuestionDetail['QuestionType'], array('ask', 'suggest'))) { //获取转换后的分类信息 $CategoryInfo = $this->oCategory->getCategoryByQuestionType($QuestionDetail['QuestionType']); $result = array('return' => 2, 'action' => $this->oQuestion->getQuestionLink($QuestionDetail['QuestionId'], "question"), 'comment' => "此问题已经被转换为" . $CategoryInfo['name']); } else { $result = array('return' => 0, 'comment' => "无此问题"); } } else { //cookie验证 $CookieAuthor = $this->oUser->authorUserByCookie($List['QuickAsk'], 'ts', $QuestionDetail['QuestionId']); //用户名验证 $UserAuthor = $this->oUser->authorUserByName($List['UserName'], $QuestionDetail['AuthorName']); //如果问题被设置为隐藏 if ($QuestionDetail['Hidden'] == 1) { $result = array('return' => 0, 'private' => 1, 'comment' => "此问题的状态为:隐藏"); } else { //用户名验证不通过 并且 COOKIE验证不通过 if (!$UserAuthor) { if (!$CookieAuthor) { $QuestionDetail['AuthorName'] = Base_Common::cutstr($QuestionDetail['AuthorName'], 2, '**'); } } //如果问题被设置为公开 或 cookie验证通过 或 用户名验证通过 if ($QuestionDetail['Hidden'] == 0 || $CookieAuthor || $UserAuthor) { //登陆用户 并且 账号不一致 并且 浏览器记录中无该问题提问记录 if (!$UserAuthor && !$CookieAuthor) { //取消撤销资格 $QuestionDetail['Revoke'] = 0; //不显示附件信息 $QuestionDetail['QuestionAttatch'] = ""; //不显示评价 unset($QuestionDetail['AssessStatus']); } $result = array('return' => 1, 'QuestionDetail' => $QuestionDetail); //缓存中清除新处理的问题标记 $oMenCache->remove('ts' . $List['QuestionId']); } else { $result = array('return' => 2, 'action' => 'login', '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"); } echo json_encode($result); }