shish vor 4 Jahren
Ursprung
Commit
eeb57f5d71

+ 5 - 6
app-ghs/controllers/ShopController.php

@@ -103,20 +103,19 @@ class ShopController extends BaseController
         $data['sjId'] = $this->sjId;
         $data['shopId'] = $this->shopId;
         $data['adminId'] = $this->adminId;
-        //$data['img'] = is_array($data['img']) ? json_encode($data['img']) : $data['img'];
-
         if (isset($data['shopName']) == false || empty($data['shopName'])) {
             util::fail('请填写门店名称');
         }
-        $sj = $this->sj->attributes;
-        $sjName = $sj['name'] ?? '';
-        $ptStyle = $sj['style'] ?? dict::getDict('ptStyle', 'hd');
+        $sj = $this->sj;
+        $sjName = $sj->name ?? '';
+        $ptStyle = $sj->style ?? dict::getDict('ptStyle', 'hd');
         $data['ptStyle'] = $ptStyle;
         $data['merchantName'] = $sjName;
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
-            \biz\shop\classes\ShopClass::addShop($data);
+            //批发商添加门店
+            ShopClass::addMainShop($data, $this->shop, $this->sj);
             $transaction->commit();
             util::complete();
         } catch (\Exception $exception) {

+ 5 - 5
app-hd/controllers/ShopController.php

@@ -56,19 +56,19 @@ class ShopController extends BaseController
         $data['sjId'] = $this->sjId;
         $data['shopId'] = $this->shopId;
         $data['adminId'] = $this->adminId;
-        $data['img'] = is_array($data['img']) ? json_encode($data['img']) : $data['img'];
         if (isset($data['shopName']) == false || empty($data['shopName'])) {
             util::fail('请填写门店名称');
         }
-        $sj = $this->sj->attributes;
-        $sjName = $sj['name'] ?? '';
+        $sj = $this->sj;
+        $sjName = $sj->name ?? '';
         $data['merchantName'] = $sjName;
-        $ptStyle = $sj['style'] ?? dict::getDict('ptStyle', 'hd');
+        $ptStyle = $sj->style ?? dict::getDict('ptStyle', 'hd');
         $data['ptStyle'] = $ptStyle;
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
-            ShopClass::addShop($data);
+            //零售添加门店
+            \bizHd\merchant\classes\ShopClass::addMainShop($data, $this->shop, $this->sj);
             $transaction->commit();
             util::complete();
         } catch (\Exception $exception) {

+ 21 - 20
biz-ghs/admin/classes/AdminClass.php

@@ -64,34 +64,35 @@ class AdminClass extends BaseClass
     }
 
     //开店时初始化员工和角色
-    public static function initAdmin($applyData, $mainId, $shop, $shop2 = null)
+    public static function initAdmin($initData, $mainId, $shop, $shop2 = null)
     {
         $shopId = $shop->id ?? 0;
-        $mobile = $applyData['mobile'] ?? 0;
-        $adminId = $applyData['adminId'] ?? 0;
+        $mobile = $initData['mobile'] ?? 0;
+        $adminId = $initData['adminId'] ?? 0;
         AdminRoleClass::addAdminRole(['roleName' => '员工', 'mainId' => $mainId, 'auth' => '']);
         $roleReturn = AdminRoleClass::addAdminRole(['roleName' => '店长', 'num' => 1, 'mainId' => $mainId, 'auth' => '*']);
         $roleId = $roleReturn['id'];
         $admin = \biz\admin\classes\AdminClass::getById($adminId, true);
-        if (!empty($admin)) {
-            $ptStyle = $applyData['style'] ?? dict::getDict('ptStyle', 'hd');
-            if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
-                $admin->openShop = 3;
-                $admin->currentShopId = $shopId;
-                if (!empty($shop2)) {
-                    $admin->openGhsShop = 3;
-                    $admin->currentGhsShopId = $shop2->id ?? 0;
-                }
-                $admin->save();
-            } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
+        if (empty($admin)) {
+            util::fail('没有找到管理员信息');
+        }
+        $ptStyle = Yii::$app->params['ptStyle'];
+        if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
+            $admin->openShop = 3;
+            $admin->currentShopId = $shopId;
+            if (!empty($shop2)) {
                 $admin->openGhsShop = 3;
-                $admin->currentGhsShopId = $shopId;
-                if (!empty($shop2)) {
-                    $admin->openShop = 3;
-                    $admin->currentShopId = $shop2->id ?? 0;
-                }
-                $admin->save();
+                $admin->currentGhsShopId = $shop2->id ?? 0;
+            }
+            $admin->save();
+        } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
+            $admin->openGhsShop = 3;
+            $admin->currentGhsShopId = $shopId;
+            if (!empty($shop2)) {
+                $admin->openShop = 3;
+                $admin->currentShopId = $shop2->id ?? 0;
             }
+            $admin->save();
         }
         $avatar = $admin->avatar;
         $name = $admin->name;

+ 30 - 0
biz-ghs/item/services/ItemService.php

@@ -112,6 +112,36 @@ class ItemService extends BaseService
         }
     }
 
+    //从首店复制花材和分类 ssh 20220522
+    public static function copyItem($oldMainId, $newMainId)
+    {
+        $classList = ItemClassClass::getAllByCondition(['mainId' => $oldMainId], null, '*');
+        $classMap = [];
+        if (!empty($classList)) {
+            foreach ($classList as $class) {
+                $preId = $class['id'] ?? 0;
+                $class['mainId'] = $newMainId;
+                unset($class['addTime']);
+                unset($class['updateTime']);
+                $ret = ItemClassClass::add($class, true);
+                $newId = $ret->id ?? 0;
+                $classMap[$preId] = $newId;
+            }
+        }
+        $itemList = ItemClass::getAllByCondition(['mainId' => $oldMainId], null, '*');
+        if (!empty($itemList)) {
+            foreach ($itemList as $item) {
+                unset($item['stock']);
+                unset($item['addTime']);
+                unset($item['updateTime']);
+                $preId = $item['classId'] ?? 0;
+                $newId = $classMap[$preId] ?? 0;
+                $item['classId'] = $newId;
+                ItemClass::add($item);
+            }
+        }
+    }
+
     //初始化 花材 ghsItemClass, ghsItem  ghsProduct  lqh 2021.4.12  modify ssh 20210711
     public static function initItem($mainId)
     {

+ 54 - 7
biz-ghs/merchant/classes/ShopClass.php

@@ -14,6 +14,7 @@ use bizHd\saas\classes\ApplyClass;
 use common\components\dict;
 use common\components\httpUtil;
 use common\components\qrCodeUtil;
+use common\components\stringUtil;
 use common\components\util;
 use Yii;
 use bizHd\base\classes\BaseClass;
@@ -24,6 +25,58 @@ class ShopClass extends BaseClass
 
     public static $baseFile = '\bizGhs\merchant\models\Shop';
 
+    public static function addMainShop($data, $oldShop, $sj)
+    {
+        if (isset($oldShop->lsShopId) == false || empty($oldShop->lsShopId)) {
+            util::fail('本店请先绑定零售店');
+        }
+        $mobile = $data['mobile'] ?? 0;
+        if (empty($mobile) || stringUtil::isMobile($mobile) == false) {
+            util::fail('请输入正确手机号');
+        }
+        $hasShop = ShopClass::getByCondition(['mobile' => $mobile], true);
+        if (!empty($hasShop)) {
+            util::fail('手机号已经使用');
+        }
+        $hasApply = ApplyClass::getByCondition(['mobile' => $mobile], true);
+        if (!empty($hasApply)) {
+            util::fail('手机号已注册过');
+        }
+
+        $defaultShopId = $sj['defaultShopId'] ?? 0;
+        $defaultShop = ShopClass::getById($defaultShopId, true);
+        if (empty($defaultShop)) {
+            util::fail('没有找到门店');
+        }
+        $defaultMainId = $defaultShop->mainId ?? 0;
+        if (empty($defaultMainId)) {
+            util::fail('没有找到main信息');
+        }
+
+        $adminId = $data['adminId'] ?? 0;
+        $main = MainClass::add(['id' => null], true);
+        $mainId = $main->id ?? 0;
+        $data['mainId'] = $mainId;
+        $newShop = self::addShop($data);
+
+        //从首店复制花材和分类
+        \bizGhs\item\services\ItemService::copyItem($defaultMainId, $mainId);
+
+        //初始化员工和角色
+        $initAdminData = ['mobile' => $mobile, 'adminId' => $adminId];
+        \bizGhs\admin\classes\AdminClass::initAdmin($initAdminData, $mainId, $newShop);
+
+        $lsOldShop = ShopClass::getById($oldShop->lsShopId, true);
+        $data['sjId'] = $lsOldShop->sjId ?? 0;
+        $data['ptStyle'] = dict::getDict('ptStyle', 'hd');
+        $lsNewShop = \biz\shop\classes\ShopClass::addShop($data);
+        //初始化员工和角色
+        $initAdminData = ['mobile' => $mobile, 'adminId' => $adminId];
+        \bizGhs\admin\classes\AdminClass::initAdmin($initAdminData, $mainId, $lsNewShop);
+
+        return $newShop;
+    }
+
     //组装门店基本信息 ssh 2019.12.2
     public static function groupBaseInfo($list)
     {
@@ -71,11 +124,6 @@ class ShopClass extends BaseClass
         //补充fullAddress lqh 2021.4.18
         $data['fullAddress'] = $data['city'] . $data['address'] . $data['floor'];
         $shop = self::add($data);
-        $newShopId = $shop['id'];
-        //初始化花材 lqh 2021.5.11
-        $adminId = $data['adminId'] ?? 0;
-        $shopId = $data['shopId'] ?? 0;
-        ProductClass::newShopInitProduct($data['sjId'], $shopId, $newShopId, $adminId);
         return $shop;
     }
 
@@ -119,7 +167,6 @@ class ShopClass extends BaseClass
     {
         $ghsShopId = $ghsShop->id ?? 0;
         $ghsMainId = $ghsShop->mainId ?? 0;
-        $ghsSjId = $ghsShop->sjId ?? 0;
         if (empty($ghsMainId)) {
             util::fail('没有找到你的main信息');
         }
@@ -173,7 +220,7 @@ class ShopClass extends BaseClass
         $ghsShop->save();
 
         //商品和分类初始化
-        CategoryClass::initCategoryGoods($ghsMainId, $ghsSjId);
+        CategoryClass::initCategoryGoods($ghsMainId);
         //商城和门店广告初始化
         AdClass::initAdd($ghsMainId);
         //商家商品配置信息

+ 5 - 5
biz-hd/goods/classes/CategoryClass.php

@@ -65,17 +65,17 @@ class CategoryClass extends BaseClass
     }
 
     //开店初始化分类和商品 ssh 2020.2.14
-    public static function initCategoryGoods($mainId, $sjId)
+    public static function initCategoryGoods($mainId)
     {
         $date = date("Y-m-d H:i:s");
         $list = [
             '花束' => [
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062359040_12358.jpg","uploads\/201906\/23\/jpg\/19062381985_12358.jpg"]', 'price' => 588, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '相思', 'itemNumber' => stringUtil::buildRandNo($sjId) . '5',],
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062352536_12358.jpg","uploads\/201906\/23\/jpg\/19062331132_12358.jpg","uploads\/201906\/23\/jpg\/19062380371_12358.jpg"]', 'price' => 688, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '女神', 'itemNumber' => stringUtil::buildRandNo($sjId) . '6',],
+                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062359040_12358.jpg","uploads\/201906\/23\/jpg\/19062381985_12358.jpg"]', 'price' => 588, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '相思', 'itemNumber' => stringUtil::buildRandNo($mainId) . '5',],
+                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062352536_12358.jpg","uploads\/201906\/23\/jpg\/19062331132_12358.jpg","uploads\/201906\/23\/jpg\/19062380371_12358.jpg"]', 'price' => 688, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '女神', 'itemNumber' => stringUtil::buildRandNo($mainId) . '6',],
             ],
             '花篮' => [
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062380217_12358.jpg","uploads\/201906\/23\/jpg\/19062339442_12358.jpg","uploads\/201906\/23\/jpg\/19062382963_12358.jpg"]', 'price' => 388, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '只此一心', 'itemNumber' => stringUtil::buildRandNo($sjId) . '3',],
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062374848_12358.jpg","uploads\/201906\/23\/jpg\/19062372687_12358.jpg","uploads\/201906\/23\/jpg\/19062341158_12358.jpg"]', 'price' => 488, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '密语时光', 'itemNumber' => stringUtil::buildRandNo($sjId) . '4',],
+                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062380217_12358.jpg","uploads\/201906\/23\/jpg\/19062339442_12358.jpg","uploads\/201906\/23\/jpg\/19062382963_12358.jpg"]', 'price' => 388, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '只此一心', 'itemNumber' => stringUtil::buildRandNo($mainId) . '3',],
+                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062374848_12358.jpg","uploads\/201906\/23\/jpg\/19062372687_12358.jpg","uploads\/201906\/23\/jpg\/19062341158_12358.jpg"]', 'price' => 488, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '密语时光', 'itemNumber' => stringUtil::buildRandNo($mainId) . '4',],
             ],
             '永生花' => [],
             '绿植' => []

+ 55 - 5
biz-hd/merchant/classes/ShopClass.php

@@ -4,9 +4,13 @@ namespace bizHd\merchant\classes;
 
 use biz\pt\classes\PtAssetClass;
 use biz\pt\models\PtAsset;
+use biz\shop\classes\MainClass;
 use biz\shop\classes\ShopYeChangeClass;
 use bizGhs\product\classes\ProductClass;
+use bizHd\ad\classes\AdClass;
 use bizHd\admin\classes\ShopAdminClass;
+use bizHd\goods\classes\CategoryClass;
+use bizHd\goods\classes\GoodsSettingClass;
 use common\components\dict;
 use common\components\dirUtil;
 use common\components\httpUtil;
@@ -34,6 +38,57 @@ class ShopClass extends BaseClass
         return isset($merchant['defaultShopId']) ? $merchant['defaultShopId'] : 0;
     }
 
+    public static function addMainShop($data, $oldShop, $sj)
+    {
+        if (isset($oldShop->pfShopId) && !empty($oldShop->pfShopId)) {
+            util::fail('请在批发端添加门店');
+        }
+        $mobile = $data['mobile'] ?? 0;
+        if (empty($mobile) || stringUtil::isMobile($mobile) == false) {
+            util::fail('请输入正确手机号');
+        }
+        $hasShop = ShopClass::getByCondition(['mobile' => $mobile], true);
+        if (!empty($hasShop)) {
+            util::fail('手机号已经使用');
+        }
+        $hasApply = ApplyClass::getByCondition(['mobile' => $mobile], true);
+        if (!empty($hasApply)) {
+            util::fail('手机号已注册过');
+        }
+
+        $defaultShopId = $sj['defaultShopId'] ?? 0;
+        $defaultShop = ShopClass::getById($defaultShopId, true);
+        if (empty($defaultShop)) {
+            util::fail('没有找到门店');
+        }
+        $defaultMainId = $defaultShop->mainId ?? 0;
+        if (empty($defaultMainId)) {
+            util::fail('没有找到main信息');
+        }
+
+        $adminId = $data['adminId'] ?? 0;
+        $main = MainClass::add(['id' => null], true);
+        $mainId = $main->id ?? 0;
+        $data['mainId'] = $mainId;
+        $newShop = self::addShop($data);
+
+        //从首店复制花材和分类
+        \bizGhs\item\services\ItemService::copyItem($defaultMainId, $mainId);
+
+        //初始化员工和角色
+        $initAdminData = ['mobile' => $mobile, 'adminId' => $adminId];
+        \bizGhs\admin\classes\AdminClass::initAdmin($initAdminData, $mainId, $newShop);
+
+        //商品和分类初始化
+        CategoryClass::initCategoryGoods($mainId);
+        //商城和门店广告初始化
+        AdClass::initAdd($mainId);
+        //商品配置信息
+        $setData = ['mainId' => $mainId, 'riseType' => 0, 'riseAmount' => 0];
+        GoodsSettingClass::add($setData);
+        return $newShop;
+    }
+
     //创建门店 ssh 2020.2.8
     public static function addShop($data)
     {
@@ -48,11 +103,6 @@ class ShopClass extends BaseClass
         }
         $data['img'] = isset($data['img']) ? json_encode($data['img']) : json_encode([]);
         $shop = self::add($data);
-        $newShopId = $shop['id'];
-        //初始化花材 lqh 2021.5.11
-        $adminId = $data['adminId'] ?? 0;
-        $shopId = $data['shopId'] ?? 0;
-        ProductClass::newShopInitProduct($data['sjId'], $shopId, $newShopId, $adminId);
         return $shop;
     }
 

+ 3 - 15
biz-hd/saas/services/ApplyService.php

@@ -81,25 +81,15 @@ class ApplyService extends BaseService
         $respond = [];
         $style = $apply['style'] ?? dict::getDict('ptStyle', 'hd');
         if ($style == dict::getDict('ptStyle', 'hd')) {
-            $ret = MerchantService::initGhsBaseInfo($apply, $main);
-            $shop2 = $ret['shop'] ?? [];
             $respond = MerchantService::initHdBaseInfo($apply, $main, true);
             $shop = $respond['shop'] ?? [];
-            $sj = $respond['sj'] ?? [];
-            $sjId = $sj->id ?? 0;
-
-            $shop2->lsShopId = $shop->id ?? 0;
-            $shop2->save();
-
-            $shop->pfShopId = $shop2->id ?? 0;
-            $shop->save();
 
             //商品和分类初始化
-            CategoryClass::initCategoryGoods($mainId, $sjId);
+            CategoryClass::initCategoryGoods($mainId);
             //商城和门店广告初始化
             AdClass::initAdd($mainId);
             //初始化员工和角色
-            \bizGhs\admin\classes\AdminClass::initAdmin($apply, $mainId, $shop, $shop2);
+            \bizGhs\admin\classes\AdminClass::initAdmin($apply, $mainId, $shop);
             //初始化花材
             \bizGhs\item\services\ItemService::initItem($mainId);
             //商家商品配置信息
@@ -111,8 +101,6 @@ class ApplyService extends BaseService
             $shop = $respond['shop'] ?? [];
             $ret = MerchantService::initHdBaseInfo($apply, $main);
             $shop2 = $ret['shop'] ?? [];
-            $sj2 = $ret['sj'] ?? [];
-            $sjId2 = $sj2->id ?? 0;
 
             $shop2->pfShopId = $shop->id ?? 0;
             $shop2->save();
@@ -121,7 +109,7 @@ class ApplyService extends BaseService
             $shop->save();
 
             //商品和分类初始化
-            CategoryClass::initCategoryGoods($mainId, $sjId2);
+            CategoryClass::initCategoryGoods($mainId);
             //商城和门店广告初始化
             AdClass::initAdd($mainId);
             //初始化员工和角色

+ 1 - 35
biz-mall/goods/classes/CategoryClass.php

@@ -57,41 +57,7 @@ class CategoryClass extends BaseClass
 	{
 		return self::updateById($categoryId, ['status' => $status]);
 	}
-	
-	//开店初始化分类和商品 ssh 2020.2.14
-	public static function initCategoryGoods($sjId)
-	{
-		$date = date("Y-m-d H:i:s");
-		$list = [
-			'花束' => [
-				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 188, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '天使美人', 'itemNumber' => stringUtil::buildRandNo($sjId) . '1',],
-				['shopImg' => '["\/uploads\/201908\/01\/jpg\/19080166819_12358.jpg"]', 'price' => 288, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '转角遇到爱', 'itemNumber' => stringUtil::buildRandNo($sjId) . '2',],
-			],
-			'花篮' => [
-				['shopImg' => '["\/uploads\/201906\/23\/jpg\/19062380217_12358.jpg","\/uploads\/201906\/23\/jpg\/19062339442_12358.jpg","\/uploads\/201906\/23\/jpg\/19062382963_12358.jpg"]', 'price' => 388, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '只此一心', 'itemNumber' => stringUtil::buildRandNo($sjId) . '3',],
-				['shopImg' => '["\/uploads\/201906\/23\/jpg\/19062374848_12358.jpg","\/uploads\/201906\/23\/jpg\/19062372687_12358.jpg","\/uploads\/201906\/23\/jpg\/19062341158_12358.jpg"]', 'price' => 488, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '密语时光', 'itemNumber' => stringUtil::buildRandNo($sjId) . '4',],
-			],
-			'永生花' => [
-				['shopImg' => '["\/uploads\/201906\/23\/jpg\/19062359040_12358.jpg","\/uploads\/201906\/23\/jpg\/19062381985_12358.jpg"]', 'price' => 588, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '相思', 'itemNumber' => stringUtil::buildRandNo($sjId) . '5',],
-				['shopImg' => '["\/uploads\/201906\/23\/jpg\/19062352536_12358.jpg","\/uploads\/201906\/23\/jpg\/19062331132_12358.jpg","\/uploads\/201906\/23\/jpg\/19062380371_12358.jpg"]', 'price' => 688, 'content' => '暂无简介', 'sjId' => $sjId, 'createTime' => $date, 'updateTime' => $date, 'name' => '女神', 'itemNumber' => stringUtil::buildRandNo($sjId) . '6',],
-			],
-			'绿植' => []
-		];
-		foreach ($list as $key => $goodsList) {
-			$data = ['categoryName' => $key, 'sjId' => $sjId];
-			$cat = self::add($data);
-			if (!empty($goodsList)) {
-				$categoryId = $cat['id'];
-				foreach ($goodsList as $key => $val) {
-					$goods = GoodsClass::add($val);
-					$goodsId = $goods['id'];
-					$goodsCategoryData = ['cId' => $categoryId, 'gId' => $goodsId, 'sjId' => $sjId];
-					GoodsCategoryClass::add($goodsCategoryData);
-				}
-			}
-		}
-	}
-	
+
 	//删除分类 ssh 2020.3.3
 	public static function deleteCategory($id)
 	{

+ 6 - 15
biz/shop/classes/ShopClass.php

@@ -9,6 +9,10 @@ use biz\sj\classes\SjClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\order\classes\OrderClass;
 use bizGhs\product\classes\ProductClass;
+use bizHd\ad\classes\AdClass;
+use bizHd\goods\classes\CategoryClass;
+use bizHd\goods\classes\GoodsSettingClass;
+use bizHd\saas\classes\ApplyClass;
 use common\components\dict;
 use common\components\httpUtil;
 use common\components\imgUtil;
@@ -82,26 +86,14 @@ class ShopClass extends BaseClass
         }
         //补充fullAddress lqh 2021.4.18
         $data['fullAddress'] = $data['city'] . $data['address'] . $data['floor'];
-        $img = '';
-        if (isset($data['img']) && !empty($data['img'])) {
-            $img = json_encode($data['img']);
-        }
-        $data['img'] = $img;
+        $data['img'] = isset($data['img']) && !empty($data['img']) ? json_encode($data['img']) : '';
         if (isset($data['ptStyle']) == false) {
             util::fail('请先择平台类型');
         }
         $shop = self::add($data, true);
         $newShopId = $shop->id;
-
-        $extData = [
-            'shopId' => $newShopId,
-        ];
+        $extData = ['shopId' => $newShopId];
         ShopExtClass::add($extData);
-
-        //初始化花材 lqh 2021.5.11
-        $adminId = $data['adminId'] ?? 0;
-        $shopId = $data['shopId'] ?? 0;
-        ProductClass::newShopInitProduct($data['sjId'], $shopId, $newShopId, $adminId);
         return $shop;
     }
 
@@ -157,7 +149,6 @@ class ShopClass extends BaseClass
     }
 
 
-
     //取商家所有门店 ssh 2020.2.29
     public static function getAllShop($sjId)
     {