Feedback.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 提建议
  7. */
  8. class Feedback extends Api
  9. {
  10. protected $noNeedLogin = ['typelist'];
  11. protected $noNeedRight = ['*'];
  12. public function typelist(){
  13. $list = Db::name('feedback_type')->select();
  14. $this->success(1,$list);
  15. }
  16. public function addone(){
  17. $type = input('type','');
  18. $info = input('info','');
  19. $images = input('images','');
  20. if(empty($content)){
  21. //$this->error('内容不能为空');
  22. }
  23. if(!empty($images) && strpos($images,',')){
  24. if(count(explode(',',$images)) > 8){
  25. $this->error('一次最多只能上传9张图片');
  26. }
  27. }
  28. $data = [
  29. 'user_id' => $this->auth->id,
  30. 'type' => $type,
  31. 'info' => $info,
  32. 'images' => $images,
  33. 'createtime' => time(),
  34. 'updatetime' => time(),
  35. ];
  36. $id = Db::name('user_feedback')->insertGetId($data);
  37. $this->success('反馈成功');
  38. }
  39. /////////////////////////////////////////////////////////////////////
  40. //我提出的建议
  41. public function lists(){
  42. $list = Db::name('feedback')->where('doctor_id',$this->auth->id)->order('id desc')->autopage()->select();
  43. $list = list_domain_image($list,['images']);
  44. $this->success('success',$list);
  45. }
  46. }