コード例 #1
0
ファイル: InstmapController.php プロジェクト: eappl/prototype
 public function getInstmapAction()
 {
     $AppId = intval($this->request->AppId);
     $Instmap = new Config_Instmap();
     $InstmapList = $Instmap->getAll(empty($AppId) ? 0 : $AppId);
     echo "<option value=0>全部</option>";
     if (count($InstmapList)) {
         foreach ($InstmapList[$AppId] as $key => $val) {
             echo "<option value='{$val['InstMapId']}'>{$val['name']}</option>";
         }
     }
 }
コード例 #2
0
 /**
  *获取PVP场次详情表
  */
 public function getPvpDetailAction()
 {
     //基础元素,必须参与验证
     $User['ServerId'] = $this->request->ServerId;
     $User['EctypeId'] = abs(intval($this->request->EctypeId));
     $User['PvpEnterTime'] = abs(intval($this->request->PvpEnterTime));
     $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['EctypeId']) {
             //验证时间戳,时差超过600秒即认为非法
             if (abs($User['Time'] - time()) <= 600) {
                 if ($User['PvpEnterTime']) {
                     //判断用户所选服务器大区是否存在
                     $ServerInfo = $this->oServer->getRow($User['ServerId']);
                     if ($ServerInfo['ServerId']) {
                         $oTask = new Lm_Task();
                         $StartTime = date("Y-m-d H:i:s", $User['PvpEnterTime']);
                         $EndTime = date("Y-m-d H:i:s", $User['PvpEnterTime']);
                         $PvpDetailList = $oTask->getPvpDetail($StartTime, $EndTime, 0, 0, -1, $User['ServerId'], $User['EctypeId'], 0, 0, 100);
                         if (count($PvpDetailList['PvpDetail']) > 0) {
                             $oProduct = new Config_Product_Product();
                             $oHeroData = new Config_Hero();
                             $oInstmap = new Config_Instmap();
                             $HeroArr = $oHeroData->getAll($ServerInfo['AppId']);
                             $ItemArr = $oProduct->getAll($ServerInfo['AppId'], 0);
                             $InstMapArr = $oInstmap->getAll($ServerInfo['AppId']);
                             foreach ($PvpDetailList['PvpDetail'] as $key => $value) {
                                 if (!isset($ServerInfo[$value['ServerId']])) {
                                     $ServerInfo[$value['ServerId']] = $this->oServer->getRow($value['ServerId']);
                                 }
                                 $EquipList = json_decode($value['EquipList'], true);
                                 foreach ($EquipList as $equip_key => $ItemId) {
                                     $EquipNameList[$equip_key] = $ItemArr[$ServerInfo['AppId']][$ItemId]['name'];
                                 }
                                 $PvpDetailList['PvpDetail'][$key]['Comment'] = json_decode($value['Comment'], true);
                                 $PvpDetailList['PvpDetail'][$key]['EquipList'] = $EquipList;
                                 $PvpDetailList['PvpDetail'][$key]['EquipNameList'] = $EquipNameList;
                                 $PvpDetailList['PvpDetail'][$key]['ServerName'] = $ServerInfo[$value['ServerId']]['name'];
                                 $PvpDetailList['PvpDetail'][$key]['HeroName'] = $HeroArr[$value['AppId']][$value['HeroId']]['name'];
                                 $PvpDetailList['PvpDetail'][$key]['PvpName'] = $InstMapArr[$value['AppId']][$value['SlkId']]['name'];
                                 $CharacterList = $this->oCharacter->getUserCharacterList($value['UserId'], $value['AppId'], $value['PartnerId'], $value['ServerId']);
                                 $PvpDetailList['PvpDetail'][$key]['CharacterName'] = $CharacterList['0']['CharacterName'];
                             }
                             $PvpTotalInfo = $oTask->getPvpTotalLog($User['PvpEnterTime'], $User['EctypeId']);
                             $result = array('return' => 1, 'PvpDetailList' => $PvpDetailList, 'PvpTotalInfo' => $PvpTotalInfo);
                         } else {
                             $result = array('return' => 0, 'comment' => "无此记录");
                         }
                     } else {
                         $result = array('return' => 0, 'comment' => "您所选择的服务器不存在");
                     }
                 } else {
                     $result = array('return' => 2, 'comment' => "请指定PVP开始时间");
                 }
             } else {
                 $result = array('return' => 2, 'comment' => "时间有误");
             }
         } else {
             $result = array('return' => 0, 'comment' => "请指定用PVP生命周期");
         }
     } else {
         $result = array('return' => 2, 'comment' => "验证失败,请检查URL");
     }
     if ($User['ReturnType'] == 1) {
         echo json_encode($result);
     }
 }