Coupon.php 809 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\admin\controller\shopro\user;
  3. use app\admin\controller\shopro\Common;
  4. use app\admin\model\shopro\order\Order;
  5. use app\admin\model\shopro\user\Coupon as UserCouponModel;
  6. class Coupon extends Common
  7. {
  8. protected $model = null;
  9. public function _initialize()
  10. {
  11. parent::_initialize();
  12. $this->model = new UserCouponModel;
  13. }
  14. public function index()
  15. {
  16. if (!$this->request->isAjax()) {
  17. return $this->view->fetch();
  18. }
  19. $coupon_id = $this->request->param('coupon_id');
  20. $coupons = $this->model->sheepFilter()->with(['user', 'order'])
  21. ->where('coupon_id', $coupon_id)
  22. ->paginate($this->request->param('list_rows', 10));
  23. $this->success('获取成功', null, $coupons);
  24. }
  25. }