Couponplanbuylog.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace app\admin\controller\coupon;
  3. use app\admin\model\SystemAdmin;
  4. use app\common\model\CouponAreaModel;
  5. use app\common\model\CouponPlanLogModel;
  6. use app\common\model\CouponPlanModel;
  7. use app\common\model\ShopCategory;
  8. use app\admin\traits\Curd;
  9. use app\common\controller\AdminController;
  10. use app\common\model\ThirddataLogModel;
  11. use app\common\model\ThirddataModel;
  12. use EasyAdmin\annotation\ControllerAnnotation;
  13. use EasyAdmin\annotation\NodeAnotation;
  14. use think\App;
  15. use think\facade\Db;
  16. use think\Model;
  17. /**
  18. * Class Admin
  19. * @package app\admin\controller\system
  20. * @ControllerAnnotation(title="消费券购买列表")
  21. */
  22. class Couponplanbuylog extends AdminController
  23. {
  24. use Curd;
  25. public function __construct(App $app)
  26. {
  27. parent::__construct($app);
  28. $this->model = new CouponPlanLogModel();
  29. }
  30. public function index ()
  31. {
  32. if ($this->request->isAjax()) {
  33. if (input('selectFields')) {
  34. return $this->selectList();
  35. }
  36. list($page, $limit, $where) = $this->buildTableParames();
  37. $count = $this->model
  38. ->withJoin(['area', 'plan', 'user'], 'LEFT')
  39. ->where($where)
  40. ->count();
  41. $list = $this->model
  42. ->withJoin(['area', 'plan', 'user'], 'LEFT')
  43. ->where($where)
  44. ->page($page, $limit)
  45. ->order($this->sort)
  46. ->select();
  47. $data = [
  48. 'code' => 0,
  49. 'msg' => '',
  50. 'count' => $count,
  51. 'data' => $list,
  52. ];
  53. return json($data);
  54. }
  55. return $this->fetch();
  56. }
  57. }