shish 5 lat temu
rodzic
commit
8b4e964688

+ 55 - 47
app/saas/controllers/ApplyController.php

@@ -2,6 +2,7 @@
 
 namespace saas\controllers;
 
+use biz\merchant\classes\MerchantClass;
 use biz\saas\services\ApplyService;
 use common\components\util;
 use Yii;
@@ -10,52 +11,59 @@ use yii\web\Controller;
 
 class ApplyController extends BaseController
 {
-	
-	//申请列表
-	public function actionList()
-	{
-		$where = [];
-		$list = ApplyService::getApplyList($where);
-		util::success($list);
-	}
-	
-	//审核
-	public function actionCheck()
-	{
-		$id = Yii::$app->request->post('id');
-		$status = Yii::$app->request->post('status', 0);
-		$remark = Yii::$app->request->post('remark', '');
-		$apply = ApplyService::getById($id);
-		if (empty($apply)) {
-			util::fail('找不到申请记录');
-		}
-		if ($apply['status'] != 0) {
-			util::fail('已经审过了');
-		}
-		ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
-		if ($status == 1) {
-			ApplyService::pass($id);
-		}
-		util::success('操作成功');
-	}
-	
-	//申请试用登记 shish 2020.1.11
-	public function actionRegister()
-	{
-		$post = Yii::$app->request->post();
-		$rand = rand(0, 1);
-		$data = ['focus' => 1, 'qrCode' => ''];
-		if ($rand == 0) {
-			$data = ['focus' => 0, 'qrCode' => 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3602624501,870193918&fm=26&gp=0.jpg'];
-		}
-		util::success($data);
-	}
-
-	//申请状态
-	public function actionApplyStatus()
-	{
-		$status = rand(0, 4);
-		util::success(['status' => $status]);
-	}
+
+    //申请列表
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $style = $get['style'] ?? MerchantClass::STYLE_RETAIL;
+        $status = $get['status'] ?? 0;
+        $where = [];
+        if (!empty($status)) {
+            $where['status'] = $status;
+        }
+        $where['style'] = $style;
+        $list = ApplyService::getApplyList($where);
+        util::success($list);
+    }
+
+    //审核
+    public function actionCheck()
+    {
+        $id = Yii::$app->request->post('id');
+        $status = Yii::$app->request->post('status', 0);
+        $remark = Yii::$app->request->post('remark', '');
+        $apply = ApplyService::getById($id);
+        if (empty($apply)) {
+            util::fail('找不到申请记录');
+        }
+        if ($apply['status'] != 0) {
+            util::fail('已经审过了');
+        }
+        ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
+        if ($status == 1) {
+            ApplyService::pass($id);
+        }
+        util::success('操作成功');
+    }
+
+    //申请试用登记 shish 2020.1.11
+    public function actionRegister()
+    {
+        $post = Yii::$app->request->post();
+        $rand = rand(0, 1);
+        $data = ['focus' => 1, 'qrCode' => ''];
+        if ($rand == 0) {
+            $data = ['focus' => 0, 'qrCode' => 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3602624501,870193918&fm=26&gp=0.jpg'];
+        }
+        util::success($data);
+    }
+
+    //申请状态
+    public function actionApplyStatus()
+    {
+        $status = rand(0, 4);
+        util::success(['status' => $status]);
+    }
 
 }

+ 20 - 1
biz/saas/classes/ApplyExtendClass.php

@@ -8,10 +8,29 @@ use common\components\sms;
 use common\components\stringUtil;
 use common\components\util;
 use biz\base\classes\BaseClass;
+use Yii;
 
 class ApplyExtendClass extends BaseClass
 {
 
-	public static $baseFile = '\biz\saas\models\ApplyExtend';
+    public static $baseFile = '\biz\saas\models\ApplyExtend';
+
+    public static function getExtendByIds($ids)
+    {
+        $list = self::getAllByCondition(['applyId' => ['in', $ids]], null, '*', 'applyId');
+        $list = self::groupInfo($list);
+        return $list;
+    }
+
+    public static function groupInfo($list)
+    {
+        if (empty($list)) {
+            return $list;
+        }
+        foreach ($list as $key => $val) {
+            $list[$key]['license'] = Yii::$app->params['imgHost'] . '/retail/default-img.png';
+        }
+        return $list;
+    }
 
 }

+ 102 - 94
biz/saas/services/ApplyService.php

@@ -10,6 +10,7 @@ use biz\base\services\BaseService;
 use biz\merchant\classes\MerchantClass;
 use biz\merchant\services\MerchantService;
 use biz\saas\classes\ApplyClass;
+use biz\saas\classes\ApplyExtendClass;
 use biz\user\classes\UserClass;
 use biz\user\services\UserService;
 use common\components\noticeUtil;
@@ -19,98 +20,105 @@ use common\services\xhMerchantService;
 
 class ApplyService extends BaseService
 {
-	
-	public static $baseFile = '\biz\saas\classes\ApplyClass';
-	
-	//申请列表 shish 2021.1.28
-	public static function getApplyList($where)
-	{
-		$data = ApplyClass::getList('*', $where, 'addTime DESC');
-		$list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
-		if (empty($list)) {
-			return $data;
-		}
-		//商家信息
-		$oldList = array_column($list, 'introSjId');
-		$merchantIdList = array_column($list, 'merchantId');
-		$idList = array_merge($merchantIdList, $oldList);
-		$idList = array_unique(array_filter($idList));
-		$merchant = [];
-		$merchant = MerchantService::getMerchantByIds($idList);
-		foreach ($list as $key => $val) {
-			$adminId = $val['adminId'];
-			$introSjId = $val['introSjId'];
-		}
-		$data['list'] = $list;
-		$data['balance'] = 0.00;
-		$data['invitedNum'] = 10;
-		$data['payNum'] = 5;
-		$data['income'] = 100;
-		return $data;
-	}
-	
-	//审核通过
-	public static function pass($id)
-	{
-		$apply = ApplyClass::getById($id);
-		if (empty($apply)) {
-			util::fail('没有找到申请记录');
-		}
-		$apply['merchantName'] = isset($apply['name']) ? $apply['name'] : '';
-		$adminId = $apply['adminId'];
-		$admin = AdminClass::getById($adminId);
-		$apply['adminName'] = isset($admin['adminName']) ? $admin['adminName'] : '';
-		return MerchantClass::generateMerchant($apply);
-	}
-	
-	//申请开店 shish 2021.01.28
-	public static function addApply($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('请填写手机号');
-		}
-		if (stringUtil::isMobile($mobile) == false) {
-			util::fail('请填写正确手机号');
-		}
-		$adminId = $data['adminId'] ?? 0;
-		$apply = ApplyClass::getByCondition(['mobile' => $mobile, 'style' => $style]);
-		if (!empty($apply)) {
-			util::fail('手机号已被使用');
-		}
-		$from = $data['from'] ?? 0;
-		if (in_array($from, [ApplyClass::FROM_GHS, ApplyClass::FROM_RETAIL]) == false) {
-			util::fail('请确认开店资料是否完整!');
-		}
-		$apply = ApplyClass::getByCondition(['adminId' => $adminId, 'from' => $from, 'style' => $style]);
-		if (!empty($apply)) {
-			util::fail('您已经申请过了');
-		}
-		$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;
-		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');
-	}
-	
+
+    public static $baseFile = '\biz\saas\classes\ApplyClass';
+
+    //申请列表 shish 2021.1.28
+    public static function getApplyList($where)
+    {
+        $data = ApplyClass::getList('*', $where, 'addTime DESC');
+        $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+        if (empty($list)) {
+            return $data;
+        }
+        //商家信息
+        $oldList = array_column($list, 'introSjId');
+        $merchantIdList = array_column($list, 'merchantId');
+        $ids = array_merge($merchantIdList, $oldList);
+        $ids = array_unique(array_filter($ids));
+        $merchant = MerchantClass::getMerchantByIds($ids);
+
+        $applyIds = array_unique(array_filter(array_column($list, 'id')));
+        $extend = ApplyExtendClass::getExtendByIds($applyIds);
+
+        foreach ($list as $key => $val) {
+            $currentId = $val['id'] ?? 0;
+            $list[$key]['licenseNo'] = $extend[$currentId]['licenseNo'] ?? '';
+            $list[$key]['license'] = $extend[$currentId]['license'] ?? '';
+            $introSjId = $val['introSjId'];
+            $introSjName = $merchant[$introSjId]['merchantName'] ?? '';
+            $list[$key]['introSjName'] = $introSjName;
+        }
+        $data['list'] = $list;
+        $data['balance'] = 0.00;
+        $data['invitedNum'] = 10;
+        $data['payNum'] = 5;
+        $data['income'] = 100;
+        return $data;
+    }
+
+    //审核通过
+    public static function pass($id)
+    {
+        $apply = ApplyClass::getById($id);
+        if (empty($apply)) {
+            util::fail('没有找到申请记录');
+        }
+        $apply['merchantName'] = isset($apply['name']) ? $apply['name'] : '';
+        $adminId = $apply['adminId'];
+        $admin = AdminClass::getById($adminId);
+        $apply['adminName'] = isset($admin['adminName']) ? $admin['adminName'] : '';
+        return MerchantClass::generateMerchant($apply);
+    }
+
+    //申请开店 shish 2021.01.28
+    public static function addApply($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('请填写手机号');
+        }
+        if (stringUtil::isMobile($mobile) == false) {
+            util::fail('请填写正确手机号');
+        }
+        $adminId = $data['adminId'] ?? 0;
+        $apply = ApplyClass::getByCondition(['mobile' => $mobile, 'style' => $style]);
+        if (!empty($apply)) {
+            util::fail('手机号已被使用');
+        }
+        $from = $data['from'] ?? 0;
+        if (in_array($from, [ApplyClass::FROM_GHS, ApplyClass::FROM_RETAIL]) == false) {
+            util::fail('请确认开店资料是否完整!');
+        }
+        $apply = ApplyClass::getByCondition(['adminId' => $adminId, 'from' => $from, 'style' => $style]);
+        if (!empty($apply)) {
+            util::fail('您已经申请过了');
+        }
+        $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;
+        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');
+    }
+
 }

+ 6 - 1
sql.sql

@@ -1011,4 +1011,9 @@ UPDATE `xhApply` SET `status`=1;
 ALTER TABLE `xhMerchant` DROP COLUMN `setDeadline`;
 ALTER TABLE `xhMerchant` DROP COLUMN `deadline`;
 ALTER TABLE `xhMerchant` ADD `deadline` DATETIME NOT NULL DEFAULT '00000-00-00 00:00:00' COMMENT '帐号过期时间' AFTER setId;
-UPDATE `xhMerchant` SET deadline='2022-07-09 12:00:00';
+UPDATE `xhMerchant` SET deadline='2022-07-09 12:00:00';
+
+nginx增加
+"~^http://ghs.huahb.com" http://ghs.huahb.com;
+"~^https://ghs.huahb.com" https://ghs.huahb.com;
+增加ghs.huahb.com的nginx配置 增加api.ghs.huahb.com的nginx配置 增加二者的https访问