Prechádzať zdrojové kódy

哪些东西开店需要初始化

shish 6 rokov pred
rodič
commit
5fd228ac6d

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

@@ -146,7 +146,7 @@ class OrderController extends BaseController
 		$shop = ShopService::getDefaultShop($this->merchant);
 		$freight = MerchantExtendService::getFreight($this->merchantExtend);
 		$mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-		$out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey];
+		$out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $this->merchant];
 		util::success($out);
 	}
 	

+ 4 - 73
console/controllers/InitController.php

@@ -25,10 +25,12 @@ use common\services\xhInitService;
 class InitController extends Controller
 {
 	
-	//首次开店初始化 shish 2020.1.19
+	//哪些东西开店时需要初始化
 	public function actionFirstInit()
 	{
-	
+		//CouponAsset优惠券资产
+		//初始化微信菜单
+		//模板消息
 	}
 	
 	//二次初始化 shish 2020.1.19
@@ -269,75 +271,4 @@ TRUNCATE xhUserByDay;";
 		}
 	}
 	
-	/**
-	 * 初始化 花卉宝 的行政区划
-	 * ./yii init/district
-	 */
-	public function actionDistrict()
-	{
-		set_time_limit(0);
-		$connection = Yii::$app->db;
-		$sql = 'truncate xhDistrict';
-		$connection->createCommand($sql)->execute();
-		$url = 'http://apis.map.qq.com/ws/district/v1/list?key=OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
-		$curl = new curl\Curl();
-		$result = $curl->get($url);
-		$r = json_decode($result, true);
-		if (!empty($r)) {
-			$onelist = $r['result'][0];
-			$twolist = $r['result'][1];
-			$threelist = $r['result'][2];
-			foreach ($onelist as $oneKey => $oneVal) {
-				$topId = $oneVal['id'];
-				$name = isset($oneVal['name']) ? $oneVal['name'] : '';
-				$fullname = $oneVal['fullname'];
-				$lat = (string)$oneVal['location']['lat'];
-				$lng = (string)$oneVal['location']['lng'];
-				$oneData = ['districtId' => $topId, 'name' => $name, 'fullName' => $fullname, 'locationLat' => $lat, 'locationLng' => $lng, 'parentId' => 0];
-				echo "<p>1级菜单:</p>\n";
-				print_r($oneData);
-				echo "\n";
-				$oneObj = xhDistrict::add($oneData);
-				if (isset($oneVal['cidx'])) {
-					$onecidx = $oneVal['cidx'];
-					if (isset($onecidx[0]) && isset($onecidx[1])) {
-						echo "<p>2级菜单序号: | {$onecidx[0]} {$onecidx[1]}</p>\n";
-						for ($xx = $onecidx[0]; $xx <= $onecidx[1]; $xx++) {
-							$twoVal = $twolist[$xx];
-							$id = $twoVal['id'];
-							$name = isset($twoVal['name']) ? $twoVal['name'] : '';
-							$fullname = $twoVal['fullname'];
-							$lat = (string)$twoVal['location']['lat'];
-							$lng = (string)$twoVal['location']['lng'];
-							$twoData = ['districtId' => $id, 'name' => $name, 'fullName' => $fullname, 'locationLat' => $lat, 'locationLng' => $lng, 'parentId' => $oneObj['id']];
-							echo $xx;
-							print_r($twoData);
-							echo "\n";
-							$twoObj = xhDistrict::add($twoData);
-							if (isset($twoVal['cidx'])) {
-								$twocidx = $twoVal['cidx'];
-								if (isset($twocidx[0]) && isset($twocidx[1])) {
-									echo "<p>3级菜单序号: | {$twocidx[0]} {$twocidx[1]}</p>\n";
-									for ($incr = $twocidx[0]; $incr <= $twocidx[1]; $incr++) {
-										$threeVal = $threelist[$incr];
-										$id = $threeVal['id'];
-										$name = isset($threeVal['name']) ? $threeVal['name'] : '';
-										$fullname = $threeVal['fullname'];
-										$lat = (string)$threeVal['location']['lat'];
-										$lng = (string)$threeVal['location']['lng'];
-										$threeData = ['districtId' => $id, 'name' => $name, 'fullName' => $fullname, 'locationLat' => $lat, 'locationLng' => $lng, 'parentId' => $twoObj['id']];
-										$threeObj = xhDistrict::add($threeData);
-										echo $incr;
-										print_r($threeData);
-										echo "\n";
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	
 }