|
|
@@ -2,12 +2,16 @@
|
|
|
|
|
|
namespace bizGhs\merchant\classes;
|
|
|
|
|
|
+use biz\shop\classes\MainClass;
|
|
|
+use biz\sj\services\MerchantService;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
use bizGhs\shop\classes\ShopAdminClass;
|
|
|
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\qrCodeUtil;
|
|
|
use common\components\util;
|
|
|
@@ -127,9 +131,38 @@ class ShopClass extends BaseClass
|
|
|
if (empty($ghsMainId)) {
|
|
|
util::fail('没有找到你的main信息');
|
|
|
}
|
|
|
+ $ghsMain = MainClass::getById($ghsMainId, true);
|
|
|
+ if (empty($ghsMain)) {
|
|
|
+ util::fail('没有找到main信息');
|
|
|
+ }
|
|
|
+ $customMobile = $customShop->mobile ?? 0;
|
|
|
+ $ghsMobile = $ghsShop->mobile ?? 0;
|
|
|
+ if (empty($ghsShop)) {
|
|
|
+ util::fail('手机号有问题?');
|
|
|
+ }
|
|
|
+ if ($ghsMobile != $customMobile) {
|
|
|
+ //如果绑定的零售店跟批发店手机号不一样,则先查批发店这个手机号有没创建过零售店,没有则自动给创建,有则提醒选的零售店不对
|
|
|
+ $has = ShopClass::getByCondition(['mobile' => $customMobile, 'ptStyle' => dict::getDict('ptStyle', 'hd')], true);
|
|
|
+ if (!empty($has)) {
|
|
|
+ util::fail('请确认此零售店开通时用的手机号要与本批发店一致?');
|
|
|
+ } else {
|
|
|
+ //创建零售店
|
|
|
+ $apply = ApplyClass::getByCondition(['mobile' => $ghsMobile]);
|
|
|
+ if (empty($apply)) {
|
|
|
+ util::fail('没有找到申请信息');
|
|
|
+ }
|
|
|
+ $respond = MerchantService::initHdBaseInfo($apply, $ghsMain, true);
|
|
|
+ $customShop = $respond['shop'] ?? [];
|
|
|
+ if (empty($customShop)) {
|
|
|
+ util::fail('没有生成门店');
|
|
|
+ }
|
|
|
+ $customShopId = $customShop->id ?? 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
$customShop->mainId = $ghsMainId;
|
|
|
$customShop->pfShopId = $ghsShopId;
|
|
|
$customShop->save();
|
|
|
+
|
|
|
$ghsShop->lsShopId = $customShopId;
|
|
|
$ghsShop->save();
|
|
|
|
|
|
@@ -153,6 +186,7 @@ class ShopClass extends BaseClass
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|