Couponplanbuylog.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. * (业务已取消)
  19. * Class Admin
  20. * @package app\admin\controller\system
  21. * @ControllerAnnotation(title="消费券购买列表")
  22. */
  23. class Couponplanbuylog extends AdminController
  24. {
  25. use Curd;
  26. public function __construct(App $app)
  27. {
  28. parent::__construct($app);
  29. $this->model = new CouponPlanLogModel();
  30. }
  31. public function index ()
  32. {
  33. if ($this->request->isAjax()) {
  34. if (input('selectFields')) {
  35. return $this->selectList();
  36. }
  37. list($page, $limit, $where) = $this->buildTableParames();
  38. $count = $this->model
  39. ->withJoin(['area', 'plan', 'user'], 'LEFT')
  40. ->where($where)
  41. ->count();
  42. $list = $this->model
  43. ->withJoin(['area', 'plan', 'user'], 'LEFT')
  44. ->where($where)
  45. ->page($page, $limit)
  46. ->order($this->sort)
  47. ->select();
  48. $data = [
  49. 'code' => 0,
  50. 'msg' => '',
  51. 'count' => $count,
  52. 'data' => $list,
  53. ];
  54. return json($data);
  55. }
  56. return $this->fetch();
  57. }
  58. }