/** *问题浏览量更新 */ 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 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 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 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 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; } }
/** *用户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; } }
/** *根据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 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; } }
/** *设定用户角色为默认角色 */ 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); } }
/** *用户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 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 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); }