Evaluate.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. *
  7. *
  8. * ----------------------------------------------------------------------------
  9. *
  10. * 控制器
  11. */
  12. class Evaluate extends AdminControl
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize(); // TODO: Change the autogenerated stub
  17. Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/evaluate.lang.php');
  18. }
  19. /**
  20. * 商品来自买家的评价列表
  21. */
  22. public function evalgoods_list()
  23. {
  24. $evaluategoods_model = model('evaluategoods');
  25. $condition = array();
  26. //商品名称
  27. if (input('param.goods_name')) {
  28. $condition[] = array('geval_goodsname', 'like', '%' . input('param.goods_name') . '%');
  29. }
  30. //店铺名称
  31. if (input('param.store_name')) {
  32. $condition[] = array('geval_storename', 'like', '%' . input('param.store_name') . '%');
  33. }
  34. if (input('param.stime')) {
  35. $stime = strtotime(input('param.stime'));
  36. $condition[] = array('geval_addtime', '>=', $stime);
  37. }
  38. if (input('param.etime')) {
  39. $etime = strtotime(input('param.etime')) + 86399;
  40. $condition[] = array('geval_addtime', '<=', $etime);
  41. }
  42. $evalgoods_list = $evaluategoods_model->getEvaluategoodsList($condition, 10);
  43. View::assign('show_page', $evaluategoods_model->page_info->render());
  44. View::assign('evalgoods_list', $evalgoods_list);
  45. View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
  46. $this->setAdminCurItem('evalgoods_list');
  47. return View::fetch('index');
  48. }
  49. /**
  50. * 删除商品评价
  51. */
  52. public function evalgoods_del()
  53. {
  54. $geval_id = intval(input('param.geval_id'));
  55. if ($geval_id <= 0) {
  56. ds_json_encode(10001, lang('param_error'));
  57. }
  58. $evaluategoods_model = model('evaluategoods');
  59. $result = $evaluategoods_model->delEvaluategoods(array('geval_id' => $geval_id));
  60. if ($result) {
  61. $this->log(lang('del_evaluategoods') . $geval_id);
  62. ds_json_encode(10000, lang('ds_common_del_succ'));
  63. } else {
  64. ds_json_encode(10001, lang('ds_common_del_fail'));
  65. }
  66. }
  67. /**
  68. * 店铺动态评价列表
  69. */
  70. public function evalstore_list()
  71. {
  72. $evaluatestore_model = model('evaluatestore');
  73. $condition = array();
  74. //评价人
  75. if (input('param.from_name')) {
  76. $condition[] = array('seval_membername', 'like', '%' . input('param.from_name') . '%');
  77. }
  78. //店铺名称
  79. if (input('param.store_name')) {
  80. $condition[] = array('seval_storename', 'like', '%' . input('param.store_name') . '%');
  81. }
  82. if (input('param.stime')) {
  83. $stime = strtotime(input('param.stime'));
  84. $condition[] = array('seval_addtime', '>=', $stime);
  85. }
  86. if (input('param.etime')) {
  87. $etime = strtotime(input('param.etime'));
  88. $condition[] = array('seval_addtime', '<=', $etime);
  89. }
  90. $evalstore_list = $evaluatestore_model->getEvaluatestoreList($condition, 10);
  91. View::assign('show_page', $evaluatestore_model->page_info->render());
  92. View::assign('evalstore_list', $evalstore_list);
  93. $this->setAdminCurItem('evalstore_list');
  94. return View::fetch();
  95. }
  96. /**
  97. * 删除店铺评价
  98. */
  99. public function evalstore_del()
  100. {
  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. }