Sellerevaluate.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 Sellerevaluate extends BaseSeller
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize();
  17. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/memberevaluate.lang.php');
  18. }
  19. /**
  20. * 评价列表
  21. */
  22. public function index()
  23. {
  24. $evaluategoods_model = model('evaluategoods');
  25. $condition = array();
  26. $goods_name = input('param.goods_name');
  27. if (!empty($goods_name)) {
  28. $condition[] = array('geval_goodsname', 'like', '%' . $goods_name . '%');
  29. }
  30. $member_name = input('param.member_name');
  31. if (!empty($member_name)) {
  32. $condition[] = array('geval_frommembername', 'like', '%' . $member_name . '%');
  33. }
  34. $condition[] = array('geval_storeid', '=', session('store_id'));
  35. $goodsevallist = $evaluategoods_model->getEvaluategoodsList($condition, 5, 'geval_id desc');
  36. View::assign('show_page', $evaluategoods_model->page_info->render());
  37. View::assign('goodsevallist', $goodsevallist);
  38. /* 设置卖家当前菜单 */
  39. $this->setSellerCurMenu('sellerevaluate');
  40. /* 设置卖家当前栏目 */
  41. $this->setSellerCurItem('index');
  42. return View::fetch($this->template_dir . 'index');
  43. }
  44. /**
  45. * 解释来自买家的评价
  46. */
  47. public function explain_save()
  48. {
  49. $geval_id = intval(input('post.geval_id'));
  50. $geval_explain = trim(input('post.geval_explain'));
  51. //验证表单
  52. if (!$geval_explain) {
  53. $data['result'] = false;
  54. $data['message'] = lang('member_evaluation_explain_nullerror');
  55. echo json_encode($data);
  56. die;
  57. }
  58. $data = array();
  59. $data['result'] = true;
  60. $evaluategoods_model = model('evaluategoods');
  61. $evaluate_info = $evaluategoods_model->getEvaluategoodsInfoByID($geval_id, session('store_id'));
  62. if (empty($evaluate_info)) {
  63. $data['result'] = false;
  64. $data['message'] = lang('param_error');
  65. echo json_encode($data);
  66. die;
  67. }
  68. $update = array('geval_explain' => $geval_explain);
  69. $condition = array('geval_id' => $geval_id);
  70. $result = $evaluategoods_model->editEvaluategoods($update, $condition);
  71. if ($result) {
  72. $data['message'] = lang('ds_common_op_succ');
  73. } else {
  74. $data['result'] = false;
  75. $data['message'] = lang('ds_common_op_fail');
  76. }
  77. echo json_encode($data);
  78. die;
  79. }
  80. protected function getSellerItemList()
  81. {
  82. $menu_array = array(
  83. array('name' => 'index', 'text' => lang('member_evaluation'), 'url' => '##')
  84. );
  85. return $menu_array;
  86. }
  87. }