Browse Source

运费计算

shish 6 years ago
parent
commit
138b5fa4eb

+ 2 - 2
app/mall/controllers/ExpressController.php

@@ -15,14 +15,14 @@ class ExpressController extends BaseController
 	public function actionGetUserDistance()
 	{
 		//经度
-		$lnt = Yii::$app->request->get('lnt', '');
+		$lng = Yii::$app->request->get('lng', '');
 		//纬度
 		$lat = Yii::$app->request->get('lat', '');
 		if (empty($lnt) || empty($lat)) {
 			util::fail('经度或纬度不能为空');
 		}
 		$shopId = ShopService::getDefaultShopId($this->merchant);
-		$respond = ExpressService::getUserDistance($lnt, $lat, $shopId, $this->merchantExtend);
+		$respond = ExpressService::getUserDistance($lng, $lat, $shopId, $this->merchantExtend);
 		util::success($respond);
 	}
 

+ 2 - 2
biz/merchant/services/ExpressService.php

@@ -15,12 +15,12 @@ class ExpressService extends BaseService
 	public static $baseFile = '\biz\merchant\classes\ExpressClass';
 	
 	//计算客户的距离和运费 shish 2020.5.14
-	public static function getUserDistance($lnt, $lat, $shopId, $extend)
+	public static function getUserDistance($lng, $lat, $shopId, $extend)
 	{
 		$shop = ShopClass::getById($shopId);
 		$shopLat = isset($shop['lat']) ? $shop['lat'] : '';
 		$shopLong = isset($shop['long']) ? $shop['long'] : '';
-		$distance = mapUtil::calculateDistance($shopLong, $shopLat, $lnt, $lat);
+		$distance = mapUtil::calculateDistance($shopLong, $shopLat, $lng, $lat);
 		$perKiloFee = isset($extend['freight']) ? $extend['freight'] : 10;
 		$freeDistance = isset($extend['freeDistance']) ? $extend['freeDistance'] : 5;
 		$fee = 0;