| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Modules\InnerApi\Services;
- use App\Constants\AdsConstant;
- use Modules\Admin\Models\AdminUserModel;
- use Modules\Admin\Models\AdsModel;
- class CommonService
- {
- /**
- * 渠道广告列表
- * @param array $item
- * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
- */
- public function adList(array $item)
- {
- $tagStr = explode(',', $item['tag_str']);
- //获取广告
- $date = date('Y-m-d H:i:s');
- $adList = AdsModel::query()
- ->select([
- 'title',
- 'link_url',
- 'image_url',
- 'jump_type',
- 'day_status',
- 'button_content',
- 'ag_ads_content',
- 'id',
- ])
- ->whereIn('alias', $tagStr)
- ->where([
- 'channel_uid' => $item['channel_uid'],
- 'mom_app_uid' => $item['mom_app_uid'],
- 'status' => AdsConstant::STATUS_ON,
- ])->where('start_at', '<=', $date)->where('end_at', '>', $date)->orderBy('squad', 'desc')->get();
- foreach ($adList as &$ad) {
- $ad['image_url'] = getOss() . $ad['image_url'];
- }
- return $adList;
- }
- }
|