Inheritance: extends yii\db\ActiveRecord
Beispiel #1
0
 public static function add($params)
 {
     $userid = intval($params['userid']);
     $username = $params['username'];
     $data = ['surgets' => 4, 'content' => $params['content'], 'contact' => $params['contact'], 'userid' => $params['userid'], 'username' => $params['username'], 'createtime' => time()];
     $feebback = new d_feedback();
     $res = $feebback->feedbackAdd($data);
     $code = $res ? 200 : 500;
     $message = $res ? '意见反馈成功!' : '意见反馈失败,请再次提交!';
     return Common::result($code, $message, array());
 }
 /**
  * Finds the Feedback model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Feedback the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Feedback::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #3
0
 /**
  * Creates data provider instance with search query applied
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Feedback::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'slug' => $this->slug, 'author_id' => $this->author_id, 'category_id' => $this->category_id, 'updater_id' => $this->updater_id, 'status' => $this->status, 'published_at' => $this->published_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'lang', $this->lang])->andFilterWhere(['like', 'weight', $this->weight])->andFilterWhere(['like', 'body', $this->body]);
     return $dataProvider;
 }
Beispiel #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Feedback::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'activity_id' => $this->activity_id, 'offer_id' => $this->offer_id, 'agreement_id' => $this->agreement_id]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Feedback::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
Beispiel #6
0
 /**
  * Creates data provider instance with search query applied
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Feedback::find();
     $query->joinWith(['author']);
     if (!\Yii::$app->user->can('administrator')) {
         $query->andWhere(['domain_id' => \Yii::$app->user->identity->id]);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'domain_id' => $this->domain_id]);
     if ($this->search_date_created != '') {
         $this->data_begin_created = strtotime($this->search_date_created);
         $this->data_end_created = strtotime($this->search_date_created) + 24 * 60 * 60;
     }
     $query->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['between', 'feedback_form.created_at', $this->data_begin_created, $this->data_end_created])->andFilterWhere(['like', 'user.username', $this->author]);
     return $dataProvider;
 }
Beispiel #7
0
 public function actionAuth()
 {
     $data = $this->post;
     if ($data['status'] != 3) {
         $date = date('Y-m-d', $data['vo']['create_time']);
         if ($data['type'] == 1) {
             $msg['message'] = '你已被举报,被举报内容:' . $data['vo']['content'] . ';被举报时间:' . $date . ';审核情况:情况属实;处理结果:给予警告一次;如有疑问请拨打客服电话023-68800997。';
         } elseif ($data['type'] == 2) {
             UserInformation::getInstance()->updateUserInfo($data['vo']['feedback_id'], ['report_flag' => 1]);
             $msg['message'] = '你已被举报,被举报内容:' . $data['vo']['content'] . ';被举报时间:' . $date . ';审核情况:情况属实;处理结果:资料卡标记;如有疑问请拨打客服电话023-68800997。';
         } elseif ($data['type'] == 3) {
             UserInformation::getInstance()->updateUserInfo($data['vo']['feedback_id'], ['report_flag' => 1]);
             User::getInstance()->editUserTableInfo($data['vo']['feedback_id'], ['status' => 3]);
             $msg['message'] = '你已被举报,被举报内容:' . $data['vo']['content'] . ';被举报时间:' . $date . ';审核情况:情况属实;处理结果:永久封禁;如有疑问请拨打客服电话023-68800997。';
         }
         // 此处处理发送给被举报人
         $msg['send_user_id'] = isset($_SESSION[USER_SESSION]['member']) ? $_SESSION[USER_SESSION]['member']['id'] : 1;
         $msg['receive_user_id'] = $data['vo']['feedback_id'];
         UserMessage::getInstance()->addMessage($msg);
         // 是否发送给举报人
         if (isset($data['ret']) && $data['ret'] == 'on') {
             $retMsg['send_user_id'] = isset($_SESSION[USER_SESSION]['member']) ? $_SESSION[USER_SESSION]['member']['id'] : 1;
             $retMsg['receive_user_id'] = $data['vo']['user_id'];
             $retMsg['message'] = '感谢您对本网站文明建设的支持,经查证情况属实,我们已对该账号做出相应处理';
             UserMessage::getInstance()->addMessage($retMsg);
         }
     } else {
         // 是否发送给举报人
         if (isset($data['ret']) && $data['ret'] == 'on') {
             $retMsg['send_user_id'] = isset($_SESSION[USER_SESSION]['member']) ? $_SESSION[USER_SESSION]['member']['id'] : 1;
             $retMsg['receive_user_id'] = $data['vo']['user_id'];
             $retMsg['message'] = '感谢您对本网站文明建设的支持,但因证据不足,暂时不予处理';
             UserMessage::getInstance()->addMessage($retMsg);
         }
     }
     if (Feedback::getInstance()->auth($data['id'], $data['status'])) {
         $this->renderAjax(['status' => 1, 'message' => '成功']);
     } else {
         $this->renderAjax(['status' => 0, 'message' => '失败']);
     }
 }
Beispiel #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFeedback()
 {
     return $this->hasOne(Feedback::className(), ['activity_id' => 'id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFeedbacks()
 {
     return $this->hasMany(Feedback::className(), ['category_id' => 'id']);
 }
Beispiel #10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFeedbacks()
 {
     return $this->hasMany(Feedback::className(), ['member_id' => 'member_id']);
 }
Beispiel #11
0
 public function scenarios()
 {
     $scenarios = parent::scenarios();
     $scenarios['create'] = $scenarios['default'];
     return $scenarios;
 }
 public function actionFeedback()
 {
     $model = new Feedback();
     if ($model->load(Yii::$app->request->post(), '') && $model->save()) {
         return ['status' => 'success', 'data' => []];
     } else {
         return ['status' => 'fail', 'data' => ['errors' => $model->getFirstErrors()]];
     }
 }
Beispiel #13
0
 public function actionAddFeedback()
 {
     $user_id = Cookie::getInstance()->getCookie('bhy_id')->value;
     if ($data = Feedback::getInstance()->addFeedback($user_id, $this->get)) {
         $this->renderAjax(['status' => 1, 'data' => $data, 'msg' => '举报成功']);
     } else {
         $this->renderAjax(['status' => 0, 'data' => [], 'msg' => '举报失败']);
     }
 }
 public function actionFeedback()
 {
     $model = new Feedback();
     $success = false;
     if ($model->load($_POST) && $model->validate()) {
         $success = $model->save(false);
     }
     return $this->render('feedback', ['model' => $model, 'success' => $success]);
 }