增加:配送商入驻增加赠送品牌额度信息,并且审核通过后生成对应额度缴费记录
This commit is contained in:
parent
f807be9ead
commit
dc5d458047
|
|
@ -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
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
// 配送商缴费设置
|
||||
|
|
|
|||
|
|
@ -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',[]],
|
||||
// 配送商缴费设置
|
||||
|
|
|
|||
Loading…
Reference in New Issue