shish 6 سال پیش
والد
کامیت
576788aced
2فایلهای تغییر یافته به همراه19 افزوده شده و 6 حذف شده
  1. 8 6
      app/client/controllers/OrderController.php
  2. 11 0
      biz/saas/services/RegionService.php

+ 8 - 6
app/client/controllers/OrderController.php

@@ -25,11 +25,13 @@ class OrderController extends BaseController
 	//下单要用到的相关信息 shish 2019.12.6
 	public function actionOrderRelate()
 	{
-		RegionService::tree();
+		$regionTree = RegionService::tree();
 		$shop = ShopService::getDefaultShopInfo($this->merchant);
 		$freight = MerchantExtendService::getFreight($this->merchantExtend);
+		$out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree];
+		util::success($out);
 	}
-	
+
 	//商城下单操作 shish 2019.12.3
 	public function actionCreateOrder()
 	{
@@ -129,13 +131,13 @@ class OrderController extends BaseController
 		
 		util::success(['orderId' => $orderId, 'totalPrice' => $showPrice, 'couponId' => $couponId]);
 	}
-
+	
 	//余额支付 shish 2019.12.6
 	public function actionBalancePay()
 	{
-
+	
 	}
-
+	
 	//获取商城下单要用的微信支付参数 shish 2019.21.3
 	public function actionWxPay()
 	{
@@ -147,7 +149,7 @@ class OrderController extends BaseController
 		
 		//验证订单有效性
 		OrderService::valid($order, $this->userId);
-
+		
 		$name = isset($order['orderName']) && !empty($order['orderName']) ? $order['orderName'] : '购买商品';
 		$totalFee = $order['actPrice'];
 		$openId = $this->user['openId'];

+ 11 - 0
biz/saas/services/RegionService.php

@@ -1,9 +1,12 @@
 <?php
 
 namespace biz\saas\services;
+
 use biz\base\services\BaseService;
 use biz\saas\classes\RegionBakClass;
+use biz\saas\classes\RegionClass;
 use biz\saas\models\RegionBak;
+use common\components\tree;
 use Yii;
 
 class RegionService extends BaseService
@@ -11,4 +14,12 @@ class RegionService extends BaseService
 
 	public static $baseFile = '\biz\saas\classes\RegionClass';
 
+	//三级联动地址Tree shish 2019.12.6
+	public static function tree()
+	{
+		$region = RegionClass::getAllByCondition([], null, '*');
+		$tree = tree::makeTree($region, ['primary_key' => 'id', 'parent_key' => 'parentId', 'children_key' => 'children',]);
+		return $tree;
+	}
+	
 }