Memberfeedback.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. *
  8. * ============================================================================
  9. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  10. * 网站地址: https://www.valimart.net/
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class Memberfeedback extends BaseMember {
  17. public function initialize() {
  18. parent::initialize(); // TODO: Change the autogenerated stub
  19. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/memberfeedback.lang.php');
  20. }
  21. /*
  22. * 反馈列表
  23. */
  24. public function index() {
  25. $feedback_model = model('feedback');
  26. $condition = array(
  27. 'member_id' => session('member_id')
  28. );
  29. $feedback_list = $feedback_model->getFeedbackList($condition,10);
  30. /* 设置买家当前菜单 */
  31. $this->setMemberCurMenu('member_feedback');
  32. /* 设置买家当前栏目 */
  33. $this->setMemberCurItem('feedback_list');
  34. View::assign('feedback_list', $feedback_list);
  35. View::assign('show_page', $feedback_model->page_info->render());
  36. return View::fetch($this->template_dir . 'index');
  37. }
  38. public function add(){
  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. $menu_array = array(
  76. array(
  77. 'name' => 'feedback_list',
  78. 'text' => lang('feedback_list'),
  79. 'url' => (string)url('Memberfeedback/index')
  80. ),
  81. array(
  82. 'name' => 'feedback_add',
  83. 'text' => lang('feedback_add'),
  84. 'url' => (string)url('Memberfeedback/add'),
  85. )
  86. );
  87. return $menu_array;
  88. }
  89. }