示例#1
0
 public function actionIndex()
 {
     $view = \Yii::$app->view;
     $view->params['moduleName'] = '意见反馈';
     $request = \Yii::$app->request;
     $status = $request->_get('status', 'wait');
     $search = $request->_get('search', '');
     $total = Feedback::getTotal($status, $search);
     $pagination = new Pagination(['defaultPageSize' => \Yii::$app->params['pageSize'], 'totalCount' => $total]);
     $data = Feedback::getInfos($status, $search, $pagination->limit, $pagination->offset);
     $token = Token::getToken();
     $userId = \Yii::$app->user->id;
     $changestatusIdentity = EasyHelpers::dataEncrypt('changestatus,' . $userId);
     return $this->render('index', ['data' => $data, 'pagination' => $pagination, 'status' => $status, 'search' => $search, 'token' => $token, 'changestatusIdentity' => $changestatusIdentity]);
 }
示例#2
0
 /**
  * 意见反馈处理
  */
 public function actionChangestatus()
 {
     $request = \Yii::$app->request;
     $identity = Identity::checkIdentity('changestatus', '/app-backend/backend/feedback/changestatus');
     if (is_array($identity)) {
         return $identity;
     }
     $id = $request->_get('id', 0);
     $status = $request->_get('status', 0);
     if (!$id || !$status) {
         return ['code' => 1, 'msg' => '数据非法', 'data' => []];
     }
     $res = Feedback::changeStatus($id, $status);
     if ($res !== false) {
         return ['code' => 0, 'msg' => '操作成功', 'data' => ['status' => $res]];
     } else {
         return ['code' => 2, 'msg' => '操作失败,请重试', 'data' => []];
     }
 }
示例#3
0
 /**
  * save Feedback model and trigger event notifications.
  * @param integer $id proyecto
  * @return Json Feedbaack
  */
 public function actionFeedback($id)
 {
     // ajax validation
     if (Yii::$app->request->isAjax) {
         $data = json_decode($_POST['feedback']);
         //search proyecto  creaction user
         $model_proyecto = Proyecto::findOne($id);
         $model = new Feedback();
         $model->id_usuario = Yii::$app->user->identity->id;
         $model->id_usuario_destino = $model_proyecto->usuario_creacion;
         $model->mensaje = $data->note;
         $model->img = $data->img;
         if ($model->save()) {
             $model->trigger(Feedback::EVENT_NUEVO_PEDIDO);
             //Notificacion
             Yii::$app->response->format = Response::FORMAT_JSON;
             return true;
         } else {
             return false;
         }
     }
 }
示例#4
0
 public function actionFind($id)
 {
     $request = Yii::$app->request;
     if ($request->isAjax) {
         /*
          *   Process for ajax request
          */
         Yii::$app->response->format = Response::FORMAT_JSON;
         return $model = Feedback::findOne($id);
         // Yii::$app->response->format = Response::FORMAT_JSON;
     } else {
         return 0;
     }
 }