Sellerevaluate.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 Sellerevaluate extends BaseSeller {
  17. public function initialize() {
  18. parent::initialize();
  19. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/memberevaluate.lang.php');
  20. }
  21. /**
  22. * 评价列表
  23. */
  24. public function index() {
  25. $evaluategoods_model = model('evaluategoods');
  26. $condition = array();
  27. $goods_name = input('param.goods_name');
  28. if (!empty($goods_name)) {
  29. $condition[]=array('geval_goodsname','like', '%' . $goods_name . '%');
  30. }
  31. $member_name = input('param.member_name');
  32. if (!empty($member_name)) {
  33. $condition[]=array('geval_frommembername','like', '%' . $member_name . '%');
  34. }
  35. $condition[]=array('geval_storeid','=',session('store_id'));
  36. $goodsevallist = $evaluategoods_model->getEvaluategoodsList($condition, 5, 'geval_id desc');
  37. View::assign('show_page',$evaluategoods_model->page_info->render());
  38. View::assign('goodsevallist', $goodsevallist);
  39. /* 设置卖家当前菜单 */
  40. $this->setSellerCurMenu('sellerevaluate');
  41. /* 设置卖家当前栏目 */
  42. $this->setSellerCurItem('index');
  43. return View::fetch($this->template_dir.'index');
  44. }
  45. /**
  46. * 解释来自买家的评价
  47. */
  48. public function explain_save() {
  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. }
  88. ?>