settter
parent
378c950f28
commit
43dcb97717
|
@ -344,12 +344,18 @@ class Coupon extends Base
|
|||
$signDistance = config('wechat.signDistance') ?? 0;
|
||||
|
||||
if($signDistance > 0 ){
|
||||
$distance = get_distance($coupon->lat,$coupon->lng,$lat,$lng);
|
||||
$distance = get_distance($coupon->couponMain->lat,$coupon->couponMain->lng,$lat,$lng);
|
||||
if($distance > $signDistance){
|
||||
return $this->json(4001, "您距离商家位置距离超过规定距离{$distance}米");
|
||||
if ($distance >= 1000) {
|
||||
$distance_text = round($distance / 1000, 2) . "千米";
|
||||
} else {
|
||||
$distance_text = $distance . "米";
|
||||
}
|
||||
return $this->json(4001, "您距离商家位置距离超过规定距离{$distance_text}米");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$business = BusinessRepository::getInstance()->getModel()->with(["agency"])->where(["code"=>$coupon->couponMain->business_code])->lock(true)->find();
|
||||
if(empty($business)){
|
||||
return $this->json(4001, "商家不存在");
|
||||
|
|
Loading…
Reference in New Issue