Example #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']));
 }
Example #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']));
 }
Example #3
0
 public function actionAlertAppInfoListCategory()
 {
     $mainCategory = Yii::app()->request->getParam('main_category');
     $subcategory = Yii::app()->request->getParam('subcategory');
     $mainCategory = CommonFunc::checkIntParam($mainCategory, Category::getMaxCategory(), '');
     $categoryModel = new Category();
     $systemCategory = $categoryModel->category;
     if (!isset($systemCategory[$mainCategory])) {
         throw new THttpException('一级分类有误');
     }
     if (!in_array($subcategory, explode(',', $systemCategory[$mainCategory]['value']))) {
         throw new THttpException('子分类有误');
     }
     $app = AppInfoList::model()->findByPk(Yii::app()->request->getParam('appID'));
     if (!$app instanceof AppInfoList) {
         throw new THttpException('应用ID有误');
     }
     $app->MainCategory = $subcategory;
     if ($app->save()) {
         echo new ReturnInfo(0, 1);
     } else {
         throw new THttpException('修改失败');
     }
 }