|
|
|
@ -176,11 +176,14 @@ class StoreCouponDao extends BaseDao |
|
|
|
|
* @author xaboy |
|
|
|
|
* @day 2020/6/19 |
|
|
|
|
*/ |
|
|
|
|
public function validCoupon($id, $uid) |
|
|
|
|
public function validCoupon($id, $uid, $phone = '') |
|
|
|
|
{ |
|
|
|
|
return $this->validCouponQuery()->when($uid, function (BaseQuery $query, $uid) { |
|
|
|
|
$query->with(['issue' => function (BaseQuery $query) use ($uid) { |
|
|
|
|
return $this->validCouponQuery()->when($uid, function (BaseQuery $query) use($uid, $phone) { |
|
|
|
|
$query->with(['issue' => function (BaseQuery $query) use ($uid, $phone) { |
|
|
|
|
$query->where('uid', $uid); |
|
|
|
|
if($phone){ |
|
|
|
|
$query->whereOr('phone', $phone); |
|
|
|
|
} |
|
|
|
|
}]); |
|
|
|
|
})->where('coupon_id', $id)->find(); |
|
|
|
|
} |
|
|
|
|