From dc5d4580479cdfea1907b06fadaa340ec44b76c1 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Thu, 20 Jun 2024 11:59:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E9=85=8D=E9=80=81?= =?UTF-8?q?=E5=95=86=E5=85=A5=E9=A9=BB=E5=A2=9E=E5=8A=A0=E8=B5=A0=E9=80=81?= =?UTF-8?q?=E5=93=81=E7=89=8C=E9=A2=9D=E5=BA=A6=E4=BF=A1=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=AF=B9=E5=BA=94=E9=A2=9D=E5=BA=A6=E7=BC=B4?= =?UTF-8?q?=E8=B4=B9=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../marketing/AgentApplyRepository.php | 21 +++++++++++++++++-- .../marketing/AgentRepository.php | 3 +++ app/controller/admin/marketing/Agent.php | 3 +++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/common/repositories/marketing/AgentApplyRepository.php b/app/common/repositories/marketing/AgentApplyRepository.php index 49c3c47..6c2406c 100644 --- a/app/common/repositories/marketing/AgentApplyRepository.php +++ b/app/common/repositories/marketing/AgentApplyRepository.php @@ -4,6 +4,7 @@ namespace app\common\repositories\marketing; use app\common\dao\marketing\AgentApplyDao; use app\common\model\marketing\Agent; +use app\common\model\marketing\agent\AgentDelivery; use app\common\model\marketing\AgentApply; use app\common\model\user\User; use app\common\repositories\BaseRepository; @@ -149,6 +150,9 @@ class AgentApplyRepository extends BaseRepository{ $config = app()->make(AgentRepository::class)->getConfig(); $inviteLimit = $config['invite_limit'] ?? []; $applyInfo = $this->getSearchModel(['id'=>$params['id']])->findOrEmpty()->toArray(); + + $giveTitleQuota = 0;// 赠送冠名品牌额度 + $giveOtherQuota = 0;// 赠送其他品牌额度 switch($applyInfo['agent_type']){ case 2: // 判断:当前上级招募 [省公司发起人] 数量是否超出限制 @@ -198,6 +202,9 @@ class AgentApplyRepository extends BaseRepository{ if(($inviteLimit['invite_6_8'] ?? 0) <= $hasCount) { throw new ValidateException('邀请人招募数量超出限制!仅允许招募 '.($inviteLimit['invite_6_8'] ?? 0).' 家配送商'); } + // 赠送品牌额度 + $giveTitleQuota = $config['delivery_give_title_quota'] ?? 0; + $giveOtherQuota = $config['delivery_give_other_quota'] ?? 0; break; case 9: // 判断:当前上级招募 [总部外勤] 数量是否超出限制 @@ -215,11 +222,10 @@ class AgentApplyRepository extends BaseRepository{ break; } // 通过处理 - return Db::transaction(function() use ($params, $applyInfo){ + return Db::transaction(function() use ($params, $applyInfo, $giveTitleQuota, $giveOtherQuota){ // 修改状态 $this->dao->update($params['id'],['status'=>$params['status']]); // 生成代理信息 - // $applyInfo = $this->getSearchModel(['id'=>$params['id']])->findOrEmpty()->toArray(); $keys = array_flip((array)[ "uid", "pid", @@ -283,6 +289,17 @@ class AgentApplyRepository extends BaseRepository{ ]; app()->make(StoreServiceRepository::class)->createInfo($staffData); } + // 判断:如果是配送商 赠送相关品牌额度 + if((float)$giveTitleQuota > 0 || (float)$giveOtherQuota > 0){ + AgentDelivery::insert([ + 'agent_id' => $agentId, + 'price' => $applyInfo['orderInfo']['pay_price'] ?? 0, + 'title_quota' => (float)$giveTitleQuota, + 'other_quota' => (float)$giveOtherQuota, + 'order_id' => $applyInfo['order_id'] > 0 ? $applyInfo['order_id'] : NULL, + 'status' => 1 + ]); + } }); } diff --git a/app/common/repositories/marketing/AgentRepository.php b/app/common/repositories/marketing/AgentRepository.php index 1c11d4e..c58f0fb 100644 --- a/app/common/repositories/marketing/AgentRepository.php +++ b/app/common/repositories/marketing/AgentRepository.php @@ -404,6 +404,9 @@ class AgentRepository extends BaseRepository{ 'external_personnel_process', 'external_personnel_money_platform', 'external_personnel_money_initiator', + // 配送商赠送品牌额度 + 'delivery_give_title_quota', + 'delivery_give_other_quota', // 邀请限制 'invite_limit', // 配送商缴费设置 diff --git a/app/controller/admin/marketing/Agent.php b/app/controller/admin/marketing/Agent.php index da291f2..114ba83 100644 --- a/app/controller/admin/marketing/Agent.php +++ b/app/controller/admin/marketing/Agent.php @@ -425,6 +425,9 @@ class Agent extends BaseController{ ['external_personnel_process',0], ['external_personnel_money_platform',0], ['external_personnel_money_initiator',0], + // 配送商赠送品牌额度 + ['delivery_give_title_quota',0], + ['delivery_give_other_quota',0], // 邀请限制 ['invite_limit',[]], // 配送商缴费设置