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.
42 lines
1.1 KiB
42 lines
1.1 KiB
<?php
|
|
|
|
namespace App\Service;
|
|
|
|
use Hyperf\DbConnection\Db;
|
|
use Hyperf\HttpServer\Contract\RequestInterface;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Hyperf\Paginator\Paginator;
|
|
|
|
class CouponRebate implements CouponRebateInterface
|
|
{
|
|
|
|
public function isCouponRebate($user_id)
|
|
{
|
|
$res = Db::table('ims_system_coupon_user as u')
|
|
->leftjoin('ims_system_coupon_user_receive as r','u.id','=','r.system_coupon_user_id')
|
|
->where([
|
|
['r.user_id','=',$user_id],
|
|
['r.receive_type','=',4],
|
|
['u.active_type','=',2],
|
|
])
|
|
->select('r.id')
|
|
->first();
|
|
return $res;
|
|
}
|
|
|
|
public function getActiveInfo()
|
|
{
|
|
$time = time();
|
|
$res = Db::table('ims_system_coupon_user')
|
|
->where([
|
|
['status','=',1],
|
|
['active_type','=',2],
|
|
['start_time','<=',$time],
|
|
['end_time','>',$time],
|
|
])
|
|
->whereRaw('inventory > inventory_use')
|
|
->get();
|
|
return $res;
|
|
}
|
|
|
|
}
|