コード例 #1
0
 public function searchWpList($sorttype = 0)
 {
     /**
      * 2015.08.06
      * 自运营壁纸叠加到安卓壁纸智商
      * 需要兼容旧版本
      * 
      */
     $num = $this->_num;
     $start = $this->_start;
     $nCpTotal = 0;
     $nRetNum = 0;
     $arrRetWallpaper = array();
     $bChoice = false;
     if ($this->_type == 0) {
         $bChoice = true;
     }
     $coolshow = new CoolShowSearch();
     $result = $coolshow->getWallpaper($bChoice, $this->_type, $this->_start, $this->_num);
     if (!$result) {
         return false;
     }
     return json_encode($result);
     if ($result) {
         $nCpTotal = $result['total_number'];
         $nRetNum = $result['ret_number'];
         $arrRetWallpaper = $result['wallpapers'];
         // 			if ($nCpTotal >= ($this->_start + $this->_num)){
         // 				return json_encode($result);
         // 			}
         if ($nRetNum == 0) {
             $num = $this->_num;
             $start = $this->_start - $nCpTotal;
         } else {
             $num = $this->_num - $nRetNum;
             $start = 0;
         }
     }
     // 		}
     $this->_adWp->setReqNum($start, $num);
     $result = $this->_getWpList($sorttype);
     if (!$result) {
         return false;
     }
     $json_rsp = array('total_number' => (int) $nCpTotal + (int) $result['total_number'], 'ret_number' => (int) $nRetNum + (int) $result['ret_number'], 'wallpapers' => array_merge($arrRetWallpaper, $result['wallpapers']));
     return json_encode($json_rsp);
 }