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