$appId, 'type' => $type, 'keyword' => $keyword, 'status' => $status ], $page, $pageSize); # 小程序名称信息 $appConfig = config('douyin.app_info'); # 广告位类型信息 $typeArr = AdPlacement::AD_PLACEMENT_TYPE; # 数据格式化 foreach($list as $value) { $typeName = $typeArr[$value->type] ?? ''; $value->type_name = $typeName; $appName = $appConfig[$value->app_id]['app_name'] ?? ''; $value->app_name = $appName; } return [$list, $count]; } public static function adCreate($appId, $type, $adName) { $douRes = DouYinApi::adPlacementAdd($appId, $type, $adName); if(!$douRes) return 400; # 抖音平台不会直接返回广告位ID,因此需要主动同步 $res = AdService::syncAdPlacement($appId); if(!$res) return 500; return 0; } public static function updateAdStatus($appId, $adPlacementId, $status) { $douRes = DouYinApi::adPlacementUpdate($appId, $adPlacementId, $status); if(!$douRes) return 400; # 更新本地数据 $res = AdPlacement::updateData($appId, $adPlacementId, $status); if(!$res) return 500; return 0; } }