Memberfeedback.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. * DSMall多用户商城
  8. * ============================================================================
  9. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  10. * 网站地址: http://www.csdeshang.com
  11. * ----------------------------------------------------------------------------
  12. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  13. * 不允许对程序代码以任何形式任何目的的再发布。
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Memberfeedback extends BaseMember {
  18. public function initialize() {
  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. $feedback_model = model('feedback');
  27. $condition = array(
  28. 'member_id' => session('member_id')
  29. );
  30. $feedback_list = $feedback_model->getFeedbackList($condition,10);
  31. /* 设置买家当前菜单 */
  32. $this->setMemberCurMenu('member_feedback');
  33. /* 设置买家当前栏目 */
  34. $this->setMemberCurItem('feedback_list');
  35. View::assign('feedback_list', $feedback_list);
  36. View::assign('show_page', $feedback_model->page_info->render());
  37. return View::fetch($this->template_dir . 'index');
  38. }
  39. public function add(){
  40. if (request()->isPost()) {
  41. $feedback_model = model('feedback');
  42. $param = array();
  43. $param['fb_content'] = input('param.fb_content');
  44. $param['fb_type'] = 2;
  45. $param['fb_time'] = TIMESTAMP;
  46. $param['member_id'] = session('member_id');
  47. $param['member_name'] = session('member_name');
  48. $res=word_filter($param['fb_content']);
  49. if(!$res['code']){
  50. ds_json_encode(10001,$res['msg']);
  51. }
  52. $param['fb_content']=$res['data']['text'];
  53. $result = $feedback_model->addFeedback($param);
  54. if ($result) {
  55. ds_json_encode(10000, lang('ds_common_op_succ'));
  56. } else {
  57. ds_json_encode(10001, lang('ds_common_op_fail'));
  58. }
  59. }else{
  60. $this->setMemberCurMenu('member_feedback');
  61. /* 设置买家当前栏目 */
  62. $this->setMemberCurItem('feedback_add');
  63. return View::fetch($this->template_dir . 'add');
  64. }
  65. }
  66. /**
  67. * 用户中心右边,小导航
  68. *
  69. * @param string $menu_type 导航类型
  70. * @param string $menu_key 当前导航的menu_key
  71. * @param array $array 附加菜单
  72. *
  73. * @return
  74. */
  75. public function getMemberItemList() {
  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. }