Commit d05d57a8 by weijiguang

修复点单屏下单校验地址问题

parent 2ccc540f
...@@ -234,11 +234,18 @@ public class OrderServiceImpl implements IOrderService { ...@@ -234,11 +234,18 @@ public class OrderServiceImpl implements IOrderService {
if (!Objects.equals(ShopState.OPEN.getState(), shop.getState()) && !Objects.equals(ShopState.TESTING.getState(), shop.getState())) { if (!Objects.equals(ShopState.OPEN.getState(), shop.getState()) && !Objects.equals(ShopState.TESTING.getState(), shop.getState())) {
throw new ServiceException("店铺当前状态不能下单"); throw new ServiceException("店铺当前状态不能下单");
} }
if (shop.getDistanceLimit() != null && shop.getDistanceLimit() > 0) { try {
double distance = DistanceUtil.getRealDistance(order.getLng().doubleValue(), order.getLat().doubleValue(), Double.parseDouble(shop.getLng()), Double.parseDouble(shop.getLat())); if (order.getSource() != null && order.getSource() == 3) {
if (distance > shop.getDistanceLimit() * 1000) { // 手机下单才校验位置,点单屏下单不校验位置
throw new ServiceException("超过店铺下单的距离范围"); if (shop.getDistanceLimit() != null && shop.getDistanceLimit() > 0) {
double distance = DistanceUtil.getRealDistance(order.getLng().doubleValue(), order.getLat().doubleValue(), Double.parseDouble(shop.getLng()), Double.parseDouble(shop.getLat()));
if (distance > shop.getDistanceLimit() * 1000) {
throw new ServiceException("超过店铺下单的距离范围");
}
}
} }
} catch (Exception e) {
throw new ServiceException("未开启微信软件地理位置权限,请前往系统设置中打开");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment