合并banner和广告

This commit is contained in:
liyukun 2021-12-10 00:09:39 +08:00
parent b716efb2b1
commit 2354910f0f
9 changed files with 51 additions and 478 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 50726
File Encoding : 65001
Date: 06/12/2021 01:02:01
Date: 10/12/2021 00:07:48
*/
SET NAMES utf8mb4;
@ -97,7 +97,6 @@ INSERT INTO `ape_admin_auth` VALUES (18, '文章列表', '', 17, 'admin', 'artic
INSERT INTO `ape_admin_auth` VALUES (19, '栏目分类', '', 17, 'admin', 'category', 'index', '', '', 0, 0, 1, '/admin/category/index', 0, 1, '1', '1', 1612973967, 1613401827);
INSERT INTO `ape_admin_auth` VALUES (21, '留言管理', '', 27, 'admin', 'message', 'index', '', '', 0, 0, 1, '/admin/message/index', 0, 1, '1', '1', 1612974123, 1613449203);
INSERT INTO `ape_admin_auth` VALUES (23, '分类管理', '', 22, 'admin', 'category', 'index', '', '', 0, 0, 1, '/admin/category/index', 0, 1, '1', '', 1613390173, 1582093161);
INSERT INTO `ape_admin_auth` VALUES (24, '幻灯片管理', '', 27, 'admin', 'slides', 'index', '', '', 0, 0, 1, '/admin/slides/index', 0, 1, '1', '1', 1613390220, 1613449217);
INSERT INTO `ape_admin_auth` VALUES (25, '文章管理', '', 22, 'admin', 'article', 'index', '', '', 0, 0, 1, '/admin/article/index', 0, 1, '1', '', 1613390289, 1582093161);
INSERT INTO `ape_admin_auth` VALUES (26, '文章回收站', '', 22, 'admin', 'article', 'recovery', '', '', 0, 0, 1, '/admin/article/recovery', 0, 1, '1', '', 1613390366, 1582093161);
INSERT INTO `ape_admin_auth` VALUES (27, '活动管理', 'mdi mdi-image-multiple', 0, 'admin', 'operate', 'index', '', '', 0, 0, 1, '/admin/operate/index', 0, 1, '1', '1', 1613391146, 1613449194);
@ -127,7 +126,7 @@ CREATE TABLE `ape_admin_log` (
`user_agent` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'User-Agent',
`create_time` int(10) NOT NULL COMMENT '操作时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 163 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 176 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_admin_log
@ -294,6 +293,19 @@ INSERT INTO `ape_admin_log` VALUES (159, 1, 'admin', 'admin', 'system_config', '
INSERT INTO `ape_admin_log` VALUES (160, 1, 'admin', 'admin', 'system_config', 'base', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1638710912);
INSERT INTO `ape_admin_log` VALUES (161, 1, 'admin', 'admin', 'system_config', 'base', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1638710930);
INSERT INTO `ape_admin_log` VALUES (162, 1, 'admin', 'admin', 'system_config', 'base', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1638710931);
INSERT INTO `ape_admin_log` VALUES (163, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065937);
INSERT INTO `ape_admin_log` VALUES (164, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065937);
INSERT INTO `ape_admin_log` VALUES (165, 1, 'admin', 'admin', 'admin_auth', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065949);
INSERT INTO `ape_admin_log` VALUES (166, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065961);
INSERT INTO `ape_admin_log` VALUES (167, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065978);
INSERT INTO `ape_admin_log` VALUES (168, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065979);
INSERT INTO `ape_admin_log` VALUES (169, 1, 'admin', 'admin', 'poster', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065986);
INSERT INTO `ape_admin_log` VALUES (170, 1, 'admin', 'admin', 'system_config', 'clearCache', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065990);
INSERT INTO `ape_admin_log` VALUES (171, 1, 'admin', 'admin', 'system_config', 'clearCache', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065993);
INSERT INTO `ape_admin_log` VALUES (172, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639065995);
INSERT INTO `ape_admin_log` VALUES (173, 1, 'admin', 'admin', 'poster', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639066000);
INSERT INTO `ape_admin_log` VALUES (174, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639066020);
INSERT INTO `ape_admin_log` VALUES (175, 1, 'admin', 'admin', 'admin_auth', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43', 1639066021);
-- ----------------------------
-- Table structure for ape_admin_notify
@ -348,21 +360,23 @@ DROP TABLE IF EXISTS `ape_advert`;
CREATE TABLE `ape_advert` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '专区名称',
`image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '专区banner图',
`cover_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '专区banner图',
`url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '专区banner跳转url',
`position` tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '专区位置 默认 1 1 顶部页签 2 右侧边栏',
`position` tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '专区位置 默认 1 banner 2顶部页签 3 右侧边栏 ',
`user_id` int(19) NOT NULL DEFAULT 0 COMMENT '操作人id',
`create_time` int(10) NOT NULL,
`update_time` int(10) NOT NULL,
`sort` int(2) NOT NULL DEFAULT 0 COMMENT '权重',
`status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '是否启用 0不启用 1启用',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '职位专区表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '职位专区表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_advert
-- ----------------------------
INSERT INTO `ape_advert` VALUES (1, '我是小广告', '', 'http://apeblog.io/', 1, 0, 1636649595, 1636649595, 99, 1);
INSERT INTO `ape_advert` VALUES (1, '我是小广告', '/uploads/images/20211114\\9d6e563a56429ffb126044e7669a70ba.jpg', 'http://apeblog.io/', 3, 0, 1636649595, 1636649595, 99, 1);
INSERT INTO `ape_advert` VALUES (2, '我是首页', '/uploads/images/20211114\\9d6e563a56429ffb126044e7669a70ba.jpg', '/index/article/detail.html?id=1', 1, 0, 1638036172, 1638036172, 99, 1);
INSERT INTO `ape_advert` VALUES (3, '我是小广告', '/uploads/images/20211114\\9d6e563a56429ffb126044e7669a70ba.jpg', 'http://apeblog.io/', 2, 0, 1636649595, 1636649595, 99, 1);
-- ----------------------------
-- Table structure for ape_attachment
@ -469,8 +483,8 @@ CREATE TABLE `ape_document` (
-- ----------------------------
-- Records of ape_document
-- ----------------------------
INSERT INTO `ape_document` VALUES (1, 1, '超级管理员', '我是首页', 1, '/uploads/images/20211111\\522a67179ee445a32039a9cd3030c378.jpg', 'article', '', 1, 1, 1, '', 1, 170, '张三,李四,王麻子', '编程文章', '', '', 99, 1636562845, 1636725820, 1, '');
INSERT INTO `ape_document` VALUES (2, 1, '超级管理员', '测试摘要i', 1, '/uploads/images/20211114\\560c1956b3fa3b78cb82f7c801a8ede3.jpg', 'article', '', 0, 0, 0, '', 1, 56, '', '<p>测试摘要222222222222222222222222222</p>', '', '', 99, 1636822306, 1636822306, 1, '');
INSERT INTO `ape_document` VALUES (1, 1, '超级管理员', '我是首页', 1, '/uploads/images/20211111\\522a67179ee445a32039a9cd3030c378.jpg', 'article', '', 1, 1, 1, '', 1, 176, '张三,李四,王麻子', '编程文章', '', '', 99, 1636562845, 1636725820, 1, '');
INSERT INTO `ape_document` VALUES (2, 1, '超级管理员', '测试摘要i', 1, '/uploads/images/20211114\\560c1956b3fa3b78cb82f7c801a8ede3.jpg', 'article', '', 0, 0, 0, '', 1, 58, '', '<p>测试摘要222222222222222222222222222</p>', '', '', 99, 1636822306, 1636822306, 1, '');
-- ----------------------------
-- Table structure for ape_document_article
@ -516,7 +530,7 @@ CREATE TABLE `ape_document_category` (
-- Records of ape_document_category
-- ----------------------------
INSERT INTO `ape_document_category` VALUES (1, '编程文章', '', '', 1, 0, 0, '', '', '', 1, 'list_default.html', '', 12, 0, 1636646746);
INSERT INTO `ape_document_category` VALUES (2, 'php', '', '', 1, 1, 0, '', '', '', 1, 'list_default.html', '', 34, 0, 0);
INSERT INTO `ape_document_category` VALUES (2, 'php', '', '', 1, 1, 0, '', '', '', 1, 'list_default.html', '', 38, 0, 0);
-- ----------------------------
-- Table structure for ape_document_category_content
@ -627,7 +641,7 @@ CREATE TABLE `ape_pv_log` (
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_pv_log
@ -668,28 +682,9 @@ INSERT INTO `ape_pv_log` VALUES (33, 22, 4, '2021-12-05', '2021-12-05 22:08:30',
INSERT INTO `ape_pv_log` VALUES (34, 23, 14, '2021-12-05', '2021-12-05 23:13:18', '2021-12-05 23:13:18');
INSERT INTO `ape_pv_log` VALUES (35, 0, 32, '2021-12-06', '2021-12-06 00:09:55', '2021-12-06 00:09:55');
INSERT INTO `ape_pv_log` VALUES (36, 1, 1, '2021-12-06', '2021-12-06 01:01:26', '2021-12-06 01:01:26');
-- ----------------------------
-- Table structure for ape_slides
-- ----------------------------
DROP TABLE IF EXISTS `ape_slides`;
CREATE TABLE `ape_slides` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动名称',
`image` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '图片地址',
`url` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动url',
`type` tinyint(4) NULL DEFAULT NULL COMMENT 'banner类型',
`create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
`status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '数据状态',
`sort` int(10) NOT NULL DEFAULT 0 COMMENT '排序',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '幻灯片' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Records of ape_slides
-- ----------------------------
INSERT INTO `ape_slides` VALUES (1, '我是首页', '/uploads/images/20211114\\9d6e563a56429ffb126044e7669a70ba.jpg', '/index/article/detail.html?id=1', NULL, 1638036172, 1638036172, 1, 1);
INSERT INTO `ape_pv_log` VALUES (37, 23, 30, '2021-12-06', '2021-12-06 23:19:01', '2021-12-06 23:19:01');
INSERT INTO `ape_pv_log` VALUES (38, 23, 12, '2021-12-09', '2021-12-09 23:37:45', '2021-12-09 23:37:45');
INSERT INTO `ape_pv_log` VALUES (39, 0, 11, '2021-12-10', '2021-12-10 00:01:15', '2021-12-10 00:01:15');
-- ----------------------------
-- Table structure for ape_system_config
@ -804,7 +799,7 @@ CREATE TABLE `ape_url_log` (
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'pv记录表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 54 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'pv记录表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_url_log
@ -854,7 +849,14 @@ INSERT INTO `ape_url_log` VALUES (42, 'http://apeblog.io/index/article/detail.ht
INSERT INTO `ape_url_log` VALUES (43, 'http://apeblog.io/', 3, '网站首页', '2021-12-05', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (44, 'http://apeblog.io/index/article/lists.html?id=2', 1, 'php', '2021-12-05', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (45, 'http://apeblog.io/index/article/detail.html?id=1', 31, '我是首页', '2021-12-05', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (46, 'http://apeblog.io/index/article/detail.html?id=1', 33, '我是首页', '2021-12-06', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (46, 'http://apeblog.io/index/article/detail.html?id=1', 35, '我是首页', '2021-12-06', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (47, 'http://apeblog.io/', 26, '网站首页', '2021-12-06', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (48, 'http://apeblog.io/index/article/detail.html?id=2', 1, '测试摘要i', '2021-12-06', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (49, 'http://apeblog.io/index/article/detail.html?id=1', 4, '我是首页', '2021-12-09', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (50, 'http://apeblog.io/', 4, '网站首页', '2021-12-09', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (51, 'http://apeblog.io/index/article/lists.html?id=2', 4, 'php', '2021-12-10', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (52, 'http://apeblog.io/', 3, '网站首页', '2021-12-10', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (53, 'http://apeblog.io/index/article/detail.html?id=2', 1, '测试摘要i', '2021-12-10', NULL, NULL);
-- ----------------------------
-- Table structure for ape_user
@ -892,7 +894,7 @@ CREATE TABLE `ape_uv_log` (
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Uv记录表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Uv记录表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_uv_log
@ -912,5 +914,7 @@ INSERT INTO `ape_uv_log` VALUES (12, '127.0.0.1', 0, '2021-11-29', '2021-11-29 0
INSERT INTO `ape_uv_log` VALUES (13, '127.0.0.1', 23, '2021-12-04', '2021-12-04 23:20:50', '2021-12-04 23:20:50');
INSERT INTO `ape_uv_log` VALUES (14, '127.0.0.1', 15, '2021-12-05', '2021-12-05 15:47:54', '2021-12-05 15:47:54');
INSERT INTO `ape_uv_log` VALUES (15, '127.0.0.1', 0, '2021-12-06', '2021-12-06 00:09:55', '2021-12-06 00:09:55');
INSERT INTO `ape_uv_log` VALUES (16, '127.0.0.1', 23, '2021-12-09', '2021-12-09 23:37:45', '2021-12-09 23:37:45');
INSERT INTO `ape_uv_log` VALUES (17, '127.0.0.1', 0, '2021-12-10', '2021-12-10 00:01:15', '2021-12-10 00:01:15');
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -1,127 +0,0 @@
<?php
namespace app\admin\controller;
use app\common\constant\Data;
use app\common\model\Slides as aModel;
use app\admin\service\FormBuilderService as Form;
use app\Request;
use app\admin\service\UtilService as Util;
use FormBuilder\Factory\Elm;
use think\facade\Route as Url;
/**
* Class Slides
* @package app\admin\controller\system
* @author 李玉坤
* @date 2021-02-15 23:20
*/
class Slides extends AuthController
{
/**
* 幻灯片管理
* @return string
* @throws \Exception
* @author 李玉坤
* @date 2021-02-16 13:15
*/
public function index()
{
return $this->fetch();
}
/**
* 文章列表
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 李玉坤
* @date 2021-02-15 23:26
*/
public function lst(Request $request)
{
$where = Util::postMore([
['title',''],
['start_time',''],
['end_time',''],
['status',''],
['page',1],
['limit',20],
]);
return app("json")->layui(aModel::systemPage($where));
}
/**
* 添加banner
* @param Request $request
* @return string
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function add(Request $request)
{
$form = array();
$form[] = Elm::input('title','幻灯片名称')->col(10);
$form[] = Elm::input('url','链接地址')->col(10);
$form[] = Elm::frameImage('image','幻灯片图片',Url::buildUrl('admin/images/index',array('fodder'=>'image','limit'=>1)))->icon("ios-image")->width('96%')->height('440px')->col(10);
$form[] = Elm::input('sort','排序')->col(10);
$form[] = Elm::radio('status','状态',1)->options([['label'=>'启用','value'=>1],['label'=>'冻结','value'=>0]])->col(10);
$form = Form::make_post_form($form, url('save')->build());
$this->assign(compact('form'));
return $this->fetch("public/form-builder");
}
/**
* 修改banner
* @return string
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function edit($id="")
{
if (!$id) return app("json")->fail("数据id不能为空");
$ainfo = aModel::get($id);
if (!$ainfo) return app("json")->fail("没有该数据");
$form = array();
$form[] = Elm::input('title','幻灯片名称',$ainfo['title'])->col(10);
$form[] = Elm::input('url','链接地址',$ainfo['url'])->col(10);
$form[] = Elm::frameImage('image','幻灯片图片',Url::buildUrl('admin/images/index',array('fodder'=>'image','limit'=>1)),$ainfo['image'])->icon("ios-image")->width('96%')->height('440px')->col(10);
$form[] = Elm::input('sort','排序',$ainfo['sort'])->col(10);
$form[] = Elm::radio('status','状态',$ainfo['status'])->options([['label'=>'启用','value'=>1],['label'=>'冻结','value'=>0]])->col(10);
$form = Form::make_post_form($form, url('save',['id'=>$id])->build());
$this->assign(compact('form'));
return $this->fetch("public/form-builder");
}
/**
* 保存修改
* @param string $id
* @return mixed
*/
public function save($id="")
{
$data = Util::postMore([
['id',''],
['title',''],
['url',''],
['image',''],
['sort',''],
['status',1],
]);
if ($data['title'] == "") return app("json")->fail("幻灯片名称不能为空");
if ($data['url'] == "") return app("json")->fail("链接地址不能为空");
if (is_array($data['image'])) $data['image'] = $data['avatar'][0];
if ($id=="") {
//判断下用户是否存在
$info = aModel::where('url',$data['url'])->find();
if ($info){
return app("json")->fail("链接已存在");
}
$res = aModel::create($data);
}else {
$res = aModel::update($data,['id'=>$id]);
}
cache(Data::DATA_BANNER,null);//清除缓存
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
}
}

View File

@ -1,218 +0,0 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<title>幻灯片管理 - {:system_config("title")}后台管理系统</title>
{include file="public/header" /}
</head>
<body>
<div class="container-fluid p-t-15">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header"><h4>搜索</h4></div>
<div class="card-body">
<form class="form-inline searchForm" onsubmit="return false;">
<div class="form-group">
<label for="title">幻灯片名称</label>
<div class="input-group">
<div class="input-group">
<input type="text" class="form-control" id="title" name="title" placeholder="请输入幻灯片名称">
</div>
</div>
</div>
<div class="form-group">
<label for="start_time">操作时间</label>
<div class="input-group">
<input class="form-control js-datetimepicker" type="text" id="start_time" name="start_time" autocomplete="off" data-side-by-side="true" data-locale="zh-cn" data-format="YYYY-MM-DD" placeholder="开始时间">
<span class="input-group-addon">~</span>
<input class="form-control js-datetimepicker" type="text" id="end_time" name="end_time" autocomplete="off" data-side-by-side="true" data-locale="zh-cn" data-format="YYYY-MM-DD" placeholder="结束时间">
</div>
</div>
<button type="submit" class="btn btn-success" style="margin: -10px 0 0 10px;" id="search">搜索</button>
</form>
</div>
</div>
</div>
<div class="col-lg-12">
<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/slides/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>
</div>
</div>
<div class="card-body">
<table id="tb_departments"></table>
</div>
</div>
</div>
</div>
</div>
{include file="public/footer"/}
<script type="text/javascript">
$('#tb_departments').bootstrapTable({
classes: 'table table-bordered table-hover table-striped',
url: '/admin/slides/Lst',
method: 'post',
dataType : 'json', // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
uniqueId: 'id',
idField: 'id', // 每行的唯一标识字段
toolbar: '#toolbar', // 工具按钮容器
showColumns: false, // 是否显示所有的列
showRefresh: false, // 是否显示刷新按钮
responseHandler: function (res) {
return {
"total": res.count,
"rows": res.data,
};
},
pagination: true,
queryParams: function(params) {
let temp = toArrayList($(".searchForm").serializeArray());
temp['limit'] = params.limit;
temp['page'] = (params.offset / params.limit) + 1;
return temp;
},
sidePagination: "server",
pageNumber: 1,
pageSize: 10,
pageList: [10, 20, 50, 100],
columns: [{
checkbox: true, // 是否显示复选框
},{
field: 'id',
title: 'ID'
},{
field: 'title',
title: '幻灯片名称'
},
{
field: 'image',
title: '幻灯片图片',
formatter:function (value,row,index) {
let html ='<img src="'+value+'" alt="" width="50px;">';
return html;
}
},
{
field: 'url',
title: '链接地址',
}, {
field: 'create_time',
title: '添加时间',
}, {
field: 'operate',
title: '操作',
formatter:operateFormatter,
events: {
'click .btn-edit': function (event, value, row, index) {
iframe.createIframe('修改幻灯片','/admin/slides/edit?id='+row.id)
},
'click .btn-del': function (event, value, row, index) {
$.alert({
title: '系统提示',
content: '删除提醒',
buttons: {
confirm: {
text: '确认',
btnClass: 'btn-primary',
action: function(){
$.post(url="/admin/slides/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');
});
}
},
cancel: {
text: '取消'
}
}
});
}
}
}],
onLoadSuccess: function(data){
$("[data-toggle='tooltip']").tooltip();
}
});
//搜索
$("#search").click(function () {
let start_time = $('#start_time').val();
let end_time = $('#end_time').val();
if(start_time && end_time && start_time > end_time ){
alert('开始时间不能大于结束时间');
return false;
}
$("#tb_departments").bootstrapTable('refresh',{query:{page:1},pageNumber:1});
});
// 操作按钮
function operateFormatter(value, row, index) {
return [
'<a type="button" class="btn-edit btn btn-xs btn-default m-r-5" title="修改" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>',
'<a type="button" class="btn-del btn btn-xs btn-default" title="删除" data-toggle="tooltip"><i class="mdi mdi-delete"></i></a>'
].join('');
}
function delOne(id) {
$.confirm({
title: '重要提醒!',
content: '删除后将不可恢复,请谨慎操作!',
backgroundDismiss: true,
buttons: {
ok: {
text: '确认',
btnClass: 'btn-danger',
action: function () {
$.post("/admin/slides/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();
})
}
},
cancel: {
text: '取消',
btnClass: 'btn-primary'
}
}
});
}
function delSelect() {
var checkID = "";
var selectedItem = $('#tb_departments').bootstrapTable('getSelections');
if (selectedItem=="") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
for (var i = 0 ; i< selectedItem.length; i++)
{
checkID += selectedItem[i]['id']+",";
}
if (checkID=="") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
$.confirm({
title: '重要提醒!',
content: '选中项删除后将不可恢复,请谨慎操作!',
backgroundDismiss: true,
buttons: {
ok: {
text: '确认',
btnClass: 'btn-danger',
action: function () {
$.post("/admin/slides/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');
})
}
},
cancel: {
text: '取消',
btnClass: 'btn-primary'
}
}
});
}
</script>
</body>
</html>

View File

@ -1,44 +0,0 @@
<?php
namespace app\common\model;
use app\common\model\BaseModel;
/**
* Class Slides
* @package app\admin\model\system
* @author 李玉坤
* @date 2021-02-15 23:22
*/
class Slides extends BaseModel
{
/**
* 列表
* @param $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 李玉坤
* @date 2021-02-15 23:24
*/
public static function systemPage($where): array
{
$model = new self;
if ($where['title'] != '') $model = $model->where("title|url","like","%$where[title]%");
if ($where['start_time'] != '') $model = $model->where("create_time",">",strtotime($where['start_time']." 00:00:00"));
if ($where['end_time'] != '') $model = $model->where("create_time","<", strtotime($where['end_time']." 23:59:59"));
if ($where['status'] != '') $model = $model->where("status",$where['status']);
$count = self::counts($model);
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']);
$data = $model->select()->each(function ($item){
if (!empty($item->pic)){
$item->pic = file_cdn($item->pic);
}
});
if ($data) $data = $data->toArray();
return compact('data','count');
}
}

View File

@ -13,7 +13,6 @@ class Ape extends TagLib{
'list'=> ['attr' => 'orderBy,pageSize,type,typeId,void,model,where,display', 'close' => 1],
'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],
@ -179,25 +178,6 @@ class Ape extends TagLib{
return $parse;
}
/**
* tagBanner
*/
public function tagBanner($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_banner($type,$row);";
$parse .= ' ?>';
$parse .= '{volist name="__LIST__" id="'.$void.'"}';
$parse .= $content;
$parse .= '{/volist}';
return $parse;
}
/**
* tagAdvert 广告
* @param $tag
@ -209,7 +189,7 @@ class Ape extends TagLib{
public function tagAdvert($tag,$content)
{
$type=isset($tag['type'])?$tag['type']:1;
$row=isset($tag['row'])?$tag['row']:100;
$row=isset($tag['row'])?$tag['row']:5;
$void=isset($tag['void'])?$tag['void']:'field';
$parse = '<?php ';
$parse .= '$__LIST__ ='."tpl_get_advert($type,$row);";

View File

@ -547,28 +547,6 @@ function tpl_get_friend_link($type, $row)
return $flinkListTemp;
}
/**
* 模板-poster
*/
function tpl_get_banner($type, $row)
{
$bannerList = cache(Data::DATA_BANNER);
if ($bannerList === null) {
$bannerList = Db::name('slides')->where('status', 1)->order('sort asc')->limit($row)->select();
cache(Data::DATA_BANNER, $bannerList);
}
if ($type === 0) {
return $bannerList;
}
$bannerListTemp = [];
foreach ($bannerList as $key => $item) {
if ($item['image']) {
array_push($bannerListTemp, $item);
}
}
return $bannerListTemp;
}
/**
* 广告
* @param $type
@ -593,7 +571,7 @@ function tpl_get_advert($type, $row)
}
$advertListTemp = [];
foreach ($advertList as $key => $item) {
if ($item['image']) {
if ($item['cover_path']) {
array_push($advertListTemp, $item);
}
}

View File

@ -165,7 +165,7 @@
<div class="aside-box">
<h2 class="widget-title">{$field['title']}</h2>
<a href="{$field['url']}" target="_blank">
<img width="300" height="191" src="{$field['image']}"
<img width="300" height="191" src="{$field['cover_path']}"
class="image wp-image-559 attachment-medium size-medium" alt=""
loading="lazy" style="max-width: 100%; height: auto;">
</a>

View File

@ -170,7 +170,7 @@
</div>
{/ape:arclist}
</div>
{ape:advert row="3" type="2"}
{ape:advert row="3" type="3"}
<div class="aside-box">
<h2 class="widget-title">{$field['title']}</h2>
<a href="{$field['url']}" target="_blank">

View File

@ -19,13 +19,13 @@
<div>
<div class="swiper-container carousel">
<div class="swiper-wrapper">
{ape:banner pagesize="5" typeId="$cid"}
{ape:advert row="5" type="1"}
<div class="swiper-slide">
<a href="{$field['url']}" >
<img src="{$field['image']}" alt="{$field['title']}">
<img src="{$field['cover_path']}" alt="{$field['title']}">
</a>
</div>
{/ape:banner}
{/ape:advert}
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev"></div>
@ -56,7 +56,7 @@
</style>
<div class="index-top-postcard-plane">
<div class="index-top-postcard-body">
{ape:list orderby="create_time desc" where="is_recommend=1" type="where"}
{ape:advert row="4" type="1"}
<div class="index-top-postcard-item">
<div class="index-top-postcard-main">
<div class="post-item-thumbnail">
@ -68,7 +68,7 @@
</div>
</div>
</div>
{/ape:list}
{/ape:advert}
</div>
</div>
<div class="post-list-page-plane">
@ -235,11 +235,11 @@
});
</script>
</div>
{ape:advert row="3" type="2"}
{ape:advert row="3" type="3"}
<div class="aside-box">
<h2 class="widget-title">{$field['title']}</h2>
<a href="{$field['url']}" target="_blank">
<img width="300" height="191" src="{$field['image']}"
<img width="300" height="191" src="{$field['cover_path']}"
class="image wp-image-559 attachment-medium size-medium" alt=""
loading="lazy" style="max-width: 100%; height: auto;">
</a>