master
wangxinglong 2021-12-20 14:44:40 +08:00
parent 378c950f28
commit 43dcb97717
1 changed files with 8 additions and 2 deletions

View File

@ -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, "商家不存在");