Browse Source

计算运费

shish 1 year ago
parent
commit
be318a7e5a

+ 1 - 1
app-ghs/controllers/ApplyController.php

@@ -189,7 +189,7 @@ class ApplyController extends BaseController
     {
         $regionTree = RegionService::tree();
         $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-        $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
+        $out = ['region' => $regionTree, 'thirdMapKey' => $mapKey];
         util::success($out);
     }
 

+ 1 - 1
app-ghs/controllers/OrderController.php

@@ -2091,7 +2091,7 @@ class OrderController extends BaseController
         $shop = $this->shop->attributes;
         $freight = ['first' => 5, 'add' => 2];
         $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-        $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $shop];
+        $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'thirdMapKey' => $mapKey, 'merchant' => $shop];
         util::success($out);
     }
 

+ 1 - 1
app-ghs/controllers/RegionController.php

@@ -15,7 +15,7 @@ class RegionController extends BaseController
 	{
 		$regionTree = RegionService::tree();
 		$mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-		$out = ['tree' => $regionTree, 'txMapKey' => $mapKey];
+		$out = ['tree' => $regionTree, 'thirdMapKey' => $mapKey];
 		util::success($out);
 	}
 	

+ 1 - 1
app-hd/controllers/ApplyController.php

@@ -301,7 +301,7 @@ class ApplyController extends BaseController
     {
         $regionTree = RegionService::tree();
         $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-        $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
+        $out = ['region' => $regionTree, 'thirdMapKey' => $mapKey];
         util::success($out);
     }
 

+ 11 - 6
app-hd/controllers/OrderController.php

@@ -6,6 +6,7 @@ use biz\shop\classes\ShopExtClass;
 use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
 use bizHd\custom\classes\CustomClass;
+use bizHd\custom\classes\HdClass;
 use bizHd\goods\classes\GoodsClass;
 use bizHd\merchant\services\ShopService;
 use bizHd\order\classes\OrderClass;
@@ -387,16 +388,20 @@ class OrderController extends BaseController
             }
         }
 
-        $customId = isset($post['customId']) && $post['customId'] > 0 ? $post['customId'] : 0;
-        if (empty($customId)) {
-            $customId = $this->shop->defaultCustomId ?? 0;
+        $hdId = $post['hdId'] ?? 0;
+        $hd = HdClass::getById($hdId, true);
+        if (empty($hd)) {
+            util::fail('客户信息缺失');
         }
-        $custom = CustomClass::getById($customId);
+        $hdName = $hd->name ?? '';
+        $post['hdName'] = $hdName;
+        $customId = $hd->customId ?? 0;
+        $custom = CustomClass::getById($customId, true);
         if (empty($custom)) {
             util::fail('没有找到客户哦');
         }
         $post['customId'] = $customId;
-        $customName = $custom['name'] ?? '';
+        $customName = $custom->name ?? '';
         $post['customName'] = $customName;
         $post['customNamePy'] = stringUtil::py($customName);
 
@@ -510,7 +515,7 @@ class OrderController extends BaseController
         $shop = $this->shop->attributes;
         $freight = MerchantExtendService::getFreight($this->sjExtend);
         $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-        $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $shop];
+        $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'thirdMapKey' => $mapKey, 'merchant' => $shop];
         util::success($out);
     }
 

+ 1 - 1
app-hd/controllers/RegionController.php

@@ -15,7 +15,7 @@ class RegionController extends BaseController
     {
         $regionTree = RegionService::tree();
         $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-        $out = ['tree' => $regionTree, 'txMapKey' => $mapKey];
+        $out = ['tree' => $regionTree, 'thirdMapKey' => $mapKey];
         util::success($out);
     }
 

+ 1 - 1
app-mall/controllers/OrderController.php

@@ -371,7 +371,7 @@ class OrderController extends BaseController
 
         $freight = ['first' => 5, 'add' => 2];
         $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-        $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $shop];
+        $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'thirdMapKey' => $mapKey, 'merchant' => $shop];
         util::success($out);
     }
 

+ 1 - 1
app-mall/controllers/RegionController.php

@@ -16,7 +16,7 @@ class RegionController extends BaseController
     {
         $regionTree = RegionService::tree();
         $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-        $out = ['tree' => $regionTree, 'txMapKey' => $mapKey];
+        $out = ['tree' => $regionTree, 'thirdMapKey' => $mapKey];
         util::success($out);
     }
 

+ 1 - 1
biz-hd/order/classes/OrderItemClass.php

@@ -28,7 +28,7 @@ class OrderItemClass extends BaseClass
         $ratio = $data['ratio'] ?? 0;
         $orderSn = $data['orderSn'] ?? '';
         $mainId = $data['mainId'] ?? 0;
-        $customName = $custom['name'] ?? '';
+        $customName = $custom->name ?? '';
         $bigNum = 0;
         $smallNum = 0;
         if ($unitType == dict::getDict('unitType', 'big')) {

+ 2 - 2
biz-hd/order/services/OrderService.php

@@ -31,8 +31,8 @@ class OrderService extends BaseService
     {
         $payWay = $data['payWay'] ?? 0;
         $orderSn = orderSn::getOrderSn();
-        $customId = $custom['id'] ?? 0;
-        $hdId = $custom['hdId'] ?? 0;
+        $customId = $custom->id ?? 0;
+        $hdId = $custom->hdId ?? 0;
         $sjId = $data['sjId'] ?? 0;
         $shopId = $data['shopId'] ?? 0;
         $mainId = $data['mainId'] ?? 0;

+ 9 - 8
common/components/mapUtil.php

@@ -13,23 +13,24 @@ use yii\helpers\Json;
 class mapUtil
 {
 
-    public static $txMapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
+    public static $thirdMapKey = 'fe792548aa6e15ef4d5d501e508eaeae';
 
-    //腾讯地图关键词输入提醒 ssh 2020.1.21
-    //https://lbs.qq.com/webservice_v1/guide-suggestion.html
     public static function suggestion($region, $keyword)
     {
-        $url = "http://apis.map.qq.com/ws/place/v1/suggestion/?region={$region}&keyword={$keyword}&key=" . self::$txMapKey;
+        if (getenv('YII_ENV') == 'production') {
+            $url = "https://restapi.amap.com/v3/assistant/inputtips?city={$region}&keywords={$keyword}&key=" . self::$thirdMapKey;
+        }else{
+            $url = "http://restapi.amap.com/v3/assistant/inputtips?city={$region}&keywords={$keyword}&key=" . self::$thirdMapKey;
+        }
         $curl = new curl\Curl();
         $result = $curl->get($url);
-        $result = Json::decode($result);
-        return $result;
+        return Json::decode($result);
     }
 
     //计算距离 lng经度 lat纬度 ssh 2020.5.14
     public static function calculateDistance($fromLnt, $fromLat, $toLnt, $toLat)
     {
-        $url = "https://apis.map.qq.com/ws/distance/v1/matrix/?mode=driving&from={$fromLat},{$fromLnt}&to={$toLat},{$toLnt}&key=" . self::$txMapKey;
+        $url = "https://apis.map.qq.com/ws/distance/v1/matrix/?mode=driving&from={$fromLat},{$fromLnt}&to={$toLat},{$toLnt}&key=" . self::$thirdMapKey;
         $curl = new curl\Curl();
         $result = $curl->get($url);
         $result = Json::decode($result);
@@ -43,7 +44,7 @@ class mapUtil
     //逆地址解析,根据经纬度解析出中文地址 ssh
     public static function resolveLocation($lat, $long)
     {
-        $url = "https://apis.map.qq.com/ws/geocoder/v1/?location={$lat},{$long}&get_poi=0&key=" . self::$txMapKey;
+        $url = "https://apis.map.qq.com/ws/geocoder/v1/?location={$lat},{$long}&get_poi=0&key=" . self::$thirdMapKey;
         $curl = new curl\Curl();
         $result = $curl->get($url);
         $result = Json::decode($result);