예제 #1
0
 /** 查看 */
 public function actionView()
 {
     $request = Yii::$app->request;
     if ($request->isPost) {
         $infoId = $request->post('infoId');
         return $this->renderAjax('info', ['info' => Info::findOne($infoId)]);
     } else {
         throw new Exception("非正常请求");
     }
 }
예제 #2
0
 /**
  * Finds the Info model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Info the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Info::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
 public function actionInfo($id)
 {
     $data = \common\models\Info::findOne($id);
     return $this->renderAjax('info', ['data' => $data]);
 }
예제 #4
0
 /**
  * 修改状态,有错误会返回错误
  * @param $infoId
  * @param $state
  * @return bool|string
  */
 public static function changeState($infoId, $state, $replyContent = null)
 {
     $info = Info::findOne($infoId);
     if ($info) {
         $info->state = $state;
         $user = Yii::$app->session->get('user');
         $info->replyUserId = $user['userId'];
         $info->replyDate = DateFunctions::getCurrentDate();
         $info->replyContent = $replyContent;
         $info->save();
         return false;
     } else {
         return "不存在该信息";
     }
 }