|
|
@@ -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)
|
|
|
{
|