| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace mall\controllers;
- use bizMall\order\classes\OrderClass;
- use common\components\dict;
- use Yii;
- use common\components\util;
- class ExpressController extends BaseController
- {
- //计算距离和运费【另外还有个地方要同步修改,关键词calc_freight_distance】 ssh 20221003
- public function actionGetUserDistance()
- {
- $get = Yii::$app->request->get();
- $lng = $get['lng'] ?? '';
- $lat = $get['lat'] ?? '';
- //花束重量默认1.5
- $weight = 1.5;
- if (empty($lng) || empty($lat)) {
- util::fail('请填写收花地址吧');
- }
- $shop = $this->shop;
- $shopLong = $shop->long ?? '';
- $shopLat = $shop->lat ?? '';
- if (empty($shopLong) || empty($shopLat)) {
- util::fail('门店地址有问题');
- }
- $respond = OrderClass::getDistanceFee($lat, $lng, $shopLat, $shopLong, $weight);
- $distance = $respond['distance'] ?? 0;
- $showDistance = $respond['showDistance'] ?? 0;
- $fee = $respond['fee'] ?? 0;
- util::success(['distance' => $distance, 'showDistance' => $showDistance, 'fee' => $fee]);
- }
- // 获取字典中的 hasMap
- public function actionGetHasMap()
- {
- // 补充店铺信息
- $shop = [];
- $intraCityRet = \biz\shop\classes\ShopClass::hasIntraCity($this->shop);
- $shop['openIntraCity'] = $intraCityRet['openIntraCity'];
- $shop['hcFreeKm'] = $intraCityRet['hcFreeKm'];
- $shop['hcMap'] = $intraCityRet['hcMap'];
- $shop['hsFreeKm'] = $intraCityRet['hsFreeKm'];
- $shop['hsAddFee'] = $intraCityRet['hsAddFee'];
- util::success(['hasMap' => dict::getDict('hasMap'), 'shop'=>$shop]);
- }
- }
|