Files
mier-php/application/api/model/Banner.php

30 lines
927 B
PHP
Raw Normal View History

2025-08-11 10:22:05 +08:00
<?php
namespace app\api\model;
use think\Db;
use think\Model;
class Banner extends Model
{
//轮播图列表
public function get_banner_list()
{
$web_site_url = get_uncache_system_config('web_site');
$map = [];
$map[] = ['show_status', '=', 1];
$map[] = ['is_delete', '=', 1];
$list = db::name('banner')->field('bid,aid,type,image')->where($map)->order('sort desc')->select();
foreach ($list as $k => &$v) {
$v['image'] = localpath_to_netpath($v['image']);
$v['url'] ="";
if ($v['type'] == 2) {
// if ($v['type'] == 1) {
// $v['url'] = url('index/index/page_show', ['id' => $v['aid']], 'html', true);;
$v['url'] =$web_site_url."/index.php/index/index/page_show?id={$v['aid']}";
}
}
return ['code' => 200, 'msg' => '获取成功', 'data' => $list];
}
}