UserFeedback.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\user\controller;
  3. use app\common\model\UserMessage;
  4. use library\Controller;
  5. use think\Db;
  6. /**
  7. * 会员反馈
  8. * Class Integral
  9. * @package app\user\controller
  10. */
  11. class UserFeedback extends Controller
  12. {
  13. protected $table ="UserFeedback";
  14. /**
  15. * 反馈变更列表
  16. * @auth true
  17. * @menu true
  18. */
  19. public function index()
  20. {
  21. $this->title = '反馈列表';
  22. $where= [];
  23. if($this->request->request('name')) $where[]= ['m.name','like','%'.$this->request->request('phone').'%'];
  24. $where[]= ['f.is_deleted','=',0];
  25. $query = $this->_query($this->table);
  26. $query->alias('f')
  27. ->field('f.* ,m.headimg,m.name')
  28. ->join('store_member m',' m.id = f.user_id ','LEFT');
  29. if(!empty($where)) $query->where($where);
  30. $query ->order('f.id desc')->page();
  31. }
  32. /**反馈列表处理
  33. * @param array $data
  34. * @throws \think\db\exception\DataNotFoundException
  35. * @throws \think\db\exception\ModelNotFoundException
  36. * @throws \think\exception\DbException
  37. */
  38. protected function _index_page_filter(array &$data)
  39. {
  40. }
  41. /**
  42. * 删除反馈日志
  43. * @auth true
  44. * @menu true
  45. */
  46. public function del()
  47. {
  48. $this->_save($this->table, ['is_deleted' => 1]);
  49. }
  50. /**
  51. * 回复
  52. * @auth true
  53. * @menu true
  54. */
  55. public function edit()
  56. {
  57. $this->title = '回复';
  58. $this->_form($this->table,'form');
  59. }
  60. protected function _form_filter(&$data)
  61. {
  62. $info = \app\common\model\UserFeedback::where('id',$data['id'])->find()->toArray();
  63. UserMessage:: sendUserMessage($info['user_id'],'feedback',1,0,0,$data['id']);
  64. if($data['status'] == 1 && $info['status'] != $data['status']) $data['dispose_time'] = date('Y-m-d H:i:s');
  65. if($data['status'] == 2 && $info['status'] != $data['status']) {
  66. if(!$data['dispose_time']) $data['dispose_time'] = date('Y-m-d H:i:s');
  67. $data['over_time'] = date('Y-m-d H:i:s');
  68. }
  69. }
  70. }