From 08979d418734ab7beee1461b07ebe5192ff34588 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Thu, 4 Aug 2022 10:31:56 +0800 Subject: [PATCH] app --- app/Services/DistributeService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Services/DistributeService.php b/app/Services/DistributeService.php index eb67cfeb..489cc2e4 100644 --- a/app/Services/DistributeService.php +++ b/app/Services/DistributeService.php @@ -6,6 +6,7 @@ use App\Models\{User, Order, SalesValueLog, Agent, OrderProfit}; use App\Services\Payment\WxpayService; use App\Enums\SocialiteType; use App\Exceptions\BizException; +use App\Exceptions\WeChatPayException; /** * 分销模块 @@ -164,6 +165,9 @@ class DistributeService { $user = $profit->user; $openid = $user->socialites()->where('socialite_type', SocialiteType::WechatMiniProgram->value)->value('socialite_id'); + if (!$openid) { + throw new WeChatPayException('没有 openid'); + } $result = (new WxpayService())->transfer([ 'partner_trade_no' => $profit->pay_no, 'openid' => $openid,