shish 5 年之前
父節點
當前提交
1240ab9edf
共有 1 個文件被更改,包括 22 次插入0 次删除
  1. 22 0
      biz-hd/merchant/classes/ShopClass.php

+ 22 - 0
biz-hd/merchant/classes/ShopClass.php

@@ -29,6 +29,28 @@ class ShopClass extends BaseClass
         return isset($merchant['defaultShopId']) ? $merchant['defaultShopId'] : 0;
     }
 
+    //创建门店 ssh 2020.2.8
+    public static function addShop($data)
+    {
+        $data['createTime'] = date("Y-m-d H:i:s");
+        $shopName = isset($data['shopName']) ? $data['shopName'] : '';
+        if (empty($shopName)) {
+            util::fail('请填写门店名称');
+        }
+        $exists = self::getByCondition(['merchantId' => $data['merchantId'], 'shopName' => $shopName]);
+        if (!empty($exists)) {
+            util::fail('门店名称已经存在');
+        }
+        $data['img'] = isset($data['img']) ? json_encode($data['img']) : json_encode([]);
+        $shop = self::add($data);
+        $newShopId = $shop['id'];
+        //初始化花材 linqh 2021.5.11
+        $adminId = $data['adminId']??0;
+        $shopId = $data['shopId']??0;
+        ProductClass::newShopInitProduct($data['merchantId'],$shopId,$newShopId,$adminId);
+        return $shop;
+    }
+
     //更新门店 ssh 2020.2.29
     public static function updateShop($id, $data)
     {