|
|
@@ -2,8 +2,10 @@
|
|
|
|
|
|
namespace bizGhs\apply\services;
|
|
|
|
|
|
+use biz\shop\classes\ShopClass;
|
|
|
use bizGhs\apply\classes\ApplyClass;
|
|
|
use bizGhs\merchant\services\MerchantService;
|
|
|
+use bizGhs\shop\classes\MainClass;
|
|
|
use bizHd\merchant\services\SjService;
|
|
|
use common\components\util;
|
|
|
use bizGhs\base\services\BaseService;
|
|
|
@@ -22,23 +24,34 @@ class ApplyService extends BaseService
|
|
|
}
|
|
|
$applyId = $apply['id'];
|
|
|
$live = isset($apply['live']) ? $apply['live'] : 1;
|
|
|
+
|
|
|
+ $mobile = $apply['mobile'] ?? '';
|
|
|
+ if (empty($mobile)) {
|
|
|
+ util::fail('没有找到手机号');
|
|
|
+ }
|
|
|
+ $lsShop = ShopClass::getByCondition(['mobile' => $mobile, 'ptStyle' => 1], true);
|
|
|
+ if (empty($lsShop)) {
|
|
|
+ $main = MainClass::addMain();
|
|
|
+ $ret = SjService::initHdBaseInfo($apply, $main);
|
|
|
+ $lsShop = $ret['shop'] ?? [];
|
|
|
+ } else {
|
|
|
+ $mainId = $lsShop->mainId ?? 0;
|
|
|
+ $main = MainClass::getById($mainId, true);
|
|
|
+ if (empty($main)) {
|
|
|
+ util::fail('没有main信息');
|
|
|
+ }
|
|
|
+ }
|
|
|
ApplyClass::updateById($applyId, ['status' => ApplyClass::STATUS_PASS, 'remark' => $remark]);
|
|
|
$apply['name'] = isset($apply['name']) ? $apply['name'] : '';
|
|
|
- //初始化常用花材
|
|
|
- $main = \bizGhs\shop\classes\MainClass::addMainInitItem($live);
|
|
|
-
|
|
|
+ //初始化或更新花材
|
|
|
+ MainClass::addMainInitItem($main, $live);
|
|
|
$respond = MerchantService::initGhsBaseInfo($apply, $main, true);
|
|
|
- $shop = $respond['shop'] ?? [];
|
|
|
-
|
|
|
- $ret = SjService::initHdBaseInfo($apply, $main);
|
|
|
- $shop2 = $ret['shop'] ?? [];
|
|
|
-
|
|
|
- $shop2->pfShopId = $shop->id ?? 0;
|
|
|
- $shop2->save();
|
|
|
-
|
|
|
- $shop->lsShopId = $shop2->id ?? 0;
|
|
|
- $shop->save();
|
|
|
+ $pfShop = $respond['shop'] ?? [];
|
|
|
|
|
|
+ $lsShop->pfShopId = $pfShop->id ?? 0;
|
|
|
+ $lsShop->save();
|
|
|
+ $pfShop->lsShopId = $lsShop->id ?? 0;
|
|
|
+ $pfShop->save();
|
|
|
return $respond;
|
|
|
}
|
|
|
|