| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?php
- namespace bizHd\saas\classes;
- use biz\sj\classes\SjClass;
- use bizHd\admin\classes\AdminClass;
- use bizHd\admin\classes\ShopAdminClass;
- use bizHd\agent\classes\AgentAssetClass;
- use bizGhs\custom\classes\CustomClass;
- use biz\sj\classes\MerchantClass;
- use common\components\dict;
- use common\components\noticeUtil;
- use common\components\sms;
- use common\components\stringUtil;
- use common\components\util;
- use bizHd\base\classes\BaseClass;
- class ApplyClass extends BaseClass
- {
- public static $baseFile = '\bizHd\saas\models\Apply';
- //来自零售平台
- const FROM_RETAIL = 1;
- //来自供货商平台
- const FROM_GHS = 2;
- const STATUS_CHECKING = 1;
- const STATUS_PASS = 2;
- const STATUS_UN_PASS = 3;
- const STATUS_HAS_PAY = 4;
- const STATUS_EXPIRE = 5;
- //证件类型
- const CERT_TYPE_LICENSE = 1;
- const CERT_TYPE_PERSON = 2;
- const CERT_TYPE_MOBILE = 3;
- //更新申请 ssh 2021.2.27
- public static function updateRetail($data)
- {
- $customId = $data['customId'] ?? 0;
- $custom = CustomClass::getById($customId);
- $customSjId = $custom['customSjId'] ?? 0;
- $currentApply = ApplyClass::getByCondition(['sjId' => $customSjId]);
- if (empty($currentApply)) {
- util::fail('此客户没有申请开店记录,请排查');
- }
- $currentApplyId = $currentApply['id'] ?? 0;
- $licenseNo = $currentApply['licenseNo'] ?? '';
- if (!empty($licenseNo)) {
- util::fail('您已经申请过了');
- }
- $applyMobile = $currentApply['mobile'] ?? '';
- $mobile = $data['mobile'] ?? '';
- if ($mobile != $applyMobile) {
- noticeUtil::push("二次申请开店使用的手机号不一样 customId:{$customId}", '15280215347');
- util::fail('手机号错误,请联系管理员', '15280215347');
- }
- $data['status'] = ApplyClass::STATUS_CHECKING;
- ApplyClass::updateById($currentApplyId, $data);
- $licenseNo = $data['licenseNo'] ?? '';
- $mobile = $data['mobile'] ?? '';
- $extData = [
- 'licenseNo' => $licenseNo,
- 'mobile' => $mobile,
- ];
- ApplyExtendClass::updateByCondition(['applyId' => $currentApplyId], $extData);
- return true;
- }
- //新增申请开店 ssh 2021.2.27
- public static function addRetail($data)
- {
- $city = $data['city'] ?? '';
- $dist = $data['dist'] ?? '';
- $floor = $data['floor'] ?? '';
- $address = $data['address'] ?? '';
- $data['fullAddress'] = $city . $dist . $address . $floor;
- $data['style'] = SjClass::STYLE_RETAIL;
- $respond = self::addApply($data);
- //供货商添加客户的不需要通知
- if (isset($data['replace']) && $data['replace'] == 0) {
- $mobile = $data['mobile'];
- $text = "零售商 {$mobile} 已提交资料,";
- if (isset($data['introSjName']) && !empty($data['introSjName'])) {
- $text .= "介绍人:{$data['introSjName']},";
- }
- $text .= "请及时跟进";
- noticeUtil::push($text, '15280215347');
- }
- return $respond;
- }
- //新增申请开店 ssh 2021.2.27
- public static function addGhs($data)
- {
- $dist = $data['dist'] ?? '';
- $floor = $data['floor'] ?? '';
- $address = $data['address'] ?? '';
- $city = $data['city'] ?? '';
- $data['fullAddress'] = $city . $dist . $address . $floor;
- $data['style'] = SjClass::STYLE_SUPPLIER;
- $respond = self::addApply($data);
- if (isset($data['replace']) && $data['replace'] == 0) {
- $mobile = $data['mobile'];
- $text = "供货商 {$mobile} 已提交资料,";
- if (isset($data['introSjName']) && !empty($data['introSjName'])) {
- $text .= "介绍人:{$data['introSjName']},";
- }
- $text .= "请及时跟进";
- noticeUtil::push($text, '15280215347');
- }
- return $respond;
- }
- //新增申请开店 ssh 2021.2.27
- public static function addKmGhs($data)
- {
- $dist = $data['dist'] ?? '';
- $floor = $data['floor'] ?? '';
- $address = $data['address'] ?? '';
- $city = $data['city'] ?? '';
- $data['fullAddress'] = $city . $dist . $address . $floor;
- $data['style'] = dict::getDict('ptStyle', 'kmGhs');
- $respond = self::addApply($data);
- if (isset($data['replace']) && $data['replace'] == 0) {
- $mobile = $data['mobile'];
- $text = "供货商 {$mobile} 已提交资料,";
- if (isset($data['introSjName']) && !empty($data['introSjName'])) {
- $text .= "介绍人:{$data['introSjName']},";
- }
- $text .= "请及时跟进";
- noticeUtil::push($text, '15280215347');
- }
- return $respond;
- }
- //添加申请 ssh 2020.2.10
- public static function addApply($data)
- {
- //邀请人数+1
- $introSjId = isset($data['introSjId']) ? $data['introSjId'] : '';
- if (!empty($introSjId)) {
- $agent = AgentAssetClass::getByCondition(['sjId' => $introSjId], true);
- if (empty($agent)) {
- $agent = AgentAssetClass::add(['sjId' => $introSjId], true);
- }
- $agent->inviteNum += 1;
- $agent->save();
- }
- $name = $data['name'] ?? 0;
- $num = stringUtil::getWordNum($name);
- if ($num > 19) {
- util::fail('标题不能超过19个字');
- }
- $apply = self::add($data);
- $id = $apply['id'];
- $data['applyId'] = $id;
- ApplyExtendClass::add($data);
- return $apply;
- }
- }
|