Feedback.php 723 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. class Feedback extends Base
  6. {
  7. public function add(){
  8. $data = [
  9. 'content'=>input('content','','trim'),
  10. 'image'=>input('image','','trim'),
  11. 'status'=>input('status',0),
  12. 'create_time'=>date('Y-m-d H:i:s'),
  13. 'user_id'=>$this->userId,
  14. ];
  15. if(!$data['content'] && empty($data['content'])){
  16. HelpHander::error('内容不能为空');
  17. }
  18. $res = db('feedback')->insert($data);
  19. if($res){
  20. HelpHander::success([],'操作成功');
  21. }else{
  22. HelpHander::error('操作失败');
  23. }
  24. }
  25. }