123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Service;
- use App\Models\AdPlacement;
- use App\Support\DouYinApi;
- class AdService
- {
- public static function getAdPlacement($appId, $type) {
- list($list, $count) = AdPlacement::searchData([
- 'app_id' => $appId, 'status' => 1, 'type' => $type], 1, 1);
- if(0 == $count) { return '';}
- $adPlacementInfo = $list->first();
- return $adPlacementInfo->ad_placement_id ?? '';
- }
- public static function syncAdPlacement($appId) {
- $response = DouYinApi::syncAdPlacement($appId);
- if(!empty($response)) {
- return AdPlacement::saveData($appId, $response['ad_placement_list']);
- }
- return false;
- }
- }
|