Evaluate.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. namespace app\admin\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 Evaluate extends AdminControl
  17. {
  18. public function initialize()
  19. {
  20. parent::initialize(); // TODO: Change the autogenerated stub
  21. Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/evaluate.lang.php');
  22. }
  23. /**
  24. * 商品来自买家的评价列表
  25. */
  26. public function evalgoods_list() {
  27. $evaluategoods_model = model('evaluategoods');
  28. $condition = array();
  29. //商品名称
  30. if (input('param.goods_name')) {
  31. $condition[]=array('geval_goodsname','like', '%'.input('param.goods_name').'%');
  32. }
  33. //店铺名称
  34. if (input('param.store_name')) {
  35. $condition[]=array('geval_storename','like', '%'.input('param.store_name').'%');
  36. }
  37. if(input('param.stime')) {
  38. $stime = strtotime(input('param.stime'));
  39. $condition[]=array('geval_addtime','>=', $stime);
  40. }
  41. if(input('param.etime')) {
  42. $etime = strtotime(input('param.etime'))+86399;
  43. $condition[]=array('geval_addtime','<=', $etime);
  44. }
  45. $evalgoods_list = $evaluategoods_model->getEvaluategoodsList($condition, 10);
  46. View::assign('show_page',$evaluategoods_model->page_info->render());
  47. View::assign('evalgoods_list',$evalgoods_list);
  48. View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
  49. $this->setAdminCurItem('evalgoods_list');
  50. return View::fetch('index');
  51. }
  52. /**
  53. * 删除商品评价
  54. */
  55. public function evalgoods_del() {
  56. $geval_id = intval(input('param.geval_id'));
  57. if ($geval_id <= 0) {
  58. ds_json_encode(10001, lang('param_error'));
  59. }
  60. $evaluategoods_model = model('evaluategoods');
  61. $result = $evaluategoods_model->delEvaluategoods(array('geval_id'=>$geval_id));
  62. if ($result) {
  63. $this->log(lang('del_evaluategoods').$geval_id);
  64. ds_json_encode(10000, lang('ds_common_del_succ'));
  65. } else {
  66. ds_json_encode(10001, lang('ds_common_del_fail'));
  67. }
  68. }
  69. /**
  70. * 店铺动态评价列表
  71. */
  72. public function evalstore_list() {
  73. $evaluatestore_model = model('evaluatestore');
  74. $condition = array();
  75. //评价人
  76. if (input('param.from_name')) {
  77. $condition[]=array('seval_membername','like', '%'.input('param.from_name').'%');
  78. }
  79. //店铺名称
  80. if (input('param.store_name')) {
  81. $condition[]=array('seval_storename','like', '%'.input('param.store_name').'%');
  82. }
  83. if(input('param.stime')) {
  84. $stime = strtotime(input('param.stime'));
  85. $condition[]=array('seval_addtime','>=', $stime);
  86. }
  87. if(input('param.etime')) {
  88. $etime = strtotime(input('param.etime'));
  89. $condition[]=array('seval_addtime','<=', $etime);
  90. }
  91. $evalstore_list = $evaluatestore_model->getEvaluatestoreList($condition, 10);
  92. View::assign('show_page',$evaluatestore_model->page_info->render());
  93. View::assign('evalstore_list',$evalstore_list);
  94. $this->setAdminCurItem('evalstore_list');
  95. return View::fetch();
  96. }
  97. /**
  98. * 删除店铺评价
  99. */
  100. public function evalstore_del() {
  101. $seval_id = intval(input('param.seval_id'));
  102. if ($seval_id <= 0) {
  103. ds_json_encode(10001, lang('param_error'));
  104. }
  105. $evaluatestore_model = model('evaluatestore');
  106. $result = $evaluatestore_model->delEvaluatestore(array('seval_id'=>$seval_id));
  107. if ($result) {
  108. $this->log(lang('del_evaluatestore').$seval_id);
  109. ds_json_encode(10000, lang('ds_common_del_succ'));
  110. } else {
  111. ds_json_encode(10001, lang('ds_common_del_fail'));
  112. }
  113. }
  114. protected function getAdminItemList()
  115. {
  116. $menu_array = array(
  117. array(
  118. 'name' => 'evalgoods_list',
  119. 'text' => lang('admin_evaluate_list'),
  120. 'url' => (string)url('Evaluate/evalgoods_list')
  121. ),
  122. array(
  123. 'name' => 'evalstore_list',
  124. 'text' => lang('admin_evalstore_list'),
  125. 'url' => (string)url('Evaluate/evalstore_list')
  126. )
  127. );
  128. return $menu_array;
  129. }
  130. }