Esempio n. 1
0
 /**
  * 我的发贴.
  * 
  * @access public
  * @return void
  */
 public function myPostList()
 {
     $pageConfig = C('page');
     $locateCountry = $this->getLocateCountry();
     $loginedUserInfo = $this->getLoginedUserInfo();
     $page = (int) I('post.' . $pageConfig['var_page'], 1);
     // page.
     $pageSize = (int) I('post.' . $pageConfig['var_page_size'], 10);
     // rows.
     $countryId = (int) I('post.countryId', (int) $locateCountry['id']);
     $userId = (int) $loginedUserInfo['uid'];
     $postType = (int) I('post.postType', 0);
     // 发贴类型: 0: 分类, 1: 社区资讯.
     $allowType = [0, 1];
     if (!in_array($postType, $allowType, TRUE)) {
         $this->setAjaxData(Message::PARAM_ERROR, Message::get(Message::PARAM_ERROR))->myAjaxReturn();
     }
     $model = NULL;
     switch ($postType) {
         case 0:
             $model = new CtgDataModel();
             break;
         case 1:
             $model = new SqDataModel();
             break;
         default:
     }
     $lists = $model->fetchListByCountry($userId, $countryId, $page, $pageSize);
     Util::resolveCity($lists['lists'], 'city_name');
     // 将城市名称中的英文字母去掉.
     $this->setAjaxData(Message::SUCCESS, Message::get(Message::SUCCESS), $lists)->myAjaxReturn();
 }