cqp 2 月之前
父節點
當前提交
35b8f3c7da
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      app/Service/Weixin/WxTemplateMessageService.php

+ 8 - 4
app/Service/Weixin/WxTemplateMessageService.php

@@ -41,10 +41,14 @@ class WxTemplateMessageService extends WeixinService
             if ($jumpType === 'h5') {
                 $payload['url'] = $options['url'] ?? '';
             } elseif ($jumpType === 'mp') {
-                $payload['miniprogram'] = [
-                    'appid' => config('wx_msg.appid'),
-                    'pagepath' => $options['pagepath'] ?? '',
-                ];
+                if(empty($options['pagepath'])){
+                    $payload['url'] = '';
+                }else{
+                    $payload['miniprogram'] = [
+                        'appid' => config('wx_msg.appid'),
+                        'pagepath' => $options['pagepath'] ?? '',
+                    ];
+                }
             }
 
             $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={$token}";