Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[素材] 网站打开空白页面

[复制链接]
关于明兲。 发表于 2012-7-31 05:46:38 | 显示全部楼层 |阅读模式
50微币
本帖最后由 关于明兲。 于 2012-7-31 13:25 编辑

小弟遇到一个问题,这是个从数据库拉取数据 并输出xml文件到客户端的一个php程序
直接访问的话会显示

无法显示 XML 页。 使用 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。
XML 文档必须有一个顶层元素。处理资源 'http://q60.sjqk.wanhui2.com/salegen/gamesortquery.php' 时出错。

-----------上面的情况是正常的

可是我的打开直接是空白的页面 不知道哪位老大能帮忙解决下  

附上两个php的文件





附件: 您需要 登录 才可以下载或查看,没有账号?立即注册
briskvoice 发表于 2012-7-31 05:46:39 | 显示全部楼层
<?php
require_once '/gamesort.php';

$rankType = isset($_GET['t']) ? intval($_GET['t']) : 0;         
$curPage = isset($_GET['p']) ? intval($_GET['p']) : 1;

$memCacheKey = REGION_PREFIX . MEMCACHE_PARTITION. MEMCACHE_PREFIX . MEMCACHE_PARTITION . $rankType . MEMCACHE_PARTITION . $curPage;

$outXml = fetchXmlData($memCacheKey);
if ($outXml){
    header("content-type:text/xml;charset=utf-8");
    print $outXml;
}
else{
        header("content-type:text/xml;charset=utf-8");
        $outXmlList = cacheRankInfo($rankType);
        print $outXmlList[$memCacheKey];
}

?>
回复

使用道具 举报

yoxi011 发表于 2012-7-31 08:40:44 | 显示全部楼层
我也帮不到你...
回复

使用道具 举报

yoxi011 发表于 2012-7-31 08:41:09 | 显示全部楼层
我也帮不到你...
回复

使用道具 举报

www.wnrcw.com 发表于 2012-7-31 08:42:49 | 显示全部楼层
帮您顶
回复

使用道具 举报

4535 发表于 2012-7-31 09:52:20 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

briskvoice 发表于 2012-7-31 09:58:35 | 显示全部楼层
  1. <?php
  2. require_once 'config.php';
  3. define('MEMCACHE_PREFIX', 'gamesort');
  4. define('MEMCACHE_PARTITION', '|');
  5. define('MEMCACHE_TIME', 600);

  6. $RankPerKey = REGION_PREFIX . MEMCACHE_PARTITION. MEMCACHE_PREFIX .MEMCACHE_PARTITION;
  7. $metaData = array(
  8.     'page'      => 50 ,
  9.     'order'     => '',  
  10.     'limit'     => 50 ,
  11. );

  12. function cacheRankInfo($sortType){
  13.     global $RankPerKey;
  14.     $dbData = array();
  15.     switch ($sortType)
  16.     {
  17.         case 1:
  18.             $dbData = fetchBodyRank();
  19.             break;
  20.         case 2:
  21.             $dbData = fetchSoulRank();
  22.             break;
  23.         case 3:
  24.             $dbData = fetchTrumpRank();
  25.             break;
  26.         case 4:
  27.             $dbData = fetchPetRank();
  28.             break;
  29.         case 5:
  30.             $dbData = fetchGuildRank();
  31.             break;
  32.         case 6:
  33.             $dbData = fetchPkRank();
  34.             break;
  35.         case 7:
  36.                 $dbData = fetchFurnishmentRank();
  37.                 break;
  38.         case 8:
  39.                 $dbData = fetchFortuneRank();
  40.                 break;
  41.         case 9:
  42.             $dbData = fetchAbilityRank();
  43.             break;
  44.         case 10:
  45.             $dbData = fetchFlypetRank();
  46.             break;
  47.         case 11:
  48.             $dbData = fetchRidepetRank();
  49.             break;
  50.         case 12:
  51.             $dbData = fetchChanllengeRank();
  52.             break;
  53.         case 13:
  54.             $dbData = fetchRemedyRank();
  55.             break;
  56.         case 14:
  57.             $dbData = fetchMonsterRank();
  58.             break;
  59.         case 15:
  60.             $dbData = fetchWeaponRank();
  61.             break;
  62.         default:
  63.             return;
  64.     }
  65.    
  66.     //print_r($dbData);
  67.     if(count($dbData) < 1) return;
  68.     $perKey = $RankPerKey . $sortType . MEMCACHE_PARTITION;
  69.     $sortData = fetchPageData($dbData, $perKey);
  70.     //print_r($sortData);
  71.     $shopXmlData = parseToXml($sortData);
  72.     saveToCache($shopXmlData);
  73.     return $shopXmlData;
  74.     //clearCache($shopXmlData);
  75. }


  76. //武器排行
  77. function fetchWeaponRank ()
  78. {
  79.     global $metaData;
  80.    
  81.     $data = array();
  82.     $dB = dbConnect();
  83.    
  84.     $query = "SELECT char_oid,sort_effect_val1,sort_para FROM char_stat_sort WHERE sort_type = 15 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  85.     $query .= " limit ". $metaData['limit'];
  86.     $result = $dB->query($query);  
  87.    
  88.     $objUidList = "";
  89.     $rank = 0;
  90.     $minVal = 0;
  91.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  92.         $rank++;
  93.         if($objUidList != ""){
  94.             $objUidList = $objUidList . ",";
  95.         }
  96.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  97.         $data[] = array(
  98.             'rank' => $rank,
  99.             'weapon_type' => $row['sort_para'],
  100.             'quality' => $row['sort_effect_val1'],
  101.             'char_oid' => $row['char_oid'],
  102.         );
  103.         
  104.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  105.     }
  106.    
  107.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 15";
  108.     $dB->query($query);
  109.    
  110.     if ($objUidList == ""){
  111.         $dB->close();
  112.         return array();
  113.     }
  114.    
  115.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  116.     $result = $dB->query($query);  
  117.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  118.         $charName[$row['char_oid']] = $row["name"];
  119.     }
  120.     foreach($data as $key => $row){
  121.         $data[$key]['name'] = $charName[$row['char_oid']];
  122.     }
  123.    
  124.     $dB->close();
  125.     return $data;
  126. }

  127. //万妖窟排行
  128. function fetchMonsterRank ()
  129. {
  130.     global $metaData;
  131.    
  132.     $data = array();
  133.     $dB = dbConnect();
  134.    
  135.     $query = "SELECT char_oid,sort_effect_val1 FROM char_stat_sort WHERE sort_type = 14 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  136.     $query .= " limit ". $metaData['limit'];
  137.     $result = $dB->query($query);  
  138.    
  139.     $objUidList = "";
  140.     $rank = 0;
  141.     $minVal = 0;
  142.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  143.         $rank++;
  144.         if($objUidList != ""){
  145.             $objUidList = $objUidList . ",";
  146.         }
  147.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  148.         $data[$row["char_oid"]]['endless'] = $row["sort_effect_val1"];
  149.         $data[$row["char_oid"]]['rank'] = $rank;
  150.         $data[$row["char_oid"]]['char_oid'] = $row["char_oid"];
  151.         
  152.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  153.     }
  154.    
  155.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 14";
  156.     $dB->query($query);
  157.    
  158.     if ($objUidList == ""){
  159.         $dB->close();
  160.         return array();
  161.     }
  162.    
  163.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  164.     $result = $dB->query($query);  
  165.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  166.         $data[$row["char_oid"]]["name"] = $row["name"];
  167.     }
  168.    
  169.     $dB->close();
  170.     return $data;
  171. }

  172. function fetchRemedyRank ()
  173. {
  174.     global $metaData;
  175.    
  176.     $data = array();
  177.     $dB = dbConnect();
  178.    
  179.     $query = "SELECT char_oid,sort_effect_val1 FROM char_stat_sort WHERE sort_type = 13 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  180.     $query .= " limit ". $metaData['limit'];
  181.     $result = $dB->query($query);  
  182.    
  183.     $objUidList = "";
  184.     $rank = 0;
  185.     $minVal = 0;
  186.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  187.         $rank++;
  188.         if($objUidList != ""){
  189.             $objUidList = $objUidList . ",";
  190.         }
  191.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  192.         $data[$row["char_oid"]]['remedy'] = $row["sort_effect_val1"];
  193.         $data[$row["char_oid"]]['rank'] = $rank;
  194.         $data[$row["char_oid"]]['char_oid'] = $row["char_oid"];
  195.         
  196.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  197.     }
  198.    
  199.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 13";
  200.     $dB->query($query);
  201.    
  202.     if ($objUidList == ""){
  203.         $dB->close();
  204.         return array();
  205.     }
  206.    
  207.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  208.     $result = $dB->query($query);  
  209.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  210.         $data[$row["char_oid"]]["name"] = $row["name"];
  211.     }
  212.    
  213.     $dB->close();
  214.     return $data;
  215. }

  216. function fetchChanllengeRank(){
  217.     global $metaData;
  218.    
  219.     $query = "SELECT challenge_order,school,char_oid,name FROM char_challenge ORDER BY challenge_order  limit " . $metaData['limit'];

  220.     $data = array();
  221.     $dB = dbConnect();
  222.     $result = $dB->query($query);  
  223.    
  224.     $rank = 0;
  225.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  226.         $rank++;
  227.         $data[$rank] = $row;
  228.         $data[$rank]["rank"] = $rank;
  229.     }
  230.    
  231.     $dB->close();
  232.     return $data;
  233. }

  234. function fetchGuildRank ()
  235. {
  236.     global $metaData;
  237.    
  238.     $query = "SELECT a.*, char_oid FROM (SELECT guild_id,name as guild_name,level,leader_name as name,member_count as count FROM guild_data FORCE INDEX (level) ORDER BY LEVEL DESC, boom DESC";
  239.     $query .= " limit ". $metaData['limit'] .") AS a LEFT JOIN char_data b ON ( a.name = b.name )";

  240.     $data = array();
  241.     $dB = dbConnect();
  242.     $result = $dB->query($query);  
  243.    
  244.     $rank = 0;
  245.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  246.         $rank++;
  247.         $data[$rank] = $row;
  248.         $data[$rank]["rank"] = $rank;
  249.     }
  250.    
  251.     $dB->close();
  252.     return $data;
  253. }

  254. function fetchBodyRank ()
  255. {
  256.     global $metaData;
  257.    
  258.     $data = array();
  259.     $dB = dbConnect();
  260.    
  261.     $query = "SELECT object_uid,sort_effect_val1 FROM char_item_sort WHERE sort_type = 1 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  262.     $query .= " limit ". $metaData['limit'];
  263.     $result = $dB->query($query);  
  264.    
  265.     $objUidList = "";
  266.     $rank = 0;
  267.     $minVal = 0;
  268.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  269.         $rank++;
  270.         if($objUidList != ""){
  271.             $objUidList = $objUidList . ",";
  272.         }
  273.         $objUidList = $objUidList . "'" . $row["object_uid"] . "'";
  274.         $data[$row["object_uid"]]['level'] = $row["sort_effect_val1"];
  275.         $data[$row["object_uid"]]['rank'] = $rank;
  276.         
  277.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  278.     }
  279.    
  280.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 1";
  281.     $dB->query($query);
  282.    
  283.     if ($objUidList == ""){
  284.         $dB->close();
  285.         return array();
  286.     }
  287.    
  288.     $query = "SELECT a.item_uuid, a.owner_oid, b.name FROM char_items as a, char_data b WHERE a.owner_oid = b.char_oid and a.item_uuid in (" . $objUidList .")";
  289.     $result = $dB->query($query);  

  290.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  291.         $data[$row["item_uuid"]]["name"] = $row["name"];
  292.         $data[$row["item_uuid"]]["char_oid"] = $row["owner_oid"];
  293.         
  294.         // 把角色ID刷到角色物品排行表
  295.         $sql = "UPDATE char_item_sort SET char_oid = ".$row["owner_oid"]." WHERE object_uid = '".$row["item_uuid"]."'";
  296.         $dB->query($sql);
  297.     }
  298.    
  299.     // 如果肉身数据不存在,则删除排名数据
  300.     foreach($data as $key => $rankVal){
  301.         if (!isset($rankVal["name"])){
  302.             $query = "DELETE FROM char_item_sort WHERE object_uid = '" . $key . "'";
  303.             $result = $dB->query($query);
  304.         }
  305.     }
  306.    
  307.     $dB->close();
  308.     return $data;
  309. }

  310. function fetchSoulRank ()
  311. {
  312.     global $metaData;
  313.    
  314.     $data = array();
  315.     $dB = dbConnect();
  316.    
  317.     $query = "SELECT char_oid,sort_effect_val1 FROM char_stat_sort WHERE sort_type = 2 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  318.     $query .= " limit ". $metaData['limit'];
  319.     $result = $dB->query($query);  
  320.    
  321.     $objUidList = "";
  322.     $rank = 0;
  323.     $minVal = 0;
  324.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  325.         $rank++;
  326.         if($objUidList != ""){
  327.             $objUidList = $objUidList . ",";
  328.         }
  329.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  330.         $data[$row["char_oid"]]['level'] = $row["sort_effect_val1"];
  331.         $data[$row["char_oid"]]['rank'] = $rank;
  332.         $data[$row["char_oid"]]['char_oid'] = $row["char_oid"];
  333.         
  334.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  335.     }
  336.    
  337.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 2";
  338.     $dB->query($query);
  339.    
  340.     if ($objUidList == ""){
  341.         $dB->close();
  342.         return array();
  343.     }
  344.    
  345.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  346.     $result = $dB->query($query);  
  347.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  348.         $data[$row["char_oid"]]["name"] = $row["name"];
  349.     }
  350.    
  351.     $dB->close();
  352.     return $data;
  353. }

  354. function fetchTrumpRank ()
  355. {
  356.     global $metaData;
  357.    
  358.     $data = array();
  359.     $dB = dbConnect();
  360.    
  361.     $query = "SELECT object_uid,sort_effect_val1,sort_effect_val2 FROM char_item_sort WHERE sort_type = 3 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  362.     $query .= " limit ". $metaData['limit'];
  363.     $result = $dB->query($query);  
  364.    
  365.     $objUidList = "";
  366.     $rank = 0;
  367.     $minVal1 = 0;
  368.     $minVal2 = 0;
  369.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  370.         $rank++;
  371.         if($objUidList != ""){
  372.             $objUidList = $objUidList . ",";
  373.         }
  374.         $objUidList = $objUidList . "'" . $row["object_uid"] . "'";
  375.         $data[$row["object_uid"]]['rank'] = $rank;
  376.         $data[$row["object_uid"]]['item_uuid'] = $row["object_uid"];
  377.         $data[$row["object_uid"]]['quality'] = $row["sort_effect_val2"];
  378.         $data[$row["object_uid"]]['power'] = $row["sort_effect_val1"];
  379.         
  380.         if ($rank == $metaData['limit']) {
  381.             $minVal1 = $row["sort_effect_val1"];
  382.             $minVal2 = $row["sort_effect_val2"];
  383.         }
  384.     }
  385.    
  386.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal1 . ", rank_val2_min = " . $minVal2 . " where rank_type = 3";
  387.     $dB->query($query);
  388.    
  389.     if ($objUidList == ""){
  390.         $dB->close();
  391.         return array();
  392.     }
  393.    
  394.     $query = "SELECT item_uuid, owner_oid, template_oid FROM char_items WHERE item_uuid in (" . $objUidList .")";
  395.     $result = $dB->query($query);
  396.     $charOidList = "";
  397.     $petOidList = "";
  398.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  399.         if ($row["owner_oid"] < 4294967295){
  400.             if($charOidList != ""){
  401.                 $charOidList = $charOidList . ",";
  402.             }
  403.             $charOidList = $charOidList . "'" . $row["owner_oid"] . "'";
  404.         }
  405.         else{
  406.             if($petOidList != ""){
  407.                 $petOidList = $petOidList . ",";
  408.             }
  409.             $petOidList = $petOidList . "'" . $row["owner_oid"] . "'";
  410.         }
  411.         
  412.         $data[$row["item_uuid"]]["template_oid"] = $row["template_oid"];
  413.         $data[$row["item_uuid"]]["name"] = "";
  414.         $data[$row["item_uuid"]]["owner_oid"] = $row["owner_oid"];
  415.         $data[$row["item_uuid"]]["char_oid"] = $row["owner_oid"];
  416.     }
  417.    
  418.     $oid2name = array();
  419.     if($petOidList != ""){
  420.         $query = "SELECT pet_oid, b.name FROM char_pets a, char_data b WHERE pet_oid in (" . $petOidList .") and a.char_oid = b.char_oid";
  421.         $result = $dB->query($query);
  422.         while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  423.             $oid2name[$row["pet_oid"]] = $row["name"];
  424.         }
  425.     }
  426.    
  427.     if($charOidList != ""){
  428.         $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $charOidList .")";
  429.         $result = $dB->query($query);  
  430.         while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  431.             $oid2name[$row["char_oid"]] = $row["name"];
  432.         }
  433.     }
  434.    
  435.     foreach($data as $key => $rankVal){
  436.         if(isset($oid2name[$rankVal["owner_oid"]])){
  437.             $data[$key]["name"] = $oid2name[$rankVal["owner_oid"]];
  438.             
  439.             // 把角色ID刷到角色物品排行表
  440.                 $sql = "UPDATE char_item_sort SET char_oid = ".$rankVal["owner_oid"]." WHERE object_uid = '".$rankVal["item_uuid"]."'";
  441.                 $dB->query($sql);
  442.         }
  443.         else{
  444.             // 如果法宝数据不存在,则删除排名数据
  445.             $query = "DELETE FROM char_item_sort WHERE object_uid = '" . $key . "'";
  446.             $result = $dB->query($query);
  447.         }
  448.     }

  449.     $dB->close();
  450.     return $data;
  451. }

  452. function fetchPetRank ()
  453. {
  454.     global $metaData;
  455.    
  456.     $data = array();
  457.     $dB = dbConnect();
  458.    
  459.     $query = "SELECT object_uid,sort_effect_val1,sort_effect_val2 FROM char_item_sort WHERE sort_type = 4 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  460.     $query .= " limit ". $metaData['limit'];
  461.     $result = $dB->query($query);  
  462.    
  463.     $objUidList = "";
  464.     $rank = 0;
  465.     $minVal = 500;
  466.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  467.         $rank++;
  468.         if($objUidList != ""){
  469.             $objUidList = $objUidList . ",";
  470.         }
  471.         $objUidList = $objUidList . "'" . $row["object_uid"] . "'";
  472.         $data[$row["object_uid"]]['rank'] = $rank;
  473.         $data[$row["object_uid"]]['pet_oid'] = $row["object_uid"];
  474.         $data[$row["object_uid"]]['quality'] = $row["sort_effect_val2"];
  475.         $data[$row["object_uid"]]['power'] = $row["sort_effect_val1"];
  476.         
  477.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  478.     }
  479.    
  480.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 4";
  481.     $dB->query($query);
  482.    
  483.     if ($objUidList == ""){
  484.         $dB->close();
  485.         return array();
  486.     }
  487.    
  488.     $query = "SELECT pet_oid, b.name as name, a.name as pname,b.char_oid as char_oid FROM char_pets a, char_data b WHERE a.char_oid = b.char_oid and pet_oid in (" . $objUidList .")";
  489.     //print_r($query);
  490.     $result = $dB->query($query);  
  491.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  492.         $data[$row["pet_oid"]]["name"] = $row["name"];
  493.         $data[$row["pet_oid"]]["pet_name"] = $row["pname"];
  494.         $data[$row["pet_oid"]]["char_oid"] = $row["char_oid"];
  495.         
  496.         // 把角色ID刷到角色物品排行表
  497.         $sql = "UPDATE char_item_sort SET char_oid = ".$row["char_oid"]." WHERE object_uid = '".$row["pet_oid"]."'";
  498.         $dB->query($sql);
  499.     }
  500.    
  501.     // 如果宠物数据不存在,则删除排名数据
  502.     foreach($data as $key => $rankVal){
  503.         if (!isset($rankVal["name"])){
  504.             $query = "DELETE FROM char_item_sort WHERE object_uid = '" . $key . "'";
  505.             $result = $dB->query($query);
  506.         }
  507.     }
  508.    
  509.     $dB->close();
  510.     return $data;
  511. }

  512. function fetchPkRank ()
  513. {
  514.     global $metaData;
  515.    
  516.     $data = array();
  517.     $dB = dbConnect();
  518.    
  519.     $query = "SELECT char_oid,sort_effect_val1 FROM char_stat_sort WHERE sort_type = 6 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  520.     $query .= " limit ". $metaData['limit'];
  521.     $result = $dB->query($query);  
  522.    
  523.     $objUidList = "";
  524.     $rank = 0;
  525.     $minVal = 0;
  526.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  527.         $rank++;
  528.         if($objUidList != ""){
  529.             $objUidList = $objUidList . ",";
  530.         }
  531.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  532.         $data[$row["char_oid"]]['pk_point'] = $row["sort_effect_val1"];
  533.         $data[$row["char_oid"]]['rank'] = $rank;
  534.         
  535.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  536.     }
  537.    
  538.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 6";
  539.     $dB->query($query);
  540.    
  541.     if ($objUidList == ""){
  542.         $dB->close();
  543.         return array();
  544.     }
  545.    
  546.     $query = "SELECT a.char_oid, name, b.level as blevel, c.level as slevel FROM char_data a,char_body b,char_soul c WHERE a.char_oid in (" . $objUidList .") and a.char_oid = b.char_oid and a.char_oid = c.char_oid ";
  547.     $result = $dB->query($query);  
  548.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  549.         $data[$row["char_oid"]]["name"] = $row["name"];
  550.         $data[$row["char_oid"]]["body_level"] = $row["blevel"];
  551.         $data[$row["char_oid"]]["soul_level"] = $row["slevel"];
  552.     }
  553.    
  554.     $dB->close();
  555.     return $data;
  556. }

  557. function fetchFurnishmentRank(){
  558.         global $metaData;
  559.    
  560.     $data = array();
  561.     $dB = dbConnect();
  562.    
  563.     $query = "SELECT object_uid,sort_effect_val1, sort_effect_val2 FROM char_item_sort WHERE sort_type = 7 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  564.     $query .= " limit ". $metaData['limit'];
  565.     $result = $dB->query($query);  
  566.    
  567.     $objUidList = "";
  568.     $rank = 0;
  569.     $minVal = 0;
  570.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  571.         $rank++;
  572.         if($objUidList != ""){
  573.             $objUidList = $objUidList . ",";
  574.         }
  575.         $objUidList = $objUidList . "'" . $row["object_uid"] . "'";
  576.         $data[$row["object_uid"]]['rank'] = $rank;
  577.         $data[$row["object_uid"]]['item_uuid'] = $row["object_uid"];
  578.         $data[$row["object_uid"]]['quality'] = $row["sort_effect_val2"];
  579.         $data[$row["object_uid"]]['power'] = $row["sort_effect_val1"];
  580.         
  581.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  582.     }
  583.    
  584.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 7";
  585.     $dB->query($query);
  586.    
  587.     if ($objUidList == ""){
  588.         $dB->close();
  589.         return array();
  590.     }
  591.    
  592.     $query = "SELECT a.item_uuid, a.template_oid, a.owner_oid, b.name FROM char_items as a, char_data b WHERE a.owner_oid = b.char_oid and a.item_uuid in (" . $objUidList .")";
  593.     $result = $dB->query($query);  

  594.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  595.         $data[$row["item_uuid"]]["name"] = $row["name"];
  596.         $data[$row["item_uuid"]]["char_oid"] = $row["owner_oid"];
  597.         $data[$row["item_uuid"]]["template_oid"] = $row["template_oid"];
  598.         
  599.         // 把角色ID刷到角色物品排行表
  600.         $sql = "UPDATE char_item_sort SET char_oid = ".$row["owner_oid"]." WHERE object_uid = '".$row["item_uuid"]."'";
  601.         $dB->query($sql);
  602.     }
  603.     $dB->close();
  604.     return $data;
  605. }

  606. function fetchFortuneRank(){
  607.         global $metaData;
  608.    
  609.     $data = array();
  610.     $dB = dbConnect();
  611.    
  612.     $query = "SELECT char_oid,sort_effect_val1 FROM char_stat_sort WHERE sort_type = 8 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  613.     $query .= " limit ". $metaData['limit'];
  614.     $result = $dB->query($query);  
  615.    
  616.     $objUidList = "";
  617.     $rank = 0;
  618.     $minVal = 0;
  619.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  620.         $rank++;
  621.         if($objUidList != ""){
  622.             $objUidList = $objUidList . ",";
  623.         }
  624.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  625.         $data[$row["char_oid"]]['rank'] = $rank;
  626.         $data[$row["char_oid"]]['money'] = $row["sort_effect_val1"];
  627.         $data[$row["char_oid"]]['char_oid'] = $row["char_oid"];
  628.         
  629.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  630.     }
  631.    
  632.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 8";
  633.     $dB->query($query);
  634.    
  635.     if ($objUidList == ""){
  636.         $dB->close();
  637.         return array();
  638.     }
  639.    
  640.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  641.     $result = $dB->query($query);  
  642.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  643.         $data[$row["char_oid"]]["name"] = $row["name"];
  644.     }
  645.    
  646.     $dB->close();
  647.     return $data;
  648. }

  649. function fetchAbilityRank(){
  650.     global $metaData;
  651.    
  652.     $data = array();
  653.     $dB = dbConnect();
  654.    
  655.     $query = "SELECT char_oid,sort_effect_val1, sort_effect_val2 FROM char_stat_sort WHERE sort_type = 9 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  656.     $query .= " limit ". $metaData['limit'];
  657.     $result = $dB->query($query);  
  658.    
  659.     $objUidList = "";
  660.     $rank = 0;
  661.     $minVal = 0;
  662.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  663.         $rank++;
  664.         if($objUidList != ""){
  665.             $objUidList = $objUidList . ",";
  666.         }
  667.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  668.         $data[$row["char_oid"]]['rank'] = $rank;
  669.         $data[$row["char_oid"]]['power'] = $row["sort_effect_val1"];
  670.         $data[$row["char_oid"]]['level'] = $row["sort_effect_val2"];
  671.         $data[$row["char_oid"]]['char_oid'] = $row["char_oid"];
  672.         
  673.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  674.     }
  675.    
  676.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 9";
  677.     $dB->query($query);
  678.    
  679.     if ($objUidList == ""){
  680.         $dB->close();
  681.         return array();
  682.     }
  683.    
  684.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  685.     $result = $dB->query($query);  
  686.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  687.         $data[$row["char_oid"]]["name"] = $row["name"];
  688.     }
  689.    
  690.     $dB->close();
  691.     return $data;
  692. }

  693. //飞行宠排行
  694. function fetchFlypetRank(){
  695.     global $metaData;
  696.    
  697.     $data = array();
  698.     $dB = dbConnect();
  699.    
  700.     $query = "SELECT char_oid, sort_effect_val1, sort_effect_val2 FROM char_stat_sort WHERE sort_type = 10 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  701.     $query .= " limit ". $metaData['limit'];
  702.     $result = $dB->query($query);  
  703.    
  704.     $objUidList = "";
  705.     $rank = 0;
  706.     $minVal = 0;
  707.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  708.         $rank++;
  709.         if($objUidList != ""){
  710.             $objUidList = $objUidList . ",";
  711.         }
  712.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  713.         $data[$row["char_oid"]]['rank'] = $rank;
  714.         $data[$row["char_oid"]]['quality'] = $row["sort_effect_val2"];
  715.         $data[$row["char_oid"]]['char_oid'] = $row["char_oid"];
  716.         
  717.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  718.     }
  719.    
  720.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 10";
  721.     $dB->query($query);
  722.    
  723.     if ($objUidList == ""){
  724.         $dB->close();
  725.         return array();
  726.     }
  727.    
  728.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  729.     $result = $dB->query($query);  
  730.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  731.         $data[$row["char_oid"]]["name"] = $row["name"];
  732.     }
  733.    
  734.     $query = "SELECT char_oid, level FROM char_ride WHERE ride_type = 1 AND char_oid in (" . $objUidList .")";
  735.     $result = $dB->query($query);  
  736.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  737.         $data[$row["char_oid"]]["level"] = $row["level"];
  738.     }
  739.    
  740.     $dB->close();
  741.     return $data;
  742. }

  743. //坐骑排行
  744. function fetchRidepetRank(){
  745.     global $metaData;
  746.    
  747.     $data = array();
  748.     $dB = dbConnect();
  749.    
  750.     $query = "SELECT char_oid, sort_effect_val1, sort_effect_val2 FROM char_stat_sort WHERE sort_type = 11 ORDER BY `sort_effect_val1` DESC , `sort_effect_val2` DESC ";
  751.     $query .= " limit ". $metaData['limit'];
  752.     $result = $dB->query($query);  
  753.    
  754.     $objUidList = "";
  755.     $rank = 0;
  756.     $minVal = 0;
  757.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  758.         $rank++;
  759.         if($objUidList != ""){
  760.             $objUidList = $objUidList . ",";
  761.         }
  762.         $objUidList = $objUidList . "'" . $row["char_oid"] . "'";
  763.         $data[$row["char_oid"]]['rank'] = $rank;
  764.         $data[$row["char_oid"]]['quality'] = $row["sort_effect_val2"];
  765.         $data[$row["char_oid"]]['char_oid'] = $row["char_oid"];
  766.         
  767.         if ($rank == $metaData['limit']) $minVal = $row["sort_effect_val1"];
  768.     }
  769.    
  770.     $query = "UPDATE char_rank_params SET rank_val1_min = " . $minVal . " where rank_type = 11";
  771.     $dB->query($query);
  772.    
  773.     if ($objUidList == ""){
  774.         $dB->close();
  775.         return array();
  776.     }
  777.    
  778.     $query = "SELECT char_oid, name FROM char_data WHERE char_oid in (" . $objUidList .")";
  779.     $result = $dB->query($query);  
  780.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  781.         $data[$row["char_oid"]]["name"] = $row["name"];
  782.     }
  783.    
  784.     $query = "SELECT char_oid, level FROM char_ride WHERE ride_type = 0 AND char_oid in (" . $objUidList .")";
  785.     $result = $dB->query($query);  
  786.     while ($row = $dB->fetchRow($result, MYSQL_ASSOC)) {
  787.         $data[$row["char_oid"]]["level"] = $row["level"];
  788.     }
  789.    
  790.     $dB->close();
  791.     return $data;
  792. }

  793. function fetchPageData(&$row, $perKey){
  794.     global $metaData;
  795.     $curTime = time();
  796.     $cacheData = array();
  797.    
  798.     $records = count($row);
  799.     $pageAmount = ceil($records / $metaData['page']);
  800.     $page = 0;
  801.     $idx = 0;
  802.     $cacheKey = $perKey . $page;
  803.     foreach($row as $key => $rankVal){
  804.         if (($idx % $metaData['page'] == 0)){
  805.             $page += 1;
  806.             $cacheKey = $perKey . $page;   
  807.             $cacheData[$cacheKey]['attribute']['amount'] = $pageAmount;
  808.             $cacheData[$cacheKey]['attribute']['count'] = $records;
  809.             $cacheData[$cacheKey]['attribute']['page'] = $page;
  810.             $cacheData[$cacheKey]['attribute']['limit'] = $metaData['limit'];
  811.             $cacheData[$cacheKey]['attribute']['date'] = $curTime;
  812.         }
  813.         $cacheData[$cacheKey]['data'][] = $row[$key];
  814.         $idx += 1;
  815.     }
  816.     return $cacheData;
  817. }
  818. ?>
复制代码
回复

使用道具 举报

波︶ㄣ依然 发表于 2012-7-31 12:07:31 | 显示全部楼层
了解了解
回复

使用道具 举报

banklj 发表于 2012-10-10 10:11:45 | 显示全部楼层
我的也是空
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-20 20:25 , Processed in 0.033477 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表