Exemple #1
0
 function getNewsAction()
 {
     $request = $this->getRequest();
     if ('POST' == $request->getMethod()) {
         $ssotoken = $this->post()->get("ssotoken");
         $actionId = $this->post()->get("actionId");
         $previousId = $this->post()->get("previousId");
         $pageSize = $this->post()->get("pageSize");
     } else {
         $ssotoken = $this->get("ssotoken");
         $actionId = $this->get("actionId");
         $previousId = $this->get("previousId");
         $pageSize = $this->get("pageSize");
     }
     if (!$ssotoken || !$actionId) {
         $this->displayJsonUdo(Common_Error::ERROR_PARAM);
     }
     //获取用户id
     $userModel = new UserModel();
     $uid = $userModel->getUserId($ssotoken);
     if (is_array($uid)) {
         $this->displayJsonUdo(Common_Error::INVALID_TOKEN, "", $uid['msg']);
     }
     $schoolModel = new SchoolModel();
     $news = $schoolModel->getNews($actionId, $previousId, $pageSize);
     if ($news) {
         $msg = "请求成功~";
     } else {
         $msg = "没有更多了哦~";
     }
     $this->displayJsonUdo(Common_Error::ERROR_SUCCESS, $news, $msg);
 }