mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
c1f6f1a5d9
commit
31ad5b511b
|
|
@ -10,12 +10,12 @@ use FormBuilder\Factory\Elm;
|
|||
use think\facade\Route as Url;
|
||||
|
||||
/**
|
||||
* Class Advert
|
||||
* Class Poster
|
||||
* @package app\admin\controller
|
||||
* @author 李玉坤
|
||||
* @date 2021-07-26 17:53
|
||||
*/
|
||||
class Advert extends AuthController
|
||||
class Poster extends AuthController
|
||||
{
|
||||
/**
|
||||
* 构造方法 初始化一些参数
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<div class="card">
|
||||
<div class="card-toolbar clearfix">
|
||||
<div id="toolbar" class="toolbar-btn-action">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5" onclick="iframe.createIframe('添加广告','/admin/advert/add')">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5" onclick="iframe.createIframe('添加广告','/admin/poster/add')">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<a class="btn btn-warning" href="#!" onclick="delSelect()"><i class="mdi mdi-window-close"></i> 删除</a>
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
<script type="text/javascript">
|
||||
$('#tb_departments').bootstrapTable({
|
||||
classes: 'table table-bordered table-hover table-striped',
|
||||
url: '/admin/advert/Lst',
|
||||
url: '/admin/poster/Lst',
|
||||
method: 'post',
|
||||
dataType : 'json', // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
|
||||
uniqueId: 'id',
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
formatter:operateFormatter,
|
||||
events: {
|
||||
'click .btn-edit': function (event, value, row, index) {
|
||||
iframe.createIframe('修改广告','/admin/advert/edit?id='+row.id)
|
||||
iframe.createIframe('修改广告','/admin/poster/edit?id='+row.id)
|
||||
},
|
||||
'click .btn-del': function (event, value, row, index) {
|
||||
$.alert({
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
text: '确认',
|
||||
btnClass: 'btn-primary',
|
||||
action: function(){
|
||||
$.post(url="/admin/advert/del",data={"id":row.id},function (res) {
|
||||
$.post(url="/admin/poster/del",data={"id":row.id},function (res) {
|
||||
if (res.status == 200) {parent.lightyear.notify('删除成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');$("#tb_departments").bootstrapTable('refresh');}
|
||||
else parent.lightyear.notify('删除失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
});
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
text: '确认',
|
||||
btnClass: 'btn-danger',
|
||||
action: function () {
|
||||
$.post("/admin/advert/del",data={id:id},function (res) {
|
||||
$.post("/admin/poster/del",data={id:id},function (res) {
|
||||
if (res.status == 200 || res.code == 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||
location.reload();
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
text: '确认',
|
||||
btnClass: 'btn-danger',
|
||||
action: function () {
|
||||
$.post("/admin/advert/del",data={id:checkID},function (res) {
|
||||
$.post("/admin/poster/del",data={id:checkID},function (res) {
|
||||
if (res.status == 200 || res.code == 200) { lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');location.reload();}
|
||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||
})
|
||||
|
|
@ -14,6 +14,7 @@ class Zz extends TagLib{
|
|||
'prenext'=> ['attr' => 'get,cid,void,none', 'close' => 1],
|
||||
'flink'=> ['attr' => 'type,row,void', 'close' => 1],
|
||||
'banner'=> ['attr' => 'type,row,void', 'close' => 1],
|
||||
'advert'=> ['attr' => 'type,row,void', 'close' => 1],
|
||||
'sql'=> ['attr' => 'sql', 'close' => 1],
|
||||
'article'=> ['attr' => 'id,void,model', 'close' => 1],
|
||||
'tags'=> ['attr' => 'tags,void', 'close' => 1],
|
||||
|
|
@ -179,7 +180,7 @@ class Zz extends TagLib{
|
|||
}
|
||||
|
||||
/**
|
||||
* banner
|
||||
* poster
|
||||
*/
|
||||
public function tagBanner($tag,$content)
|
||||
{
|
||||
|
|
@ -197,6 +198,31 @@ class Zz extends TagLib{
|
|||
return $parse;
|
||||
}
|
||||
|
||||
/**
|
||||
* tagAdvert
|
||||
* @param $tag
|
||||
* @param $content
|
||||
* @return string
|
||||
* @author 李玉坤
|
||||
* @date 2021-07-26 23:22
|
||||
*/
|
||||
public function tagAdvert($tag,$content)
|
||||
{
|
||||
$type=isset($tag['type'])?$tag['type']:'text';
|
||||
$type=$type=='text'?0:1;
|
||||
$row=isset($tag['row'])?$tag['row']:100;
|
||||
$void=isset($tag['void'])?$tag['void']:'field';
|
||||
|
||||
$parse = '<?php ';
|
||||
$parse .= '$__LIST__ ='."tpl_get_advert($type,$row);";
|
||||
$parse .= ' ?>';
|
||||
$parse .= '{volist name="__LIST__" id="'.$void.'"}';
|
||||
$parse .= $content;
|
||||
$parse .= '{/volist}';
|
||||
return $parse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行SQL
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ function tpl_get_friend_link($type,$row){
|
|||
}
|
||||
|
||||
/**
|
||||
* 模板-banner
|
||||
* 模板-poster
|
||||
*/
|
||||
function tpl_get_banner($type,$row){
|
||||
$bannerList=cache('DATA_BANNER');
|
||||
|
|
@ -538,6 +538,36 @@ function tpl_get_banner($type,$row){
|
|||
return $bannerListTemp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 广告
|
||||
* @param $type
|
||||
* @param $row
|
||||
* @return array|mixed|object|\think\App|\think\Collection|Db[]
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-07-26 23:24
|
||||
*/
|
||||
function tpl_get_advert($type,$row){
|
||||
$advertList=cache('DATA_BANNER');
|
||||
if($advertList===null){
|
||||
$advertList=Db::name('advert')->where('status',1)->order('sort asc')->limit($row)->select();
|
||||
cache('DATA_ADVERT',$advertList);
|
||||
}
|
||||
if($type===0){
|
||||
return $advertList;
|
||||
}
|
||||
$advertListTemp=[];
|
||||
foreach ($advertList as $key=>$item){
|
||||
if($item['image']){
|
||||
array_push($advertListTemp,$item);
|
||||
}
|
||||
}
|
||||
return $advertListTemp;
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('web_config'))
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -22,7 +22,7 @@
|
|||
<!--================Header Menu Area =================-->
|
||||
{include file="template/default/head.html"}
|
||||
<!--================Header Menu Area =================-->
|
||||
<!--================Home Banner Area =================-->
|
||||
<!--================Home Poster Area =================-->
|
||||
<section class="home_banner_area">
|
||||
<div class="banner_inner">
|
||||
<div class="container">
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!--================End Home Banner Area =================-->
|
||||
<!--================End Home Poster Area =================-->
|
||||
|
||||
<!--================Blog Area =================-->
|
||||
<section class="blog_area">
|
||||
|
|
|
|||
Loading…
Reference in New Issue