Feedback.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\model\UserFeedback;
  4. use app\common\model\UserMessage;
  5. /**
  6. * @title 反馈
  7. * @controller Feedback
  8. * @group base
  9. */
  10. class Feedback extends Base
  11. {
  12. public function initialize()
  13. {
  14. parent::initialize();
  15. parent::checkLogin();
  16. }
  17. /**
  18. * @title 用户反馈
  19. * @desc 用户反馈
  20. * @author qc
  21. * @url /api/Feedback/leaveFeedback
  22. * @method POST
  23. * @header name:Authorization require:1 desc:Token
  24. * @param name:content type:string require:1 default:-- desc:反馈内容
  25. * @param name:desc type:string require:1 default:-- desc:反馈说明
  26. */
  27. public function leaveFeedback()
  28. {
  29. $insert_data = [
  30. 'user_id'=>$this->user_id,
  31. 'content'=>input('content'),
  32. 'desc'=>input('desc'),
  33. 'create_at'=>date('Y-m-d H:i:s')
  34. ];
  35. $res = UserFeedback::create($insert_data);
  36. $this->success('反馈成功',$res->id);
  37. }
  38. /**
  39. * @title 用户反馈列表
  40. * @desc 用户反馈列表
  41. * @author qc
  42. * @url /api/Feedback/getFeedbackList
  43. * @method GET
  44. * @header name:Authorization require:1 desc:Token
  45. * @param name:page type:int default:0 desc:页数
  46. * @param name:page_num type:int default:20 desc:每页数
  47. * @return name:content type:string default:-- desc:反馈内容
  48. * @return name:desc type:string default:-- desc:反馈说明
  49. * @return name:status type:int default:-- desc:处理进度【0待处理,1处理中,2已完成】
  50. * @return name:create_at type:string default:-- desc:反馈时间
  51. * @return name:dispose_time type:string default:-- desc:开始处理时间
  52. * @return name:over_time type:string default:-- desc:处理完成时间
  53. * @return name:reply type:string default:-- desc:后台回复
  54. */
  55. public function getFeedbackList()
  56. {
  57. $list = UserFeedback::where(['user_id'=>$this->user_id])
  58. ->limit($this->off_set,$this->page_num)
  59. ->select()->toArray();
  60. $this->success('ok',['list'=>$list]);
  61. }
  62. /**
  63. * @title 用户反馈详情
  64. * @desc 用户反馈详情
  65. * @author qc
  66. * @url /api/Feedback/getFeedbackInfo
  67. * @method GET
  68. * @header name:Authorization require:1 desc:Token
  69. * @param name:id type:int default:0 desc:反馈记录id
  70. * @return name:content type:string default:-- desc:反馈内容
  71. * @return name:desc type:string default:-- desc:反馈说明
  72. * @return name:status type:int default:-- desc:处理进度【0待处理,1处理中,2已完成】
  73. * @return name:create_at type:string default:-- desc:反馈时间
  74. * @return name:dispose_time type:string default:-- desc:开始处理时间
  75. * @return name:over_time type:string default:-- desc:处理完成时间
  76. * @return name:reply type:string default:-- desc:后台回复
  77. */
  78. public function getFeedbackInfo()
  79. {
  80. $id = input('get.id');
  81. $detail = UserFeedback::where(['user_id'=>$this->user_id,'id'=>$id])->find()->toArray();
  82. $this->success('ok',['detail'=>$detail]);
  83. }
  84. }