Exemplo n.º 1
0
 public function actionList()
 {
     $order = isset($_POST['order']) ? $_POST['order'] : 1;
     $order = CommonFunc::checkIntParam($order, 4, 1);
     $type = isset($_POST['type']) ? $_POST['type'] : '';
     $type = CommonFunc::checkIntParam($type, 2, '');
     $search = isset($_POST['search']) ? $_POST['search'] : '';
     $category = isset($_POST['category']) ? $_POST['category'] : '';
     $category = CommonFunc::checkIntParam($category, Category::getMaxCategory(), '');
     $maxId = isset($_POST['maxid']) ? $_POST['maxid'] : 0;
     $page = isset($_POST['page']) ? $_POST['page'] : 0;
     if (!$maxId) {
         $maxId = AppInfoList::getMaxId();
     }
     $appsInfo = AppInfoList::getData($order, $type, $search, $category, $_POST['page'] * 25, 25, $maxId);
     echo new ReturnInfo(RET_SUC, array('list' => $appsInfo['data'], 'maxid' => $maxId, 'pageCount' => $appsInfo['pageCount']));
 }
Exemplo n.º 2
0
 public function getData($order)
 {
     $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
     $limit = isset($_GET['limit']) ? $_GET['limit'] : 10;
     if (!is_numeric($offset) || !is_numeric($limit)) {
         return new ReturnInfo(RET_ERROR, 'offset or limit parameter error');
     }
     $offset = (int) $offset;
     $limit = (int) $limit;
     if ($offset < 0 || $limit < 0) {
         return new ReturnInfo(RET_ERROR, 'offset or limit parameter error');
     }
     $maxId = isset($_GET['maxid']) ? $_GET['maxid'] : 0;
     if (!is_numeric($maxId)) {
         return new ReturnInfo(RET_ERROR, 'maxid parameter error');
     }
     $maxId = (int) $maxId;
     $type = isset($_GET['type']) ? $_GET['type'] : 0;
     $type = CommonFunc::checkIntParam($type, 2, '');
     $search = isset($_GET['search']) ? $_GET['search'] : '';
     $category = isset($_GET['category']) ? $_GET['category'] : '';
     $category = CommonFunc::checkIntParam($category, Category::getMaxCategory(), '');
     $appsInfo = AppInfoList::getData($order, $type, $search, $category, $offset * $limit, $limit, $maxId);
     return new ReturnInfo(RET_SUC, array('offset' => $offset, 'data' => $appsInfo['data']));
 }
Exemplo n.º 3
0
 public function sendAppList($type, $txt)
 {
     switch ($type) {
         case 'APP_NEW_LIST':
             $appsInfo = AppInfoList::getData(0, 0, '', 0, 0, 10);
             $title = "App哥伦部最新应用";
             break;
         case 'SEARCH':
             $appsInfo = AppInfoList::getData(0, 0, $txt, 0, 0, 10);
             $title = "App搜索结果";
             break;
     }
     $aData = array();
     foreach ($appsInfo['data'] as $m) {
         $_ = "[强]" . $m['count'];
         $_ .= ' <a href="http://appgrub.com/produce/index/' . $m['Id'] . '">' . $m['AppName'] . "</a>\n";
         if (!empty($m['Remarks'])) {
             $content = strip_tags($m['Remarks']);
         } else {
             $content = strip_tags($m['AppInfo']);
         }
         $_ .= mb_substr($content, 0, 30, "utf-8");
         $aData[] = $_;
     }
     if (count($aData) == 0) {
         $msg = '暂无符合条件的App, 请点击 <a href="http://www.appgrub.com">进入网站</a> 发现更多App';
     } else {
         $msg = implode("\n\n", $aData);
     }
     $this->sendMsg($title . "\n-------------------------\n" . $msg);
     break;
 }