'review'], ]; } public function delete() { if(!$this->validate()){ return $this->getModelError(); } if(is_array($this->feedback_id)){ foreach ($this->feedback_id as $feedback_id){ $model = Feedback::find() ->where([ 'id' => $feedback_id, 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id ]) ->andFilterWhere([ 'user_id' => $this->user_id, ])->one(); if($model == null) continue; $model->is_delete = 1; if(!$model->save()){ return $this->getModelError($model); } } } else { $model = Feedback::find() ->where([ 'id' => $this->feedback_id, 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id ]) ->andFilterWhere([ 'user_id' => $this->user_id, ])->one(); if($model == null){ return $this->apiReturnError('反馈不存在或已经删除'); } $model->is_delete = 1; if(!$model->save()){ return $this->getModelError($model); } } return $this->apiReturnSuccess("删除成功"); } public function review() { if(!$this->validate()){ return $this->getModelError(); } if(is_array($this->feedback_id)){ foreach ($this->feedback_id as $feedback_id){ $model = Feedback::find() ->where([ 'id' => $feedback_id, 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id, 'review_status' => Feedback::REVIEW_STATUS_WAITTING ]) ->andFilterWhere([ 'user_id' => null, ])->one(); if($model == null) continue; $model->review_user_id = $this->user_id; $model->review_status = Feedback::REVIEW_STATUS_DONE; $model->review_time = time(); $model->review_comment = $this->review_comment; if(!$model->save()){ return $this->getModelError($model); } } } else { $model = Feedback::find() ->where([ 'id' => $this->feedback_id, 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id, 'review_status' => Feedback::REVIEW_STATUS_WAITTING ]) ->andFilterWhere([ 'user_id' => null, ])->one(); if($model == null){ return $this->apiReturnError('反馈不存在或已经删除'); } $model->review_user_id = $this->user_id; $model->review_status = Feedback::REVIEW_STATUS_DONE; $model->review_time = time(); $model->review_comment = $this->review_comment; if(!$model->save()){ return $this->getModelError($model); } } return $this->apiReturnSuccess("操作成功"); } }