|
@@ -36,6 +36,7 @@ use Yii;
|
|
|
class PurchaseClass extends BaseClass
|
|
class PurchaseClass extends BaseClass
|
|
|
{
|
|
{
|
|
|
use OrderTrait;
|
|
use OrderTrait;
|
|
|
|
|
+
|
|
|
public static $baseFile = '\bizHd\purchase\models\Purchase';
|
|
public static $baseFile = '\bizHd\purchase\models\Purchase';
|
|
|
|
|
|
|
|
//订单状态 1待付款,待确认,2待配送,3配送中,4已完成,5取消,失败
|
|
//订单状态 1待付款,待确认,2待配送,3配送中,4已完成,5取消,失败
|
|
@@ -60,6 +61,27 @@ class PurchaseClass extends BaseClass
|
|
|
const REFUND_NO = 1;
|
|
const REFUND_NO = 1;
|
|
|
const REFUND_YES = 2;
|
|
const REFUND_YES = 2;
|
|
|
|
|
|
|
|
|
|
+ public static function notSameCity($shop, $ghsShop)
|
|
|
|
|
+ {
|
|
|
|
|
+ $shopLat = $shop->lat ?? '';
|
|
|
|
|
+ $shopLong = $shop->long ?? '';
|
|
|
|
|
+ if (empty($shopLat) || empty($shopLong)) {
|
|
|
|
|
+ util::fail('请完善门店地址');
|
|
|
|
|
+ }
|
|
|
|
|
+ $ghsShopLat = $ghsShop->lat ?? '';
|
|
|
|
|
+ $ghsShopLong = $ghsShop->long ?? '';
|
|
|
|
|
+ if (empty($ghsShopLat) || empty($ghsShopLong)) {
|
|
|
|
|
+ util::fail('商家地址有问题');
|
|
|
|
|
+ }
|
|
|
|
|
+ $distance = mapUtil::calculateDistance($shopLong, $shopLat, $ghsShopLong, $ghsShopLat);
|
|
|
|
|
+ $formatDistance = ceil($distance / 1000);
|
|
|
|
|
+ noticeUtil::push("同城距离:" . $formatDistance, '15280215347');
|
|
|
|
|
+ if($formatDistance > 200){
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//计算距离和运费【另外还有个地方要同步修改,关键词calc_freight_distance】 ssh 20221003
|
|
//计算距离和运费【另外还有个地方要同步修改,关键词calc_freight_distance】 ssh 20221003
|
|
|
public static function getDistanceFee($shop, $ghsShop, $weight)
|
|
public static function getDistanceFee($shop, $ghsShop, $weight)
|
|
|
{
|
|
{
|