Пример #1
0
 /**
  *获取PVE塔副本记录汇总
  */
 public function getPveTowerSummaryAction()
 {
     //基础元素,必须参与验证
     $User['UserId'] = abs(intval($this->request->UserId));
     $User['ServerId'] = $this->request->ServerId;
     $User['HeroId'] = intval($this->request->HeroId) ? intval($this->request->HeroId) : -1;
     $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']) {
                     //判断用户所选服务器大区是否存在
                     $ServerInfo = $this->oServer->getRow($User['ServerId']);
                     if ($ServerInfo['ServerId']) {
                         $oTask = new Lm_Task();
                         $FirstKillSummary = $oTask->getPveTowerFirstKill(0, 0, $UserInfo['UserId'], $User['SlkId'], $User['HeroId'], $User['ServerId'], 0, 0, ($User['Page'] - 1) * $User['PageSize'], $User['PageSize']);
                         $FastestKillSummary = $oTask->getPveTowerFastestKill(0, 0, $UserInfo['UserId'], $User['SlkId'], $User['HeroId'], $User['ServerId'], 0, 0, ($User['Page'] - 1) * $User['PageSize'], $User['PageSize']);
                         $TotalKillSummary = $oTask->getPveTowerTotalKill(0, 0, $UserInfo['UserId'], $User['SlkId'], $User['HeroId'], $User['ServerId'], 0, 0, ($User['Page'] - 1) * $User['PageSize'], $User['PageSize']);
                         $result = array('return' => 1, 'FirstKillSummary' => $FirstKillSummary, 'FastestKillSummary' => $FastestKillSummary, 'TotalKillSummary' => $TotalKillSummary);
                     } 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");
     }
     if ($User['ReturnType'] == 1) {
         echo json_encode($result);
     }
 }