Pārlūkot izejas kodu

生成联调参数

PC-202304251453\Administrator 6 mēneši atpakaļ
vecāks
revīzija
f10a924f01

+ 2 - 2
app/v1/controller/advert/AgentSiteController.php

@@ -68,7 +68,7 @@ class AgentSiteController extends BaseController
         return $this->success($data);
     }
 
-        /**
+    /**
      * 获取头条账号
      */
     public function getTtAccountOptions(Request $request): Response
@@ -77,7 +77,7 @@ class AgentSiteController extends BaseController
         return $this->success($data);
     }
 
-        /**
+    /**
      * 导出分包标识数据
      * @param Request $request
      * @return Response

+ 43 - 51
app/v1/logic/advert/AgentSiteLogic.php

@@ -250,43 +250,43 @@ class AgentSiteLogic extends BaseLogic
              $mediaArr = $this->getTtMediaConfig();
             
              foreach ($site_ids as $val) {
-                    $site_id = $val;
-                    $agent_id = $agentSiteList[$val]['agent_id'];
-                    $group_name = $toutiaoGameData[$game_id]['name'].'_'.$val;
-                   // $error 长度
-                   if(count($error)>0){
-                        $fail2++;
-                        continue;
-                   }
-
-                    if($toutiaoGameData[$game_id]['ios_appid']>0){
-                        $apiurl = $mediaArr[0]['iosurl'];
-                        $downloadurl = 'https://itunes.apple.com/cn/app/id'.$toutiaoGameData[$game_id]['ios_appid'];
-                    } else {
-                        $apiurl = $mediaArr[0]['andurl'];
-                        $downloadurl = 'https://apps.bytesfield.com/download/extend/cur/'.$toutiaoGameData[$game_id]['tt_package_id'].'/'.$toutiaoGameData[$game_id]['id'].'_'.$agent_id.'_'.$val;
-                    }
-                    $yfinfo = $game_id.'_'.$agent_id.'_'.$site_id;
-                    $click_url = str_replace('__YFINFO__', $yfinfo, $apiurl);
-                    $values = [
-                        'game_id'       => $game_id,
-                        'gid'           => $game_id,
-                        'agent_id'      => $agent_id,
-                        'site_id'       => $site_id,
-                        'advertiser_id' => $advertiser_id,
-                        'assets_id'     => $asset_id,
-                        'download_url'  => $downloadurl,
-                        'click_url'     => $click_url,
-                        'group_name'    => $group_name,
-                    ];
-                    $result = Db::connect('db_advert_log')->table('ad_jrtt_asset')->insert($values);
-                    if($result){
-                        $succ2 ++;
-                    } else {
-                        $fail2 ++;
-                    }
+                $site_id = $val;
+                $agent_id = $agentSiteList[$val]['agent_id'];
+                $group_name = $toutiaoGameData[$game_id]['name'].'_'.$val;
+                // $error 长度
+                if(count($error)>0){
+                    $fail2++;
+                    continue;
+                }
+
+                if($toutiaoGameData[$game_id]['ios_appid']>0){
+                    $apiurl = $mediaArr[0]['iosurl'];
+                    $downloadurl = 'https://itunes.apple.com/cn/app/id'.$toutiaoGameData[$game_id]['ios_appid'];
+                } else {
+                    $apiurl = $mediaArr[0]['andurl'];
+                    $downloadurl = 'https://apps.bytesfield.com/download/extend/cur/'.$toutiaoGameData[$game_id]['tt_package_id'].'/'.$toutiaoGameData[$game_id]['id'].'_'.$agent_id.'_'.$val;
+                }
+                $yfinfo = $game_id.'_'.$agent_id.'_'.$site_id;
+                $click_url = str_replace('__YFINFO__', $yfinfo, $apiurl);
+                $values = [
+                    'game_id'       => $game_id,
+                    'gid'           => $game_id,
+                    'agent_id'      => $agent_id,
+                    'site_id'       => $site_id,
+                    'advertiser_id' => $advertiser_id,
+                    'assets_id'     => $asset_id,
+                    'download_url'  => $downloadurl,
+                    'click_url'     => $click_url,
+                    'group_name'    => $group_name,
+                ];
+                $result = Db::connect('db_advert_log')->table('ad_jrtt_asset')->insert($values);
+                if($result){
+                    $succ2 ++;
+                } else {
+                    $fail2 ++;
                 }
-            } 
+            }
+        }
         return ['message' => "分包推送".$succ.",转化推送成功".$succ2.",失败".$fail2];
     }
 
@@ -307,29 +307,21 @@ class AgentSiteLogic extends BaseLogic
         // 包名
         $package_name = $game['package_name'];
 
-        // 点击监测链接
-        $click_url = '';
-
-
         // 根据媒体ID读取监测链接
         $media_info = $this->mediaListLogic->read($data['media_id']);
-     
+
+        // 点击监测链接
+        $click_url = '';
         if($media_info && $game['os'] ==1){
             $click_url = $media_info['andurl'];
-            $click_url = str_replace('__SITE__', $siteInfo, $click_url);
         } else if($media_info && $game['os'] ==2){
             $click_url = $media_info['iosurl'];
-            $click_url = str_replace('__SITE__', $siteInfo, $click_url);
         } else if($media_info && ($game['os'] ==3 || $game['os'] ==4)){
             $click_url = $media_info['xyxurl'];
-            // $media_info['xyxurl'] 可能没有值
-            if($click_url = $media_info['xyxurl']){
-                 $click_url = str_replace('__YFINFO__', $siteInfo, $click_url);
-            }
+            // 小游戏路径参数
+            $wxgamepro ="?media_id=".$siteInfo."&ext_channel=".$media_info['channel_name'].$media_info['appleturl'];
         }
-
-        // 小游戏路径参数
-        $wxgamepro ="?media_id=".$siteInfo."&ext_channel=".$media_info['channel_name'].$media_info['appleturl'];
+        $click_url = str_replace('__SITE__', $siteInfo, $click_url);
 
 
         return [
@@ -337,7 +329,7 @@ class AgentSiteLogic extends BaseLogic
             'appid' => $appid,
             'package_name' => $package_name,
             'click_url' => $baseUrl.$click_url,
-            'wxgamepro' => $wxgamepro,
+            'wxgamepro' => $wxgamepro ?? "",
         ];
     }
 }