shish 6 lat temu
rodzic
commit
977dfb3a8a

+ 2 - 0
app/www/controllers/WxOpenController.php

@@ -2,6 +2,7 @@
 
 namespace www\controllers;
 
+use biz\goods\classes\CategoryClass;
 use biz\merchant\classes\MerchantExtendClass;
 use biz\merchant\services\MerchantService;
 use biz\weixin\services\WxOpenService;
@@ -50,6 +51,7 @@ class WxOpenController extends PublicController
 	//平台没有绑定商家公众号时初始化一个商家 shish 2020.2.11
 	public function actionAddMerchant()
 	{
+		CategoryClass::initCategoryGoods(12362);
 		$return = MerchantService::initOpenMerchant();
 		dd($return);
 	}

+ 22 - 6
biz/goods/classes/CategoryClass.php

@@ -60,19 +60,35 @@ class CategoryClass extends BaseClass
 	//开店初始化分类和商品 shish 2020.2.14
 	public static function initCategoryGoods($merchantId)
 	{
+		$date = date("Y-m-d H:i:s");
 		$list = [
-			'花束' => [],
-			'花篮' => [],
-			'永生花' => [],
+			'花束' => [
+				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 188, 'merchantId' => $merchantId, 'createTime' => $date, 'updateTime' => $date, 'goodsName' => '天使美人1'],
+				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 288, 'merchantId' => $merchantId, 'createTime' => $date, 'updateTime' => $date, 'goodsName' => '天使美人2']
+			],
+			'花篮' => [
+				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 388, 'merchantId' => $merchantId, 'createTime' => $date, 'updateTime' => $date, 'goodsName' => '天使美人3'],
+				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 488, 'merchantId' => $merchantId, 'createTime' => $date, 'updateTime' => $date, 'goodsName' => '天使美人4']
+			],
+			'永生花' => [
+				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 588, 'merchantId' => $merchantId, 'createTime' => $date, 'updateTime' => $date, 'goodsName' => '天使美人5'],
+				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 688, 'merchantId' => $merchantId, 'createTime' => $date, 'updateTime' => $date, 'goodsName' => '天使美人6']
+			],
 			'绿植' => []
 		];
-		foreach ($list as $key => $val) {
+		foreach ($list as $key => $goodsList) {
 			$data = ['categoryName' => $key, 'merchantId' => $merchantId];
 			$cat = self::add($data);
-			if (!empty($val)) {
+			if (!empty($goodsList)) {
 				$categoryId = $cat['id'];
+				foreach ($goodsList as $key => $val) {
+					$goods = GoodsClass::add($val);
+					$goodsId = $goods['id'];
+					$goodsCategoryData = ['cId' => $categoryId, 'gId' => $goodsId, 'merchantId' => $merchantId];
+					GoodsCategoryClass::add($goodsCategoryData);
+				}
 			}
 		}
 	}
-	
+
 }

+ 3 - 1
biz/merchant/classes/MerchantClass.php

@@ -183,7 +183,9 @@ class MerchantClass extends BaseClass
 		//商品图
 		//商品分类
 		//门店数据要更新进去
-		//CategoryClass::initCategoryGoods($merchantId);
+		//商品和分类初始化
+		CategoryClass::initCategoryGoods($merchantId);
+		//微信支付和支付宝支付
 
 		return $merchant;
 	}