Evaluate.php 5.2 KB

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