修复:代理申请时 - 余额支付未成功发放邀请代理人员奖励
This commit is contained in:
parent
6960c80ba3
commit
34e9c8f788
|
|
@ -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\AgentApply;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\order\StoreOrderCreateRepository;
|
||||
|
|
@ -104,8 +105,9 @@ class AgentApplyRepository extends BaseRepository{
|
|||
case 9: $payMoney = $config['field_personnel_money'] ?? 0;break;
|
||||
case 10: $payMoney = $config['external_personnel_money'] ?? 0;break;
|
||||
}
|
||||
// 生成申请信息
|
||||
$applyInfoId = AgentApply::insertGetId($applyInfo);
|
||||
// 判断:是否需要支付 需要支付生成订单并且获取支付信息
|
||||
$orderId = 0;// 默认 无需支付、无订单信息
|
||||
if((float)$payMoney > 0){
|
||||
$userInfo = $params['user_info'] ?? [];
|
||||
$payInfo['money'] = (float)$payMoney;
|
||||
|
|
@ -118,18 +120,17 @@ class AgentApplyRepository extends BaseRepository{
|
|||
->make(StoreOrderCreateRepository::class)
|
||||
->onlinePayment($payType,$payInfo,$userInfo, 32);
|
||||
});
|
||||
$payResult = app()
|
||||
->make(StoreOrderRepository::class)
|
||||
->pay($payInfo['pay_type'],$userInfo,$groupOrder,$payInfo['return_url'],$params['is_app']);
|
||||
// 子订单只存在一个 直接查询即可
|
||||
$orderId = app()->make(StoreOrderRepository::class)
|
||||
->getSearch([])
|
||||
->where('group_order_id',$groupOrder->group_order_id)
|
||||
->value('order_id');
|
||||
AgentApply::update(['order_id'=>$orderId],['id'=>$applyInfoId]);
|
||||
$payResult = app()
|
||||
->make(StoreOrderRepository::class)
|
||||
->pay($payInfo['pay_type'],$userInfo,$groupOrder,$payInfo['return_url'],$params['is_app']);
|
||||
|
||||
}
|
||||
// 生成申请信息
|
||||
$applyInfo['order_id'] = $orderId;
|
||||
$this->dao->create($applyInfo);
|
||||
}
|
||||
|
||||
return $payResult;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace app\common\repositories\marketing;
|
|||
use app\common\dao\marketing\AgentBrokerageDao;
|
||||
use app\common\model\marketing\AgentBrokerage;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
|
|
@ -108,6 +109,7 @@ class AgentBrokerageRepository extends BaseRepository{
|
|||
$config = app()->make(AgentRepository::class)->getConfig();
|
||||
// 获取申请信息
|
||||
$applyInfo = app()->make(AgentApplyRepository::class)->getSearchModel(['order_id'=>$orderId])->findOrEmpty()->toArray();
|
||||
if(!$applyInfo) throw new ValidateException('信息不存在!');
|
||||
// 获取全部上级
|
||||
$upAllList = app()->make(AgentRepository::class)->getAllUp($applyInfo['pid']);
|
||||
$upAllList = array_column($upAllList, null, 'agent_type');
|
||||
|
|
|
|||
|
|
@ -380,9 +380,10 @@ class AgentRepository extends BaseRepository{
|
|||
* @param array $data
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getAllUp($pid,$data = []){
|
||||
public function getAllUp($pid,array $data = []){
|
||||
$info = $this->getSingleInfo($pid);
|
||||
if($info['pid'] > 0) $data = $this->getAllUp($info['pid'], $data);
|
||||
$infoPid = $info['pid'] ?? 0;
|
||||
if($infoPid > 0) $data = $this->getAllUp($infoPid, $data);
|
||||
else $data[] = $info;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,16 @@ class OrderPaySuccessEvent{
|
|||
'group_order_id' => $groupOrder->group_order_id,
|
||||
'msg' => $e->getMessage()
|
||||
];
|
||||
Log::info('支付成功 - 赠送酒卡额度 - 错误: '.var_export($data,1));
|
||||
if($groupOrder->activity_type == 30){
|
||||
// 在线支付订单
|
||||
Log::info('支付成功 - 赠送酒水卡积分 - 错误: '.var_export($data,1));
|
||||
}else if($groupOrder->activity_type == 31){
|
||||
Log::info('支付成功 - 兑换商品补差价处理 - 错误: '.var_export($data,1));
|
||||
}else if($groupOrder->activity_type == 32){
|
||||
Log::info('支付成功 - 邀请代理人员奖励及免审核 - 错误: '.var_export($data,1));
|
||||
}else{
|
||||
Log::info('支付成功 - 赠送酒卡额度 - 错误: '.var_export($data,1));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 支付成功 - 赠送酒卡额度
|
||||
|
|
@ -160,7 +169,7 @@ class OrderPaySuccessEvent{
|
|||
|
||||
return true;
|
||||
}
|
||||
// 支付成功 - 代理申请入驻支付成功
|
||||
// 支付成功 - 邀请代理人员奖励及免审核
|
||||
public function agentPaySuccessHandle($groupOrder){
|
||||
foreach($groupOrder->orderList as $orderInfo){
|
||||
app()->make(AgentBrokerageRepository::class)->inviteAgentGive((int)$orderInfo->order_id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue