52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace app\api\controller;
|
||
|
|
|
||
|
|
use think\Controller;
|
||
|
|
|
||
|
|
class Banner extends controller
|
||
|
|
{
|
||
|
|
|
||
|
|
public function _initialize()
|
||
|
|
{
|
||
|
|
//允许跨域
|
||
|
|
header('Access-Control-Allow-Origin: *');
|
||
|
|
}
|
||
|
|
/*
|
||
|
|
* 启动页列表
|
||
|
|
* @return array
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
public function get_banner_qidonglist()
|
||
|
|
{
|
||
|
|
$reslut = model('Banner')->banner_list(2);
|
||
|
|
return V(1,'操作成功', $reslut);
|
||
|
|
}
|
||
|
|
/*
|
||
|
|
* 单页输出
|
||
|
|
* @param id
|
||
|
|
* @return html
|
||
|
|
*/
|
||
|
|
public function banner_content_show()
|
||
|
|
{
|
||
|
|
$id = input('id', '');
|
||
|
|
$reslut = model('Banner')->find($id);
|
||
|
|
$html = $reslut['content'] ? $reslut['content'] : '';
|
||
|
|
//解析html
|
||
|
|
$html = htmlspecialchars_decode($html);
|
||
|
|
return $html;
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
* 广告列表
|
||
|
|
*/
|
||
|
|
public function get_banner_list(){
|
||
|
|
$show_type = input('show_type', '');
|
||
|
|
if (!$show_type) {
|
||
|
|
return V(0,'参数错误');
|
||
|
|
}
|
||
|
|
$reslut = model('Banner')->banner_list($show_type);
|
||
|
|
return V(1,'操作成功', $reslut);
|
||
|
|
}
|
||
|
|
}
|