初始化代码
This commit is contained in:
29
application/api/model/Banner.php
Normal file
29
application/api/model/Banner.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user