You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Service;
  3. use Hyperf\DbConnection\Db;
  4. use Hyperf\HttpServer\Contract\RequestInterface;
  5. use Hyperf\Di\Annotation\Inject;
  6. use Hyperf\Paginator\Paginator;
  7. class CouponRebate implements CouponRebateInterface
  8. {
  9. public function isCouponRebate($user_id)
  10. {
  11. $res = Db::table('ims_system_coupon_user as u')
  12. ->leftjoin('ims_system_coupon_user_receive as r','u.id','=','r.system_coupon_user_id')
  13. ->where([
  14. ['r.user_id','=',$user_id],
  15. ['r.receive_type','=',4],
  16. ['u.active_type','=',2],
  17. ])
  18. ->select('r.id')
  19. ->first();
  20. return $res;
  21. }
  22. public function getActiveInfo()
  23. {
  24. $time = time();
  25. $res = Db::table('ims_system_coupon_user')
  26. ->where([
  27. ['status','=',1],
  28. ['active_type','=',2],
  29. ['start_time','<=',$time],
  30. ['end_time','>',$time],
  31. ])
  32. ->whereRaw('inventory > inventory_use')
  33. ->get();
  34. return $res;
  35. }
  36. }