Browse Source

fix:合在一起

super-yimizi 16 hours ago
parent
commit
f3b9259451
1 changed files with 4 additions and 25 deletions
  1. 4 25
      application/api/controller/commission/Agent.php

+ 4 - 25
application/api/controller/commission/Agent.php

@@ -298,7 +298,8 @@ class Agent extends Commission
         // 使用ShareEnum获取平台ID (1=H5,2=微信公众号网页,3=微信小程序,4=App)
         $platformId = ShareEnum::getPlatformId($shareEnumPlatform);
         $fromPlatformId = $platformId; // 来源平台同当前平台
-        
+        $commissionConfig = ShopConfigService::getConfigs('shop.commission');
+            
         // try {
             // 初始化微信服务 - 固定使用微信小程序平台生成小程序码
             $wechatPlatform = ChannelEnum::CHANNEL_WECHAT_MINI_PROGRAM;
@@ -340,7 +341,7 @@ class Agent extends Commission
                 $result = [
                     'qrcode_base64' => 'data:image/png;base64,' . $qrcodeBase64,
                     'invite_code' =>$agent->invite_code? $agent->invite_code : '',
-                    'poster_background' => $this->getPosterBackground()
+                    'poster_background' => !empty($commissionConfig['poster_background_image']) ? cdnurl($commissionConfig['poster_background_image'], true) : '',
                 ];
                 
                 $this->success('生成成功', $result);
@@ -374,29 +375,7 @@ class Agent extends Commission
         return $channelToShareMap[$channelPlatform] ?? ShareEnum::PLATFORM_WECHAT_MINI_PROGRAM; // 默认微信小程序
     }
 
-    /**
-     * 获取海报背景图
-     * @return string
-     */
-    private function getPosterBackground()
-    {
-        try {
-            // 获取分销配置
-            $commissionConfig = ShopConfigService::getConfigs('shop.commission');
-            
-            // 获取海报背景图
-            $backgroundImage = $commissionConfig['poster_background_image'] ?? '';
-            
-            if (!empty($backgroundImage)) {
-                return cdnurl($backgroundImage, true);
-            }
-            
-            return '';
-        } catch (\Exception $e) {
-            return '';
-        }
-    }
-    
+