Sellerevaluate.php 3.6 KB

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