|
|
@@ -79,7 +79,7 @@ class ApplyService extends BaseService
|
|
|
return $respond;
|
|
|
}
|
|
|
|
|
|
- //新样或修改申请开店 shish 2021.2.27
|
|
|
+ //新增或修改申请开店 shish 2021.2.27
|
|
|
public static function replaceRetail($data, $import = false)
|
|
|
{
|
|
|
$mobile = $data['mobile'] ?? 0;
|
|
|
@@ -109,7 +109,6 @@ class ApplyService extends BaseService
|
|
|
if (in_array($from, [ApplyClass::FROM_GHS, ApplyClass::FROM_RETAIL]) == false) {
|
|
|
util::fail('请填写来源');
|
|
|
}
|
|
|
-
|
|
|
if ($import == false) {
|
|
|
//查询客户提交的证件
|
|
|
$has = ApplyClass::getByCondition(['licenseNo' => $licenseNo]);
|
|
|
@@ -142,12 +141,8 @@ class ApplyService extends BaseService
|
|
|
}
|
|
|
|
|
|
//供货商申请开店 shish 2021.01.28
|
|
|
- public static function addGhsApply($data)
|
|
|
+ public static function replaceGhs($data)
|
|
|
{
|
|
|
- $style = $data['style'] ?? 0;
|
|
|
- if (in_array($style, [MerchantClass::STYLE_RETAIL, MerchantClass::STYLE_SUPPLIER]) == false) {
|
|
|
- util::fail('请确认商家类型');
|
|
|
- }
|
|
|
$mobile = $data['mobile'] ?? 0;
|
|
|
if (empty($mobile)) {
|
|
|
util::fail('请填写手机号');
|
|
|
@@ -155,37 +150,34 @@ class ApplyService extends BaseService
|
|
|
if (stringUtil::isMobile($mobile) == false) {
|
|
|
util::fail('请填写正确手机号');
|
|
|
}
|
|
|
- //查询客户提交的证件
|
|
|
- $certType = $data['certType'] ?? ApplyClass::CERT_TYPE_LICENSE;
|
|
|
- $extend = ApplyClass::getByCondition(['certType' => $certType, 'mobile' => $mobile]);
|
|
|
- if (!empty($extend)) {
|
|
|
- util::fail('已申请过了');
|
|
|
- }
|
|
|
$from = $data['from'] ?? 0;
|
|
|
if (in_array($from, [ApplyClass::FROM_GHS, ApplyClass::FROM_RETAIL]) == false) {
|
|
|
- util::fail('申请没有填写来源');
|
|
|
+ util::fail('请填写来源');
|
|
|
+ }
|
|
|
+ $licenseNo = $data['licenseNo'] ?? '';
|
|
|
+ $has = ApplyClass::getByCondition(['licenseNo' => $licenseNo]);
|
|
|
+ if (!empty($has)) {
|
|
|
+ util::fail('您已申请');
|
|
|
+ }
|
|
|
+ //引荐的员工
|
|
|
+ $shopAdminId = $data['shopAdminId'] ?? 0;
|
|
|
+ if (!empty($shopAdminId)) {
|
|
|
+ $shopAdmin = ShopAdminClass::getById($shopAdminId);
|
|
|
+ if (!empty($shopAdmin)) {
|
|
|
+ $sjId = $shopAdmin['merchantId'] ?? 0;
|
|
|
+ $sj = MerchantClass::getMerchantById($sjId);
|
|
|
+ $data['introSjId'] = $sjId;
|
|
|
+ $data['introStyle'] = $sj['style'] ?? MerchantClass::STYLE_SUPPLIER;
|
|
|
+ $data['introSjName'] = $sj['merchantName'] ?? '';
|
|
|
+ $data['introShopId'] = $shopAdmin['shopId'] ?? 0;
|
|
|
+ }
|
|
|
}
|
|
|
$prefix = $data['province'] == $data['city'] ? $data['province'] : $data['province'] . $data['city'];
|
|
|
$dist = $data['dist'] ?? '';
|
|
|
$floor = $data['floor'] ?? '';
|
|
|
$address = $data['address'] ?? '';
|
|
|
$data['fullAddress'] = $prefix . $dist . $address . $floor;
|
|
|
- $respond = ApplyClass::addApply($data);
|
|
|
- $mobile = $data['mobile'];
|
|
|
- if ($style == MerchantClass::STYLE_RETAIL) {
|
|
|
- $text = "有零售商资料提交,";
|
|
|
- } else {
|
|
|
- $text = "供货商申请开店,";
|
|
|
- }
|
|
|
- $text .= '客户(' . $mobile . ')已提交资料,';
|
|
|
- $introSjId = $data['introSjId'] ?? 0;
|
|
|
- if (!empty($introSjId)) {
|
|
|
- $merchant = MerchantClass::getMerchantById($introSjId);
|
|
|
- $name = $merchant['merchantName'] ?? '';
|
|
|
- $text .= "介绍人:{$name},";
|
|
|
- }
|
|
|
- $text .= "请及时跟进";
|
|
|
- noticeUtil::push($text, '15280215347');
|
|
|
+ $respond = ApplyClass::addGhs($data);
|
|
|
return $respond;
|
|
|
}
|
|
|
|