|
|
@@ -30,28 +30,23 @@ class OrderController extends BaseController
|
|
|
public function actionFreight()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
-
|
|
|
$shop = $this->shop;
|
|
|
$shopLat = isset($shop->lat) ? $shop->lat : '';
|
|
|
$shopLong = isset($shop->long) ? $shop->long : '';
|
|
|
-
|
|
|
if (empty($shopLat) || empty($shopLong)) {
|
|
|
util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
|
|
|
}
|
|
|
-
|
|
|
$user = $this->user;
|
|
|
$userLat = $user->lat ?? '';
|
|
|
$userLong = $user->long ?? '';
|
|
|
if (empty($userLat) || empty($userLong)) {
|
|
|
util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
|
|
|
}
|
|
|
-
|
|
|
$weight = $get['weight'] ?? 0;
|
|
|
if (empty($weight)) {
|
|
|
util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
|
|
|
}
|
|
|
-
|
|
|
- $respond = OrderClass::getDistanceFee($user, $shop, $weight);
|
|
|
+ $respond = OrderClass::getDistanceFee($userLat, $userLong, $shopLat, $shopLong, $weight);
|
|
|
util::success($respond);
|
|
|
}
|
|
|
|