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