shish пре 5 година
родитељ
комит
684905ec1d

+ 12 - 19
app/ghs/controllers/ApplyController.php

@@ -2,6 +2,7 @@
 
 namespace ghs\controllers;
 
+use biz\merchant\classes\MerchantClass;
 use bizGhs\shop\services\ShopAdminService;
 use biz\saas\services\ApplyService;
 use biz\wx\services\WxBaseService;
@@ -16,7 +17,7 @@ use yii\web\Controller;
 
 class ApplyController extends BaseController
 {
-
+	
 	//我的代理 shish 2019.12.26
 	public function actionList()
 	{
@@ -49,27 +50,19 @@ class ApplyController extends BaseController
 		ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
 		util::success('操作成功');
 	}
-
+	
 	//申请试用,花店添加新客户 shish 2021.1.8
 	public function actionRegister()
 	{
-		$get = Yii::$app->request->get();
-		$get['adminId'] = $this->adminId;
-		$get['long'] = isset($get['longitude']) ? $get['longitude'] : '';
-		$get['lat'] = isset($get['latitude']) ? $get['latitude'] : '';
-		$mobile = isset($get['mobile']) && !empty($get['mobile']) && stringUtil::isMobile($get['mobile']) ? $get['mobile'] : 0;
-		if (empty($mobile)) {
-			util::fail('请填写正确手机号');
-		}
-		$admin = AdminService::getById($this->adminId);
-		ApplyService::addApply($get);
-		$wxBase = WxBaseService::getWxBase();
-		$wxAliasName = isset($wxBase['wxAliasName']) && !empty($wxBase['wxAliasName']) ? $wxBase['wxAliasName'] : 'ihuahuibao';
-		$focus = isset($admin['subscribe']) ? $admin['subscribe'] : 0;
-		$data = ['focus' => $focus, 'wxAliasName' => $wxAliasName];
-		util::success($data);
+		$post = Yii::$app->request->post();
+		$post['adminId'] = $this->adminId;
+		$post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
+		$post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
+		$post['from'] = ApplyClass::FROM_GHS;
+		ApplyService::addApply($post);
+		util::complete();
 	}
-
+	
 	//申请状态
 	public function actionApplyStatus()
 	{
@@ -93,5 +86,5 @@ class ApplyController extends BaseController
 		$mobile = Yii::$app->request->get('mobile');
 		util::success(['code' => rand(1111, 9999)]);
 	}
-
+	
 }

+ 14 - 19
app/shop/controllers/ApplyController.php

@@ -16,7 +16,7 @@ use yii\web\Controller;
 
 class ApplyController extends BaseController
 {
-
+	
 	//我的代理 shish 2019.12.26
 	public function actionList()
 	{
@@ -53,27 +53,22 @@ class ApplyController extends BaseController
 	//申请试用 shish 2020.1.11
 	public function actionRegister()
 	{
-		$get = Yii::$app->request->get();
-		$get['adminId'] = $this->adminId;
-		$get['long'] = isset($get['longitude']) ? $get['longitude'] : '';
-		$get['lat'] = isset($get['latitude']) ? $get['latitude'] : '';
-		$introSjId = isset($get['introSjId']) && !empty($get['introSjId']) ? $get['introSjId'] : 0;
-		if (empty($introSjId)) {
-			util::fail('只有邀请了才能注册哦~');
+		$post = Yii::$app->request->post();
+		$post['adminId'] = $this->adminId;
+		$post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
+		$post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
+		$post['from'] = ApplyClass::FROM_RETAIL;
+		$style = $post['style'] ?? MerchantClass::STYLE_RETAIL;
+		if (isset($post['mobile']) == false) {
+			util::fail('请填写手机号');
 		}
-		$mobile = isset($get['mobile']) && !empty($get['mobile']) && stringUtil::isMobile($get['mobile']) ? $get['mobile'] : 0;
-		if (empty($mobile)) {
+		if (stringUtil::isMobile($post['mobile']) == false) {
 			util::fail('请填写正确手机号');
 		}
-		$admin = AdminService::getById($this->adminId);
-		ApplyService::addApply($get);
-		$wxBase = WxBaseService::getWxBase();
-		$wxAliasName = isset($wxBase['wxAliasName']) && !empty($wxBase['wxAliasName']) ? $wxBase['wxAliasName'] : 'ihuahuibao';
-		$focus = isset($admin['subscribe']) ? $admin['subscribe'] : 0;
-		$data = ['focus' => $focus, 'wxAliasName' => $wxAliasName];
-		util::success($data);
+		ApplyService::addApply($post);
+		util::complete();
 	}
-
+	
 	//申请状态
 	public function actionApplyStatus()
 	{
@@ -97,5 +92,5 @@ class ApplyController extends BaseController
 		$mobile = Yii::$app->request->get('mobile');
 		util::success(['code' => rand(1111, 9999)]);
 	}
-
+	
 }

+ 25 - 20
biz/saas/classes/ApplyClass.php

@@ -12,26 +12,31 @@ use biz\base\classes\BaseClass;
 class ApplyClass extends BaseClass
 {
 
-    public static $baseFile = '\biz\saas\models\Apply';
+	public static $baseFile = '\biz\saas\models\Apply';
 
-    //添加申请 shish 2020.2.10
-    public static function addApply($data)
-    {
-        //邀请人数+1
-        $introSjId = isset($data['introSjId']) ? $data['introSjId'] : '';
-        if (!empty($introSjId)) {
-            $agent = AgentAssetClass::getByCondition(['merchantId' => $introSjId], true);
-            if (empty($agent)) {
-                $time = time();
-                $agent = AgentAssetClass::add(['merchantId' => $introSjId, 'addTime' => $time], true);
-            }
-            $agent->inviteNum += 1;
-            $agent->save();
-        }
-        $time = time();
-        $data['addTime'] = $time;
-        $data['updateTime'] = $time;
-        return self::add($data);
-    }
+	//来自零售平台
+	const FROM_RETAIL = 1;
+	//来自供货商平台
+	const FROM_GHS = 2;
+
+	//添加申请 shish 2020.2.10
+	public static function addApply($data)
+	{
+		//邀请人数+1
+		$introSjId = isset($data['introSjId']) ? $data['introSjId'] : '';
+		$date = date("Y-m-d H:i:s");
+		if (!empty($introSjId)) {
+			$agent = AgentAssetClass::getByCondition(['merchantId' => $introSjId], true);
+			if (empty($agent)) {
+				$agent = AgentAssetClass::add(['merchantId' => $introSjId, 'addTime' => $time], true);
+			}
+			$agent->inviteNum += 1;
+			$agent->save();
+		}
+		$apply = self::add($data);
+		$id = $apply['id'];
+		$data['applyId'] = $id;
+		ApplyExtendClass::add($data);
+	}
 
 }

+ 17 - 0
biz/saas/classes/ApplyExtendClass.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace biz\saas\classes;
+
+use biz\admin\classes\ShopAdminClass;
+use biz\agent\classes\AgentAssetClass;
+use common\components\sms;
+use common\components\stringUtil;
+use common\components\util;
+use biz\base\classes\BaseClass;
+
+class ApplyExtendClass extends BaseClass
+{
+
+	public static $baseFile = '\biz\saas\models\ApplyExtend';
+
+}

+ 15 - 0
biz/saas/models/ApplyExtend.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace biz\saas\models;
+
+use biz\base\models\Base;
+
+class ApplyExtend extends Base
+{
+	
+	public static function tableName()
+	{
+		return 'xhApplyExtend';
+	}
+	
+}

+ 25 - 0
biz/saas/services/ApplyExtendService.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace biz\saas\services;
+
+use biz\admin\classes\AdminClass;
+use biz\admin\classes\ShopAdminClass;
+use biz\admin\services\AdminService;
+use biz\agent\classes\AgentAssetClass;
+use biz\base\services\BaseService;
+use biz\merchant\classes\MerchantClass;
+use biz\merchant\services\MerchantService;
+use biz\saas\classes\ApplyClass;
+use biz\user\classes\UserClass;
+use biz\user\services\UserService;
+use common\components\noticeUtil;
+use common\components\stringUtil;
+use common\components\util;
+use common\services\xhMerchantService;
+
+class ApplyExtendService extends BaseService
+{
+	
+	public static $baseFile = '\biz\saas\classes\ApplyExtendClass';
+
+}

+ 36 - 40
biz/saas/services/ApplyService.php

@@ -63,58 +63,54 @@ class ApplyService extends BaseService
 		return MerchantClass::generateMerchant($apply);
 	}
 	
-	//新增推荐 shish 2020.2.27
+	//申请开店 shish 2021.01.28
 	public static function addApply($data)
 	{
-		$mobile = isset($data['mobile']) ? $data['mobile'] : 0;
-		if (stringUtil::isMobile($mobile) == false) {
+		$mobile = $data['mobile'] ?? 0;
+		if (empty($mobile)) {
 			util::fail('请填写手机号');
 		}
-		$apply = self::getByCondition(['mobile' => $mobile]);
+		if (stringUtil::isMobile($mobile) == false) {
+			util::fail('请填写正确手机号');
+		}
+		$adminId = $data['adminId'] ?? 0;
+		$apply = ApplyClass::getByCondition(['mobile' => $mobile]);
 		if (!empty($apply)) {
 			util::fail('手机号已被使用');
 		}
-		$apply = self::getByCondition(['adminId' => $data['adminId']]);
-		if (!empty($apply)) {
-			util::fail('您已申请过了');
+		$style = $data['style'] ?? 0;
+		if (in_array($style, [MerchantClass::STYLE_RETAIL, MerchantClass::STYLE_SUPPLIER]) == false) {
+			util::fail('请确认开店资料');
 		}
-		$shopAdmin = ShopAdminClass::getByCondition(['adminId' => $data['adminId']]);
-		if (!empty($shopAdmin)) {
-			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 = isset($data['dist']) ? $data['dist'] : '';
-		$floor = isset($data['floor']) ? $data['floor'] : '';
-		$data['fullAddress'] = $prefix . $dist . $data['address'] . $floor;
+		$dist = $data['dist'] ?? '';
+		$floor = $data['floor'] ?? '';
+		$address = $data['address'] ?? '';
+		$data['fullAddress'] = $prefix . $dist . $address . $floor;
+		ApplyClass::addApply($data);
 		$mobile = $data['mobile'];
-		noticeUtil::push('客户 ' . $mobile . ' 已提交开店资料,请及时跟进', '15280215347');
-		return ApplyClass::addApply($data);
-	}
-	
-	//供货商新增客户 shish 2021.1.10
-	public static function addCustom($data, $merchantId)
-	{
-		$mobile = isset($data['mobile']) ? $data['mobile'] : 0;
-		if (stringUtil::isMobile($mobile) == false) {
-			util::fail('请填写手机号');
-		}
-		$apply = self::getByCondition(['mobile' => $mobile]);
-		if (!empty($apply)) {
-			util::fail('手机号已被使用');
+		if ($style == MerchantClass::STYLE_RETAIL) {
+			$text = "零售申请开店,";
+		} else {
+			$text = "供货商申请开店,";
 		}
-		$currentAddress = $data['address'] ?? '';
-		if (isset($data['province']) && isset($data['city'])) {
-			$prefix = $data['province'] == $data['city'] ? $data['province'] : $data['province'] . $data['city'];
+		$text .= '客户(' . $mobile . ')已提交资料,';
+		$introSjId = $data['introSjId'] ?? 0;
+		if (!empty($introSjId)) {
+			$merchant = MerchantClass::getMerchantById($introSjId);
+			$name = $merchant['merchantName'] ?? '';
+			$text .= "介绍人:{$name},";
 		}
-		$dist = isset($data['dist']) ? $data['dist'] : '';
-		$floor = isset($data['floor']) ? $data['floor'] : '';
-		$data['fullAddress'] = $prefix . $dist . $currentAddress . $floor;
-		$data['introSjId'] = $merchantId;
-		$data['introStyle'] = MerchantClass::STYLE_SUPPLIER;
-		$mobile = $data['mobile'];
-		noticeUtil::push('客户 ' . $mobile . ' 已由供货商提交开店资料,请及时跟进', '15280215347');
-
-		return ApplyClass::addApply($data);
+		$text .= "请及时跟进";
+		noticeUtil::push($text, '15280215347');
 	}
-	
+
 }

+ 25 - 5
sql.sql

@@ -108,8 +108,8 @@ alter table xhMerchantItemRank add merchantId int not null default 0 comment ''
 ALTER TABLE xhAdmin ADD identity TINYINT NOT NULL DEFAULT 0 COMMENT '身份 0未知 1花粉 2花店员工' AFTER `mobile`;
 ALTER TABLE xhMerchant ADD `style` TINYINT NOT NULL DEFAULT 0 COMMENT '商家类型 0普通 1零售商使用 2供货商使用' AFTER `id`;
 
-==在开发环境,找到【花美玲】将style设置为1,找到【花掌柜】将style设置为2,如果找不到,则去走流程创建
-==在线上环境,找到【花卉宝】将style设置为1,找到【销花宝】将style设置为2,如果找不到,则去走流程创建
+==在开发环境 找到 花美玲 将style设置为1 找到 花掌柜 将style设置为2 如果找不到 则去走流程创建
+==在线上环境 找到 花卉宝 将style设置为1 找到 销花宝 将style设置为2 如果找不到 则去走流程创建
 ===注意 xhWxOpen wxMiniBaseId wxBaseId wxGhsBaseId wxGhsMiniBaseId 相关字段的修改
 ===注意 BaseId GhsBaseId GhsMiniBaseId 表记录的增加
 
@@ -806,7 +806,7 @@ ALTER TABLE xhGhsOrder ADD `totalFlow` TINYINT(4) NOT NULL DEFAULT '5' COMMENT '
 ALTER TABLE xhGhsOrder ADD `currentFlow` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '完成流程数,当前流程数' AFTER `totalFlow`;
 
 =====
-==linqh 2021.1.22
+==linqh 20210122
 
 ALTER TABLE `xhGhsCheckOrder`
 CHANGE COLUMN `orderStatus` `status`  tinyint(2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '盘点订单状态: 1草稿,2完成' AFTER `orderSn`,
@@ -824,7 +824,7 @@ MODIFY COLUMN `addTime`  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `new
 MODIFY COLUMN `updateTime`  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `addTime`;
 
 ====
-==linqh 2021.1.23
+==linqh 20210123
 RENAME TABLE  xhGhsStockOrder TO  xhGhsStockOutOrder
 ALTER TABLE `xhGhsStockOutOrder`
 CHANGE COLUMN `orderStatus` `status`  tinyint(2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单状态: 1待出库,2已出库  3取消出库' AFTER `orderSn`,
@@ -985,4 +985,24 @@ ALTER TABLE `xhGhsOrder` ADD `modPrice` TINYINT(4) NOT NULL DEFAULT '1' COMMENT
 ALTER TABLE `xhApplyExtend` DROP COLUMN `createTime`;
 ALTER TABLE `xhApplyExtend` DROP COLUMN `updateTime`;
 ALTER TABLE `xhApplyExtend` ADD `addTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间' AFTER `email`;
-ALTER TABLE `xhApplyExtend` ADD `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间' AFTER `addTime`;
+ALTER TABLE `xhApplyExtend` ADD `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间' AFTER `addTime`;
+
+=============
+==shish 20210128
+还有余额的客户要导给国兰
+等级和积分需要同步
+
+===================
+== shish 20210128
+ALTER TABLE `xhMerchant` MODIFY `manageStyle` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '经营类型,0零售 1花艺培训学校 2批发商(此字段应弃用)';
+ALTER TABLE `xhApply` ADD main TINYINT NOT NULL DEFAULT 1 COMMENT '零售店的主营业务 1零售 2花艺培训' AFTER `style`;
+ALTER TABLE `xhApply` ADD nickName VARCHAR(30) NOT NULL DEFAULT '' COMMENT '店长昵称' AFTER `adminName`;
+ALTER TABLE `xhUnionUser` DROP COLUMN `createTime`;
+ALTER TABLE `xhUnionUser` DROP COLUMN `updateTime`;
+ALTER TABLE `xhUnionUser` ADD `addTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间' AFTER `mobile`;
+ALTER TABLE `xhUnionUser` ADD `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间' AFTER `addTime`;
+
+将 销花宝 花卉宝 花掌柜 花美玲 的公众号和小程序 绑定到同一个开放平台下
+
+ALTER TABLE `xhApply` MODIFY `from` TINYINT NOT NULL DEFAULT 1 COMMENT '来源平台 1零售平台 2供货商平台';
+ALTER TABLE `xhApplyExtend` ADD applyId INT NOT NULL DEFAULT 0 COMMENT '申请id' AFTER `id`;