<?php
/**
 *  ╔═══════════════════════════════════════════════════╗
 *  ║                                                   ║
 *  ║     ██╗  ██╗   █████╗    ██████╗                  ║
 *  ║     ██║  ██║  ██╔══██╗  ██╔═══██╗                 ║
 *  ║     ███████║  ███████║  ██║   ██║                 ║
 *  ║     ██╔══██║  ██╔══██║  ██║   ██║                 ║
 *  ║     ██║  ██║  ██║  ██║  ╚██████╔╝   SNS           ║
 *  ║                                                   ║    
 *  ║                                                   ║    
 *  ║     © 2023 HaoSNS™ All Rights Reserved            ║
 *  ║     官方网站: https://www.haosns.com                *
 *  ║     本代码由赣州乐易网络科技有限公司®提供             *
 *  ║                                                    *
 *  ║   未经授权禁止复制、传播或用于其他商业目的            *
 *  ║                                                   ║
 *  ╚═══════════════════════════════════════════════════╝
 */


namespace app\api\logic;

use app\common\enum\AdEnum;
use app\common\logic\BaseLogic;
use app\common\model\Ad;
use app\common\service\FileService;

class AdLogic extends BaseLogic
{
    /**
     * @notes 获取广告
     * @param $params
     * @return array
     */
    public static function lists($params)
    {
 
        $lists = Ad::where([
            'pid' => $params['pid'],
            'status' => AdEnum::STATUS_OPEN
        ])->select()->toArray();

        
        foreach($lists as &$item){
            $item['image'] = FileService::getFileUrl($item['image']);
        }
        return $lists;
    }

}