8) { util::fail('门店名称不能超过8个汉字,2个字母顶一个汉字'); } $exists = self::getByCondition(['sjId' => $data['sjId'], 'shopName' => $shopName]); if (!empty($exists)) { util::fail('门店名称已经存在'); } //补充fullAddress lqh 2021.4.18 $data['fullAddress'] = $data['city'] . $data['address'] . $data['floor']; $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]; ShopExtClass::add($extData); //初始化员工和角色 $mainId = $data['mainId'] ?? 0; $mobile = $data['mobile'] ?? 0; $adminId = $data['adminId'] ?? 0; $initAdminData = ['mobile' => $mobile, 'adminId' => $adminId]; AdminClass::initAdmin($initAdminData, $mainId, $shop); return $shop; } // 通过分店门店id取首店门店id public static function getDefaultShopId($shopId) { $shop = self::getById($shopId); if (empty($shop)) { return null; } $sjId = $shop['sjId']; $sj = SjClass::getById($sjId); if (empty($sj)) { return null; } return $sj['defaultShopId']; } }