Memberfeedback.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. *
  7. *
  8. * ----------------------------------------------------------------------------
  9. *
  10. * 控制器
  11. */
  12. class Memberfeedback extends BaseMember
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize(); // TODO: Change the autogenerated stub
  17. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/memberfeedback.lang.php');
  18. }
  19. /*
  20. * 反馈列表
  21. */
  22. public function index()
  23. {
  24. $feedback_model = model('feedback');
  25. $condition = array(
  26. 'member_id' => session('member_id')
  27. );
  28. $feedback_list = $feedback_model->getFeedbackList($condition, 10);
  29. /* 设置买家当前菜单 */
  30. $this->setMemberCurMenu('member_feedback');
  31. /* 设置买家当前栏目 */
  32. $this->setMemberCurItem('feedback_list');
  33. View::assign('feedback_list', $feedback_list);
  34. View::assign('show_page', $feedback_model->page_info->render());
  35. return View::fetch($this->template_dir . 'index');
  36. }
  37. public function add()
  38. {
  39. if (request()->isPost()) {
  40. $feedback_model = model('feedback');
  41. $param = array();
  42. $param['fb_content'] = input('param.fb_content');
  43. $param['fb_type'] = 2;
  44. $param['fb_time'] = TIMESTAMP;
  45. $param['member_id'] = session('member_id');
  46. $param['member_name'] = session('member_name');
  47. $res = word_filter($param['fb_content']);
  48. if (!$res['code']) {
  49. ds_json_encode(10001, $res['msg']);
  50. }
  51. $param['fb_content'] = $res['data']['text'];
  52. $result = $feedback_model->addFeedback($param);
  53. if ($result) {
  54. ds_json_encode(10000, lang('ds_common_op_succ'));
  55. } else {
  56. ds_json_encode(10001, lang('ds_common_op_fail'));
  57. }
  58. } else {
  59. $this->setMemberCurMenu('member_feedback');
  60. /* 设置买家当前栏目 */
  61. $this->setMemberCurItem('feedback_add');
  62. return View::fetch($this->template_dir . 'add');
  63. }
  64. }
  65. /**
  66. * 用户中心右边,小导航
  67. *
  68. * @param string $menu_type 导航类型
  69. * @param string $menu_key 当前导航的menu_key
  70. * @param array $array 附加菜单
  71. *
  72. * @return
  73. */
  74. public function getMemberItemList()
  75. {
  76. $menu_array = array(
  77. array(
  78. 'name' => 'feedback_list',
  79. 'text' => lang('feedback_list'),
  80. 'url' => (string)url('Memberfeedback/index')
  81. ),
  82. array(
  83. 'name' => 'feedback_add',
  84. 'text' => lang('feedback_add'),
  85. 'url' => (string)url('Memberfeedback/add'),
  86. )
  87. );
  88. return $menu_array;
  89. }
  90. }