AdminBusinessManageController.php 1008 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\businessmanage\controller;
  3. use app\business\model\BusinessModel;
  4. use cmf\controller\AdminBaseController;
  5. class AdminBusinessManageController extends AdminBaseController
  6. {
  7. /**
  8. * 活动列表
  9. */
  10. public function index()
  11. {
  12. $param = $this->request->param();
  13. //搜索条件
  14. $where = [];
  15. if (!empty($param['keyword'])) {
  16. $where[] = ['title', 'like', "%{$param['keyword']}%"];
  17. }
  18. $list = BusinessModel::where($where)->paginate(10, false, ['query' => $param]);
  19. if (!$list->isEmpty()) {
  20. foreach ($list as $v) {
  21. if (!empty($v['tags'])) {
  22. $v['tags'] = implode(' ',json_decode($v['tags'],true));
  23. }
  24. }
  25. }
  26. $this->assign('keyword', isset($param['keyword']) ? $param['keyword'] : '');
  27. $this->assign('list', $list->items());
  28. $this->assign('page', $list->render());
  29. return $this->fetch();
  30. }
  31. }