Sfoglia il codice sorgente

运费加进去计算

shish 6 anni fa
parent
commit
396f5c4c81

+ 7 - 6
app/mall/controllers/OrderController.php

@@ -5,6 +5,7 @@ namespace mall\controllers;
 use biz\goods\services\CategoryService;
 use biz\goods\services\GoodsCategoryService;
 use biz\goods\services\GoodsService;
+use biz\merchant\services\ExpressService;
 use biz\merchant\services\MerchantExtendService;
 use biz\merchant\services\MerchantService;
 use biz\merchant\services\ShopService;
@@ -47,7 +48,7 @@ class OrderController extends BaseController
 		}
 		//确认是否要配送的商品
 		$needSend = isset($goodsInfo['needSend']) && $goodsInfo['needSend'] == 1 ? 1 : 0;
-		
+
 		$post['userId'] = $this->userId;
 		$user = $this->user;
 		$post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
@@ -61,20 +62,20 @@ class OrderController extends BaseController
 			util::fail('没有找到门店');
 		}
 		$shopInfo = ShopService::getById($defaultShopId);
-		
+
 		//计算运费
 		$post['sendDistance'] = isset($post['sendDistance']) ? $post['sendDistance'] : 0;
 		$sendCost = 0;
 		if ($needSend == 1) {
 			$lat = $post['receiveLat'];//收货人纬度
 			$lng = $post['receiveLong'];//收货人经度
-			$jsStatDistance = $post['sendDistance'];
-			$sendCost = ShopService::getSendCost($lat, $lng, $jsStatDistance, $shopInfo);
+			$respond = ExpressService::getUserDistance($lng, $lat, $defaultShopId, $this->merchantExtend);
+			$sendCost = isset($respond['fee']) ? $respond['fee'] : 0;
 		}
 		$post['sendCost'] = $sendCost;
 		$post['merchantId'] = $this->merchantId;
 		$post['shopId'] = $defaultShopId;
-		
+
 		//计算总金额
 		$unitPrice = $goodsInfo['price'];
 		$goodsStyleList = isset($goodsInfo['goodsStyleList']) ? $goodsInfo['goodsStyleList'] : [];
@@ -104,7 +105,7 @@ class OrderController extends BaseController
 		$actPrice = $discountData['price'];
 		$post['discountType'] = $discountData['discountType'];
 		$post['discountAmount'] = $discountData['discountAmount'];
-		
+
 		$now = time();
 		$expireTime = $now + 1800;//订单30分钟后过期
 		$post['deadline'] = $expireTime;

+ 4 - 0
console/controllers/UpgradeController.php

@@ -1450,6 +1450,10 @@ ALTER TABLE `xhUserAsset` MODIFY `member` SMALLINT NOT NULL DEFAULT 0 COMMENT '
 ALTER TABLE `xhMerchantAsset` MODIFY `totalOrder` INT NOT NULL DEFAULT 0 COMMENT '总订单数;包括付款和未付款的';";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 
+		$sql = "UPDATE `xhUser` SET `member`=0 WHERE `member`=-1;
+UPDATE `xhUserAsset` SET `member`=0 WHERE `member`=-1;";
+		Yii::$app->db->createCommand($sql)->execute($sql);
+
 	}
 	
 	//数据迁移 shish 2020.1.12