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,