|
@@ -18,6 +18,7 @@ class CustomClass extends BaseClass
|
|
|
public static $baseFile = '\bizGhs\custom\models\Custom';
|
|
public static $baseFile = '\bizGhs\custom\models\Custom';
|
|
|
|
|
|
|
|
//申请开店建立客户关系 ssh 2021.2.28
|
|
//申请开店建立客户关系 ssh 2021.2.28
|
|
|
|
|
+ //GhsClass::build()也有相似流程
|
|
|
public static function buildCustom($applyData, $sjId, $shopId)
|
|
public static function buildCustom($applyData, $sjId, $shopId)
|
|
|
{
|
|
{
|
|
|
if ($applyData['style'] == SjClass::STYLE_RETAIL) {
|
|
if ($applyData['style'] == SjClass::STYLE_RETAIL) {
|
|
@@ -39,11 +40,16 @@ class CustomClass extends BaseClass
|
|
|
'lat' => $applyData['lat'],
|
|
'lat' => $applyData['lat'],
|
|
|
];
|
|
];
|
|
|
CustomClass::addCustom($customData);
|
|
CustomClass::addCustom($customData);
|
|
|
- $introShopId = $applyData['introShopId'] ?? 0;
|
|
|
|
|
- $ghsShop = ShopClass::getShopInfo($introShopId);
|
|
|
|
|
- if (empty($ghsShop)) {
|
|
|
|
|
- util::fail('没有找到门店');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $introShopId = $applyData['introShopId'] ?? 0;
|
|
|
|
|
+ $ghsShop = ShopClass::getShopInfo($introShopId);
|
|
|
|
|
+ if (empty($ghsShop)) {
|
|
|
|
|
+ util::fail('没有找到门店');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $ghs = GhsClass::getByCondition(['ownSjId' => $sjId, 'sjId' => $ghsShop['merchantId'], 'shopId' => $ghsShop['id']]);
|
|
|
|
|
+ if (empty($ghs)) {
|
|
|
$ghsData = [
|
|
$ghsData = [
|
|
|
'sjId' => $ghsShop['merchantId'],
|
|
'sjId' => $ghsShop['merchantId'],
|
|
|
'shopId' => $ghsShop['id'],
|
|
'shopId' => $ghsShop['id'],
|
|
@@ -66,9 +72,9 @@ class CustomClass extends BaseClass
|
|
|
if ($applyData['style'] == SjClass::STYLE_SUPPLIER) {
|
|
if ($applyData['style'] == SjClass::STYLE_SUPPLIER) {
|
|
|
if ($applyData['introStyle'] == SjClass::STYLE_RETAIL) {
|
|
if ($applyData['introStyle'] == SjClass::STYLE_RETAIL) {
|
|
|
$has = CustomClass::getByCondition(['ownSjId' => $sjId, 'sjId' => $applyData['introSjId'], 'shopId' => $applyData['introShopId']]);
|
|
$has = CustomClass::getByCondition(['ownSjId' => $sjId, 'sjId' => $applyData['introSjId'], 'shopId' => $applyData['introShopId']]);
|
|
|
|
|
+ $introSjId = $applyData['introSjId'] ?? 0;
|
|
|
|
|
+ $introShopId = $applyData['introShopId'] ?? 0;
|
|
|
if (empty($has)) {
|
|
if (empty($has)) {
|
|
|
- $introSjId = $applyData['introSjId'] ?? 0;
|
|
|
|
|
- $introShopId = $applyData['introShopId'] ?? 0;
|
|
|
|
|
$shop = ShopClass::getShopInfo($introShopId);
|
|
$shop = ShopClass::getShopInfo($introShopId);
|
|
|
$name = $shop['shopName'] ?? '';
|
|
$name = $shop['shopName'] ?? '';
|
|
|
$super = ShopClass::getSuper($introShopId);
|
|
$super = ShopClass::getSuper($introShopId);
|
|
@@ -89,12 +95,14 @@ class CustomClass extends BaseClass
|
|
|
'lat' => $applyData['lat'],
|
|
'lat' => $applyData['lat'],
|
|
|
];
|
|
];
|
|
|
CustomClass::addCustom($customData);
|
|
CustomClass::addCustom($customData);
|
|
|
-
|
|
|
|
|
- $ghsShop = ShopClass::getShopInfo($shopId);
|
|
|
|
|
- if (empty($ghsShop)) {
|
|
|
|
|
- util::fail('没有找到门店');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ $ghsShop = ShopClass::getShopInfo($shopId);
|
|
|
|
|
+ if (empty($ghsShop)) {
|
|
|
|
|
+ util::fail('没有找到门店');
|
|
|
|
|
+ }
|
|
|
|
|
+ $ghs = GhsClass::getByCondition(['ownSjId' => $introSjId, 'sjId' => $sjId, 'shopId' => $shopId]);
|
|
|
|
|
+ dd($ghs);
|
|
|
|
|
+ if (empty($ghs)) {
|
|
|
$ghsData = [
|
|
$ghsData = [
|
|
|
'sjId' => $sjId,
|
|
'sjId' => $sjId,
|
|
|
'shopId' => $shopId,
|
|
'shopId' => $shopId,
|