Box.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\admin\controller\box;
  3. use app\admin\logic\BoxLogic;
  4. use app\common\model\BoxModel;
  5. use app\admin\traits\Curd;
  6. use app\common\controller\AdminController;
  7. use EasyAdmin\annotation\ControllerAnnotation;
  8. use EasyAdmin\annotation\NodeAnotation;
  9. use think\App;
  10. /**
  11. * Class Admin
  12. * @package app\admin\controller\system
  13. * @ControllerAnnotation(title="魔盒")
  14. */
  15. class Box extends AdminController
  16. {
  17. use Curd;
  18. public function __construct(App $app)
  19. {
  20. parent::__construct($app);
  21. $this->model = new BoxModel();
  22. }
  23. /**
  24. * @NodeAnotation(title="福袋列表")
  25. */
  26. public function index ()
  27. {
  28. if ($this->request->isAjax()) {
  29. if (input('selectFields')) {
  30. return $this->selectList();
  31. }
  32. list($page, $limit, $where) = $this->buildTableParames();
  33. list($count, $list) = BoxLogic::getList($page, $limit, $where, $this->sort);
  34. $data = [
  35. 'code' => 0,
  36. 'msg' => '',
  37. 'count' => $count,
  38. 'data' => $list,
  39. ];
  40. return json($data);
  41. }
  42. return $this->fetch();
  43. }
  44. }