|
|
@@ -340,8 +340,8 @@ class GhsClass extends BaseClass
|
|
|
util::fail('门店未设置所在省市');
|
|
|
}
|
|
|
|
|
|
- // 按省市查找
|
|
|
- $nearbyShops = ShopClass::getAllByCondition(['ptStyle'=>2, 'province'=>$province, 'city'=>$city, 'actTime>=' => strtotime('yesterday')], null, 'id, merchantName, lat, long');
|
|
|
+ // 获取除虚拟外的所有批发店
|
|
|
+ $nearbyShops = ShopClass::getAllByCondition(['ptStyle'=>2, 'live'=>1, 'actTime>=' => strtotime('yesterday')], null, 'id, merchantName, lat, long');
|
|
|
if (empty($nearbyShops)) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -388,8 +388,13 @@ class GhsClass extends BaseClass
|
|
|
|
|
|
// 建立关系并保存距离
|
|
|
foreach ($validNearbyShops as $index => $nearbyShop) {
|
|
|
+ if ($nearbyShop['id'] == $shopId) {
|
|
|
$ghsShopId = $nearbyShop['id'];
|
|
|
$distance = $allDistances[$index] ?? 0;
|
|
|
+ // 距离大于60公里不建立关系
|
|
|
+ if ($distance > 60*1000) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
// 调用 GhsClass::build 建立关系 (返回的 $ghs 包含 id 和 customId)
|
|
|
$ghs = self::build($ghsShopId, $shopId);
|