feat: 后台网站信息管理

This commit is contained in:
xiongxiaoyang 2023-04-14 14:56:11 +08:00
parent b45b83fdb0
commit 2c3b735d49
37 changed files with 1821 additions and 543 deletions

View File

@ -49,7 +49,6 @@ novel-plus -- 父工程
| Redis | 缓存方案
| Aliyun OSS | 阿里云对象存储服务(图片存储方式之一一行配置即可切换)
| FastDFS | 开源轻量级分布式文件系统(图片存储方式之一一行配置即可切换)
| Redisson | 实现分布式锁
| Lombok | 简化对象封装工具
| Docker | 应用容器引擎
| MySQL | 数据库服务

38
doc/sql/20230413.sql Normal file
View File

@ -0,0 +1,38 @@
CREATE TABLE `website_info`
(
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
name varchar(50) NOT NULL COMMENT '网站名',
domain varchar(50) NOT NULL COMMENT '网站域名',
keyword varchar(50) NOT NULL COMMENT 'SEO关键词',
description varchar(512) NOT NULL COMMENT '网站描述',
qq varchar(20) NOT NULL COMMENT '站长QQ',
logo varchar(200) NOT NULL COMMENT '网站logo图片默认',
logo_dark varchar(200) NOT NULL COMMENT '网站logo图片深色',
create_time datetime null comment '创建时间',
create_user_id bigint null comment '创建人ID',
update_time datetime null comment '更新时间',
update_user_id bigint null comment '更新人ID',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='网站信息表';
INSERT INTO website_info (id, name, domain, keyword, description, qq, logo, logo_dark, create_time, create_user_id,
update_time, update_user_id)
VALUES (1, '小说精品屋', 'www.xxyopen.com', '小说精品屋,小说,小说CMS,原创文学系统,开源小说系统,免费小说建站程序',
'小说精品屋是一个多端PCWAP阅读功能完善的原创文学CMS系统由前台门户系统作家后台管理系统平台后台管理系统爬虫管理系统等多个子系统构成支持会员充值订阅模式新闻发布和实时统计报表等功能新书自动入库老书自动更新',
'1179705413', 'https://youdoc.gitee.io/resource/images/logo/logo.png',
'https://youdoc.gitee.io/resource/images/logo/logo_white.png', null, null, null, null);
INSERT INTO novel_plus.sys_menu (menu_id, parent_id, name, url, perms, type, icon, order_num, gmt_create, gmt_modified)
VALUES (300, 0, '网站管理', '', '', 0, 'fa fa-television', 6, null, null);
INSERT
INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES (301, 300, '网站信息', 'novel/websiteInfo', 'novel:websiteInfo:websiteInfo', '1', 'fa', '6');
INSERT INTO sys_role_menu (role_id, menu_id)
VALUES (1, 300);
INSERT INTO sys_role_menu (role_id, menu_id)
VALUES (1, 301);

View File

@ -2829,8 +2829,41 @@ alter table news
alter table book_index
add column storage_type varchar(10) NOT NULL DEFAULT 'db' COMMENT '存储方式' after book_price;
INSERT INTO `crawl_source` (`id`, `source_name`, `crawl_rule`, `source_status`, `create_time`, `update_time`)
VALUES (6, '新笔趣阁',
'{\n \"bookListUrl\": \"http://www.xbiquge.la/fenlei/{catId}_{page}.html\",\n \"catIdRule\": {\n \"catId1\": \"1\",\n \"catId2\": \"2\",\n \"catId3\": \"3\",\n \"catId4\": \"4\",\n \"catId5\": \"6\",\n \"catId6\": \"5\"\n },\n \"bookIdPatten\": \"<a\\\\s+href=\\\"http://www.xbiquge.la/(\\\\d+/\\\\d+)/\\\"\\\\s+target=\\\"_blank\\\">\",\n \"pagePatten\": \"<em\\\\s+id=\\\"pagestats\\\">(\\\\d+)/\\\\d+</em>\",\n \"totalPagePatten\": \"<em\\\\s+id=\\\"pagestats\\\">\\\\d+/(\\\\d+)</em>\",\n \"bookDetailUrl\": \"http://www.xbiquge.la/{bookId}/\",\n \"bookNamePatten\": \"<h1>([^/]+)</h1>\",\n \"authorNamePatten\": \"者:([^/]+)</p>\",\n \"picUrlPatten\": \"src=\\\"(http://www.xbiquge.la/files/article/image/\\\\d+/\\\\d+/\\\\d+s\\\\.jpg)\\\"\",\n \"bookStatusRule\": {},\n \"descStart\": \"<div id=\\\"intro\\\">\",\n \"descEnd\": \"</div>\",\n \"upadateTimePatten\": \"<p>最后更新:(\\\\d+-\\\\d+-\\\\d+\\\\s\\\\d+:\\\\d+:\\\\d+)</p>\",\n \"upadateTimeFormatPatten\": \"yyyy-MM-dd HH:mm:ss\",\n \"bookIndexUrl\": \"http://www.xbiquge.la/{bookId}/\",\n \"indexIdPatten\": \"<a\\\\s+href=\' /\\\\d + /\\\\d + /
(\\\\d +) \\\\.html\'\\\\s+>[^/]+</a>\",\n \"indexNamePatten\": \"<a\\\\s+href=\'/\\\\d+/\\\\d+/\\\\d+\\\\.html\'\\\\s+>([^/]+)</a>\",\n \"bookContentUrl\": \"http://www.xbiquge.la/{bookId}/{indexId}.html\",\n \"contentStart\": \"<div id=\\\"content\\\">\",\n \"contentEnd\": \"<p>\"\n}',
0, '2020-05-23 22:46:58', '2020-05-23 22:46:58');
CREATE TABLE `website_info`
(
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
name varchar(50) NOT NULL COMMENT '网站名',
domain varchar(50) NOT NULL COMMENT '网站域名',
keyword varchar(50) NOT NULL COMMENT 'SEO关键词',
description varchar(512) NOT NULL COMMENT '网站描述',
qq varchar(20) NOT NULL COMMENT '站长QQ',
logo varchar(200) NOT NULL COMMENT '网站logo图片默认',
logo_dark varchar(200) NOT NULL COMMENT '网站logo图片深色',
create_time datetime null comment '创建时间',
create_user_id bigint null comment '创建人ID',
update_time datetime null comment '更新时间',
update_user_id bigint null comment '更新人ID',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='网站信息表';
INSERT INTO website_info (id, name, domain, keyword, description, qq, logo, logo_dark, create_time, create_user_id,
update_time, update_user_id)
VALUES (1, '小说精品屋', 'www.xxyopen.com', '小说精品屋,小说,小说CMS,原创文学系统,开源小说系统,免费小说建站程序',
'小说精品屋是一个多端PCWAP阅读功能完善的原创文学CMS系统由前台门户系统作家后台管理系统平台后台管理系统爬虫管理系统等多个子系统构成支持会员充值订阅模式新闻发布和实时统计报表等功能新书自动入库老书自动更新',
'1179705413', 'https://youdoc.gitee.io/resource/images/logo/logo.png',
'https://youdoc.gitee.io/resource/images/logo/logo_white.png', null, null, null, null);
INSERT INTO novel_plus.sys_menu (menu_id, parent_id, name, url, perms, type, icon, order_num, gmt_create, gmt_modified)
VALUES (300, 0, '网站管理', '', '', 0, 'fa fa-television', 6, null, null);
INSERT
INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES (301, 300, '网站信息', 'novel/websiteInfo', 'novel:websiteInfo:websiteInfo', '1', 'fa', '6');
INSERT INTO sys_role_menu (role_id, menu_id)
VALUES (1, 300);
INSERT INTO sys_role_menu (role_id, menu_id)
VALUES (1, 301);

View File

@ -1,6 +1,7 @@
package com.java2nb.common.config;
public class Constant {
//演示系统账户
public static String DEMO_ACCOUNT = "test";
//自动去除表前缀
@ -16,9 +17,11 @@ public class Constant {
//部门根节点id
public static Long DEPT_ROOT_ID = 0l;
//缓存方式
public static String CACHE_TYPE_REDIS ="redis";
public static String CACHE_TYPE_REDIS = "redis";
public static String LOG_ERROR = "error";
public static final String UPLOAD_FILES_PREFIX = "/files/";
}

View File

@ -71,7 +71,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/docs/**", "anon");
filterChainDefinitionMap.put("/layuimini/**", "anon");
filterChainDefinitionMap.put("/upload/**", "anon");
filterChainDefinitionMap.put("/files/**", "anon");
filterChainDefinitionMap.put(Constant.UPLOAD_FILES_PREFIX + "**", "anon");
filterChainDefinitionMap.put("/logout", "logout");
filterChainDefinitionMap.put("/blog", "anon");
filterChainDefinitionMap.put("/blog/open/**", "anon");

View File

@ -7,11 +7,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Component
class WebConfigurer extends WebMvcConfigurerAdapter {
@Autowired
@Autowired
JnConfig jnConfig;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/files/**").addResourceLocations("file:///"+ jnConfig.getUploadPath());
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler(Constant.UPLOAD_FILES_PREFIX + "**")
.addResourceLocations("file:///" + jnConfig.getUploadPath());
}
}

View File

@ -1,12 +1,10 @@
package com.java2nb.common.controller;
import com.java2nb.common.config.Constant;
import com.java2nb.common.config.JnConfig;
import com.java2nb.common.domain.FileDO;
import com.java2nb.common.service.FileService;
import com.java2nb.common.utils.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -14,7 +12,11 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
@ -23,7 +25,7 @@ import java.util.Map;
/**
* 文件上传
*
*
* @author xiongxy
* @email 1179705413@qq.com
* @date 2019-09-19 16:02:20
@ -32,165 +34,167 @@ import java.util.Map;
@RequestMapping("/common/sysFile")
public class FileController extends BaseController {
@Autowired
private FileService sysFileService;
@Autowired
private FileService sysFileService;
@Autowired
private JnConfig jnConfig;
@Autowired
private JnConfig jnConfig;
@GetMapping()
@RequiresPermissions("common:sysFile:sysFile")
String sysFile(Model model) {
Map<String, Object> params = new HashMap<>(16);
return "common/file/file";
}
@GetMapping()
@RequiresPermissions("common:sysFile:sysFile")
String sysFile(Model model) {
Map<String, Object> params = new HashMap<>(16);
return "common/file/file";
}
@ResponseBody
@GetMapping("/list")
@RequiresPermissions("common:sysFile:sysFile")
public PageBean list(@RequestParam Map<String, Object> params) {
// 查询列表数据
Query query = new Query(params);
List<FileDO> sysFileList = sysFileService.list(query);
int total = sysFileService.count(query);
PageBean pageBean = new PageBean(sysFileList, total);
return pageBean;
}
@ResponseBody
@GetMapping("/list")
@RequiresPermissions("common:sysFile:sysFile")
public PageBean list(@RequestParam Map<String, Object> params) {
// 查询列表数据
Query query = new Query(params);
List<FileDO> sysFileList = sysFileService.list(query);
int total = sysFileService.count(query);
PageBean pageBean = new PageBean(sysFileList, total);
return pageBean;
}
@GetMapping("/add")
// @RequiresPermissions("common:bComments")
String add() {
return "common/sysFile/add";
}
@GetMapping("/add")
// @RequiresPermissions("common:bComments")
String add() {
return "common/sysFile/add";
}
@GetMapping("/edit")
// @RequiresPermissions("common:bComments")
String edit(Long id, Model model) {
FileDO sysFile = sysFileService.get(id);
model.addAttribute("sysFile", sysFile);
return "common/sysFile/edit";
}
@GetMapping("/edit")
// @RequiresPermissions("common:bComments")
String edit(Long id, Model model) {
FileDO sysFile = sysFileService.get(id);
model.addAttribute("sysFile", sysFile);
return "common/sysFile/edit";
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("common:info")
public R info(@PathVariable("id") Long id) {
FileDO sysFile = sysFileService.get(id);
return R.ok().put("sysFile", sysFile);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("common:info")
public R info(@PathVariable("id") Long id) {
FileDO sysFile = sysFileService.get(id);
return R.ok().put("sysFile", sysFile);
}
/**
* 保存
*/
@ResponseBody
@PostMapping("/save")
@RequiresPermissions("common:save")
public R save(FileDO sysFile) {
if (sysFileService.save(sysFile) > 0) {
return R.ok();
}
return R.error();
}
/**
* 保存
*/
@ResponseBody
@PostMapping("/save")
@RequiresPermissions("common:save")
public R save(FileDO sysFile) {
if (sysFileService.save(sysFile) > 0) {
return R.ok();
}
return R.error();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("common:update")
public R update(@RequestBody FileDO sysFile) {
sysFileService.update(sysFile);
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("common:update")
public R update(@RequestBody FileDO sysFile) {
sysFileService.update(sysFile);
return R.ok();
}
return R.ok();
}
/**
* 删除
*/
@PostMapping("/remove")
@ResponseBody
// @RequiresPermissions("common:remove")
public R remove(Long id, HttpServletRequest request) {
if ("test".equals(getUsername())) {
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
}
String fileName = jnConfig.getUploadPath() + sysFileService.get(id).getUrl().replace("/files/", "");
if (sysFileService.remove(id) > 0) {
boolean b = FileUtil.deleteFile(fileName);
if (!b) {
return R.error("数据库记录删除成功,文件删除失败");
}
return R.ok();
} else {
return R.error();
}
}
/**
* 删除
*/
@PostMapping("/remove")
@ResponseBody
// @RequiresPermissions("common:remove")
public R remove(Long id, HttpServletRequest request) {
if ("test".equals(getUsername())) {
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
}
String fileName =
jnConfig.getUploadPath() + sysFileService.get(id).getUrl().replace(Constant.UPLOAD_FILES_PREFIX, "");
if (sysFileService.remove(id) > 0) {
boolean b = FileUtil.deleteFile(fileName);
if (!b) {
return R.error("数据库记录删除成功,文件删除失败");
}
return R.ok();
} else {
return R.error();
}
}
/**
* 删除
*/
@PostMapping("/batchRemove")
@ResponseBody
@RequiresPermissions("common:remove")
public R remove(@RequestParam("ids[]") Long[] ids) {
if ("test".equals(getUsername())) {
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
}
sysFileService.batchRemove(ids);
return R.ok();
}
/**
* 删除
*/
@PostMapping("/batchRemove")
@ResponseBody
@RequiresPermissions("common:remove")
public R remove(@RequestParam("ids[]") Long[] ids) {
if ("test".equals(getUsername())) {
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
}
sysFileService.batchRemove(ids);
return R.ok();
}
@ResponseBody
@PostMapping("/upload")
R upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
if ("test".equals(getUsername())) {
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
}
Date date = new Date();
String year = DateUtils.format(date,DateUtils.YEAR_PATTERN);
String month = DateUtils.format(date,DateUtils.MONTH_PATTERN);
String day = DateUtils.format(date,DateUtils.DAY_PATTERN);
@ResponseBody
@PostMapping("/upload")
R upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
if ("test".equals(getUsername())) {
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
}
Date date = new Date();
String year = DateUtils.format(date, DateUtils.YEAR_PATTERN);
String month = DateUtils.format(date, DateUtils.MONTH_PATTERN);
String day = DateUtils.format(date, DateUtils.DAY_PATTERN);
String fileName = file.getOriginalFilename();
String fileDir = year+"/"+month+"/"+day + "/";
fileName = FileUtil.renameToUUID(fileName);
FileDO sysFile = new FileDO(FileType.fileType(fileName), "/files/" + fileDir + fileName, date);
try {
FileUtil.uploadFile(file.getBytes(), jnConfig.getUploadPath()+fileDir, fileName);
} catch (Exception e) {
return R.error();
}
String fileName = file.getOriginalFilename();
String fileDir = year + "/" + month + "/" + day + "/";
fileName = FileUtil.renameToUUID(fileName);
FileDO sysFile = new FileDO(FileType.fileType(fileName), Constant.UPLOAD_FILES_PREFIX + fileDir + fileName,
date);
try {
FileUtil.uploadFile(file.getBytes(), jnConfig.getUploadPath() + fileDir, fileName);
} catch (Exception e) {
return R.error();
}
if (sysFileService.save(sysFile) > 0) {
return R.ok().put("fileName",sysFile.getUrl());
}
return R.error();
}
if (sysFileService.save(sysFile) > 0) {
return R.ok().put("fileName", sysFile.getUrl());
}
return R.error();
}
/**
* 文件下载
*/
@RequestMapping(value = "/download")
public void fileDownload(String filePath,String fileName, HttpServletResponse resp) throws Exception {
String realFilePath = jnConfig.getUploadPath() + filePath;
InputStream in = new FileInputStream(realFilePath);
//设置响应头对文件进行url编码
fileName = URLEncoder.encode(fileName, "UTF-8");
resp.setHeader("Content-Disposition", "attachment;filename=" + fileName);
/**
* 文件下载
*/
@RequestMapping(value = "/download")
public void fileDownload(String filePath, String fileName, HttpServletResponse resp) throws Exception {
String realFilePath = jnConfig.getUploadPath() + filePath;
InputStream in = new FileInputStream(realFilePath);
//设置响应头对文件进行url编码
fileName = URLEncoder.encode(fileName, "UTF-8");
resp.setHeader("Content-Disposition", "attachment;filename=" + fileName);
resp.setContentLength(in.available());
resp.setContentLength(in.available());
OutputStream out = resp.getOutputStream();
byte[] b = new byte[1024];
int len = 0;
while ((len = in.read(b)) != -1) {
out.write(b, 0, len);
}
out.flush();
out.close();
in.close();
}
OutputStream out = resp.getOutputStream();
byte[] b = new byte[1024];
int len = 0;
while ((len = in.read(b)) != -1) {
out.write(b, 0, len);
}
out.flush();
out.close();
in.close();
}
}

View File

@ -1,72 +1,74 @@
package com.java2nb.common.service.impl;
import com.java2nb.common.config.Constant;
import com.java2nb.common.config.JnConfig;
import com.java2nb.common.dao.FileDao;
import com.java2nb.common.domain.FileDO;
import com.java2nb.common.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.io.File;
import java.util.List;
import java.util.Map;
import com.java2nb.common.dao.FileDao;
import com.java2nb.common.domain.FileDO;
import com.java2nb.common.service.FileService;
import org.springframework.util.StringUtils;
@Service
public class FileServiceImpl implements FileService {
@Autowired
private FileDao sysFileMapper;
@Autowired
private JnConfig jnConfig;
@Override
public FileDO get(Long id){
return sysFileMapper.get(id);
}
@Override
public List<FileDO> list(Map<String, Object> map){
return sysFileMapper.list(map);
}
@Override
public int count(Map<String, Object> map){
return sysFileMapper.count(map);
}
@Override
public int save(FileDO sysFile){
return sysFileMapper.save(sysFile);
}
@Override
public int update(FileDO sysFile){
return sysFileMapper.update(sysFile);
}
@Override
public int remove(Long id){
return sysFileMapper.remove(id);
}
@Override
public int batchRemove(Long[] ids){
return sysFileMapper.batchRemove(ids);
}
@Autowired
private FileDao sysFileMapper;
@Autowired
private JnConfig jnConfig;
@Override
public FileDO get(Long id) {
return sysFileMapper.get(id);
}
@Override
public List<FileDO> list(Map<String, Object> map) {
return sysFileMapper.list(map);
}
@Override
public int count(Map<String, Object> map) {
return sysFileMapper.count(map);
}
@Override
public int save(FileDO sysFile) {
return sysFileMapper.save(sysFile);
}
@Override
public int update(FileDO sysFile) {
return sysFileMapper.update(sysFile);
}
@Override
public int remove(Long id) {
return sysFileMapper.remove(id);
}
@Override
public int batchRemove(Long[] ids) {
return sysFileMapper.batchRemove(ids);
}
@Override
public Boolean isExist(String url) {
Boolean isExist = false;
if (!StringUtils.isEmpty(url)) {
String filePath = url.replace("/files/", "");
filePath = jnConfig.getUploadPath() + filePath;
File file = new File(filePath);
if (file.exists()) {
isExist = true;
}
}
return isExist;
}
}
Boolean isExist = false;
if (!StringUtils.isEmpty(url)) {
String filePath = url.replace(Constant.UPLOAD_FILES_PREFIX, "");
filePath = jnConfig.getUploadPath() + filePath;
File file = new File(filePath);
if (file.exists()) {
isExist = true;
}
}
return isExist;
}
}

View File

@ -0,0 +1,50 @@
package com.java2nb.novel.controller;
import com.java2nb.common.utils.R;
import com.java2nb.novel.domain.WebsiteInfoDO;
import com.java2nb.novel.service.WebsiteInfoService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 网站信息表
*
* @author xiongxy
* @email 1179705413@qq.com
* @date 2023-04-14 11:05:43
*/
@Controller
@RequestMapping("/novel/websiteInfo")
public class WebsiteInfoController {
@Autowired
private WebsiteInfoService websiteInfoService;
@GetMapping()
@RequiresPermissions("novel:websiteInfo:detail")
String detail(Model model) {
WebsiteInfoDO websiteInfo = websiteInfoService.get(1L);
model.addAttribute("websiteInfo", websiteInfo);
return "novel/websiteInfo/detail";
}
/**
* 修改
*/
@ApiOperation(value = "修改网站信息表", notes = "修改网站信息表")
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("novel:websiteInfo:edit")
public R update(WebsiteInfoDO websiteInfo) {
websiteInfoService.update(websiteInfo);
return R.ok();
}
}

View File

@ -0,0 +1,32 @@
package com.java2nb.novel.dao;
import com.java2nb.novel.domain.WebsiteInfoDO;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
/**
* 网站信息表
* @author xiongxy
* @email 1179705413@qq.com
* @date 2023-04-14 11:05:43
*/
@Mapper
public interface WebsiteInfoDao {
WebsiteInfoDO get(Long id);
List<WebsiteInfoDO> list(Map<String,Object> map);
int count(Map<String,Object> map);
int save(WebsiteInfoDO websiteInfo);
int update(WebsiteInfoDO websiteInfo);
int remove(Long id);
int batchRemove(Long[] ids);
}

View File

@ -0,0 +1,208 @@
package com.java2nb.novel.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.java2nb.common.jsonserializer.LongToStringSerializer;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 网站信息表
*
* @author xiongxy
* @email 1179705413@qq.com
* @date 2023-04-14 11:05:43
*/
public class WebsiteInfoDO implements Serializable {
private static final long serialVersionUID = 1L;
//主键
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
private Long id;
//网站名
private String name;
//网站域名
private String domain;
//SEO关键词
private String keyword;
//网站描述
private String description;
//站长QQ
private String qq;
//网站logo图片默认
private String logo;
//网站logo图片深色
private String logoDark;
//创建时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//创建人ID
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
private Long createUserId;
//更新时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
//更新人ID
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
private Long updateUserId;
/**
* 设置主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取主键
*/
public Long getId() {
return id;
}
/**
* 设置网站名
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取网站名
*/
public String getName() {
return name;
}
/**
* 设置网站域名
*/
public void setDomain(String domain) {
this.domain = domain;
}
/**
* 获取网站域名
*/
public String getDomain() {
return domain;
}
/**
* 设置SEO关键词
*/
public void setKeyword(String keyword) {
this.keyword = keyword;
}
/**
* 获取SEO关键词
*/
public String getKeyword() {
return keyword;
}
/**
* 设置网站描述
*/
public void setDescription(String description) {
this.description = description;
}
/**
* 获取网站描述
*/
public String getDescription() {
return description;
}
/**
* 设置站长QQ
*/
public void setQq(String qq) {
this.qq = qq;
}
/**
* 获取站长QQ
*/
public String getQq() {
return qq;
}
/**
* 设置网站logo图片默认
*/
public void setLogo(String logo) {
this.logo = logo;
}
/**
* 获取网站logo图片默认
*/
public String getLogo() {
return logo;
}
/**
* 设置网站logo图片深色
*/
public void setLogoDark(String logoDark) {
this.logoDark = logoDark;
}
/**
* 获取网站logo图片深色
*/
public String getLogoDark() {
return logoDark;
}
/**
* 设置创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置创建人ID
*/
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
/**
* 获取创建人ID
*/
public Long getCreateUserId() {
return createUserId;
}
/**
* 设置更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* 设置更新人ID
*/
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
/**
* 获取更新人ID
*/
public Long getUpdateUserId() {
return updateUserId;
}
}

View File

@ -0,0 +1,30 @@
package com.java2nb.novel.service;
import com.java2nb.novel.domain.WebsiteInfoDO;
import java.util.List;
import java.util.Map;
/**
* 网站信息表
*
* @author xiongxy
* @email 1179705413@qq.com
* @date 2023-04-14 11:05:43
*/
public interface WebsiteInfoService {
WebsiteInfoDO get(Long id);
List<WebsiteInfoDO> list(Map<String, Object> map);
int count(Map<String, Object> map);
int save(WebsiteInfoDO websiteInfo);
int update(WebsiteInfoDO websiteInfo);
int remove(Long id);
int batchRemove(Long[] ids);
}

View File

@ -0,0 +1,55 @@
package com.java2nb.novel.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import com.java2nb.novel.dao.WebsiteInfoDao;
import com.java2nb.novel.domain.WebsiteInfoDO;
import com.java2nb.novel.service.WebsiteInfoService;
@Service
public class WebsiteInfoServiceImpl implements WebsiteInfoService {
@Autowired
private WebsiteInfoDao websiteInfoDao;
@Override
public WebsiteInfoDO get(Long id){
return websiteInfoDao.get(id);
}
@Override
public List<WebsiteInfoDO> list(Map<String, Object> map){
return websiteInfoDao.list(map);
}
@Override
public int count(Map<String, Object> map){
return websiteInfoDao.count(map);
}
@Override
public int save(WebsiteInfoDO websiteInfo){
return websiteInfoDao.save(websiteInfo);
}
@Override
public int update(WebsiteInfoDO websiteInfo){
return websiteInfoDao.update(websiteInfo);
}
@Override
public int remove(Long id){
return websiteInfoDao.remove(id);
}
@Override
public int batchRemove(Long[] ids){
return websiteInfoDao.batchRemove(ids);
}
}

View File

@ -1,14 +1,19 @@
package com.java2nb.system.service.impl;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.util.*;
import com.java2nb.common.config.Constant;
import com.java2nb.common.config.JnConfig;
import com.java2nb.common.domain.FileDO;
import com.java2nb.common.domain.Tree;
import com.java2nb.common.service.FileService;
import com.java2nb.common.utils.*;
import com.java2nb.system.dao.DeptDao;
import com.java2nb.system.dao.SysUserDao;
import com.java2nb.system.dao.UserRoleDao;
import com.java2nb.system.domain.DeptDO;
import com.java2nb.system.domain.UserDO;
import com.java2nb.system.domain.UserRoleDO;
import com.java2nb.system.service.DeptService;
import com.java2nb.system.service.SysUserService;
import com.java2nb.system.vo.UserVO;
import org.apache.commons.lang.ArrayUtils;
import org.slf4j.Logger;
@ -16,22 +21,17 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.java2nb.common.domain.Tree;
import com.java2nb.system.dao.DeptDao;
import com.java2nb.system.dao.SysUserDao;
import com.java2nb.system.dao.UserRoleDao;
import com.java2nb.system.domain.DeptDO;
import com.java2nb.system.domain.UserDO;
import com.java2nb.system.domain.UserRoleDO;
import com.java2nb.system.service.SysUserService;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.util.*;
@Transactional
@Service
public class SysUserServiceImpl implements SysUserService {
@Autowired
SysUserDao userMapper;
@Autowired
@ -64,7 +64,7 @@ public class SysUserServiceImpl implements SysUserService {
List<Long> childIds = deptService.listChildrenIds(deptIdl);
childIds.add(deptIdl);
map.put("deptId", null);
map.put("deptIds",childIds);
map.put("deptIds", childIds);
}
return userMapper.listByPerm(map);
}
@ -213,7 +213,7 @@ public class SysUserServiceImpl implements SysUserService {
public Map<String, Object> updatePersonalImg(MultipartFile file, String avatar_data, Long userId) throws Exception {
String fileName = file.getOriginalFilename();
fileName = FileUtil.renameToUUID(fileName);
FileDO sysFile = new FileDO(FileType.fileType(fileName), "/files/" + fileName, new Date());
FileDO sysFile = new FileDO(FileType.fileType(fileName), Constant.UPLOAD_FILES_PREFIX + fileName, new Date());
//获取图片后缀
String prefix = fileName.substring((fileName.lastIndexOf(".") + 1));
String[] str = avatar_data.split(",");

View File

@ -10,7 +10,7 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: test123456
#password:

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.java2nb.novel.dao.WebsiteInfoDao">
<select id="get" resultType="com.java2nb.novel.domain.WebsiteInfoDO">
select `id`,`name`,`domain`,`keyword`,`description`,`qq`,`logo`,`logo_dark`,`create_time`,`create_user_id`,`update_time`,`update_user_id` from website_info where id = #{value}
</select>
<select id="list" resultType="com.java2nb.novel.domain.WebsiteInfoDO">
select `id`,`name`,`domain`,`keyword`,`description`,`qq`,`logo`,`logo_dark`,`create_time`,`create_user_id`,`update_time`,`update_user_id` from website_info
<where>
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="name != null and name != ''"> and name = #{name} </if>
<if test="domain != null and domain != ''"> and domain = #{domain} </if>
<if test="keyword != null and keyword != ''"> and keyword = #{keyword} </if>
<if test="description != null and description != ''"> and description = #{description} </if>
<if test="qq != null and qq != ''"> and qq = #{qq} </if>
<if test="logo != null and logo != ''"> and logo = #{logo} </if>
<if test="logoDark != null and logoDark != ''"> and logo_dark = #{logoDark} </if>
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
<if test="createUserId != null and createUserId != ''"> and create_user_id = #{createUserId} </if>
<if test="updateTime != null and updateTime != ''"> and update_time = #{updateTime} </if>
<if test="updateUserId != null and updateUserId != ''"> and update_user_id = #{updateUserId} </if>
</where>
<choose>
<when test="sort != null and sort.trim() != ''">
order by ${sort} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="count" resultType="int">
select count(*) from website_info
<where>
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="name != null and name != ''"> and name = #{name} </if>
<if test="domain != null and domain != ''"> and domain = #{domain} </if>
<if test="keyword != null and keyword != ''"> and keyword = #{keyword} </if>
<if test="description != null and description != ''"> and description = #{description} </if>
<if test="qq != null and qq != ''"> and qq = #{qq} </if>
<if test="logo != null and logo != ''"> and logo = #{logo} </if>
<if test="logoDark != null and logoDark != ''"> and logo_dark = #{logoDark} </if>
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
<if test="createUserId != null and createUserId != ''"> and create_user_id = #{createUserId} </if>
<if test="updateTime != null and updateTime != ''"> and update_time = #{updateTime} </if>
<if test="updateUserId != null and updateUserId != ''"> and update_user_id = #{updateUserId} </if>
</where>
</select>
<insert id="save" parameterType="com.java2nb.novel.domain.WebsiteInfoDO">
insert into website_info
(
`id`,
`name`,
`domain`,
`keyword`,
`description`,
`qq`,
`logo`,
`logo_dark`,
`create_time`,
`create_user_id`,
`update_time`,
`update_user_id`
)
values
(
#{id},
#{name},
#{domain},
#{keyword},
#{description},
#{qq},
#{logo},
#{logoDark},
#{createTime},
#{createUserId},
#{updateTime},
#{updateUserId}
)
</insert>
<insert id="saveSelective" parameterType="com.java2nb.novel.domain.WebsiteInfoDO">
insert into website_info
(
<if test="id != null"> `id`, </if>
<if test="name != null"> `name`, </if>
<if test="domain != null"> `domain`, </if>
<if test="keyword != null"> `keyword`, </if>
<if test="description != null"> `description`, </if>
<if test="qq != null"> `qq`, </if>
<if test="logo != null"> `logo`, </if>
<if test="logoDark != null"> `logo_dark`, </if>
<if test="createTime != null"> `create_time`, </if>
<if test="createUserId != null"> `create_user_id`, </if>
<if test="updateTime != null"> `update_time`, </if>
<if test="updateUserId != null"> `update_user_id` </if>
)
values
(
<if test="id != null"> #{id}, </if>
<if test="name != null"> #{name}, </if>
<if test="domain != null"> #{domain}, </if>
<if test="keyword != null"> #{keyword}, </if>
<if test="description != null"> #{description}, </if>
<if test="qq != null"> #{qq}, </if>
<if test="logo != null"> #{logo}, </if>
<if test="logoDark != null"> #{logoDark}, </if>
<if test="createTime != null"> #{createTime}, </if>
<if test="createUserId != null"> #{createUserId}, </if>
<if test="updateTime != null"> #{updateTime}, </if>
<if test="updateUserId != null"> #{updateUserId} </if>
)
</insert>
<update id="update" parameterType="com.java2nb.novel.domain.WebsiteInfoDO">
update website_info
<set>
<if test="name != null">`name` = #{name}, </if>
<if test="domain != null">`domain` = #{domain}, </if>
<if test="keyword != null">`keyword` = #{keyword}, </if>
<if test="description != null">`description` = #{description}, </if>
<if test="qq != null">`qq` = #{qq}, </if>
<if test="logo != null">`logo` = #{logo}, </if>
<if test="logoDark != null">`logo_dark` = #{logoDark}, </if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="createUserId != null">`create_user_id` = #{createUserId}, </if>
<if test="updateTime != null">`update_time` = #{updateTime}, </if>
<if test="updateUserId != null">`update_user_id` = #{updateUserId}</if>
</set>
where id = #{id}
</update>
<delete id="remove">
delete from website_info where id = #{value}
</delete>
<delete id="batchRemove">
delete from website_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,99 @@
var E = window.wangEditor;
$("[id^='contentEditor']").each(function (index, ele) {
var relName = $(ele).attr("id").substring(13);
var editor = new E('#contentEditor' + relName);
// 自定义菜单配置
editor.customConfig.menus = [
'head', // 标题
'bold', // 粗体
'fontSize', // 字号
'fontName', // 字体
'italic', // 斜体
'underline', // 下划线
'strikeThrough', // 删除线
'foreColor', // 文字颜色
//'backColor', // 背景颜色
//'link', // 插入链接
'list', // 列表
'justify', // 对齐方式
'quote', // 引用
'emoticon', // 表情
'image', // 插入图片
//'table', // 表格
//'video', // 插入视频
//'code', // 插入代码
'undo', // 撤销
'redo' // 重复
];
editor.customConfig.onchange = function (html) {
// html 即变化之后的内容
$("#" + relName).val(html);
}
editor.customConfig.uploadImgShowBase64 = true;
editor.create();
editor.txt.html($("#" + relName).val());
})
$("[id^='picImage']").each(function (index, ele) {
var relName = $(ele).attr("id").substring(8);
layui.use('upload', function () {
var upload = layui.upload;
//执行实例
var uploadInst = upload.render({
elem: '#picImage' + relName, //绑定元素
url: '/common/sysFile/upload', //上传接口
size: 1000,
accept: 'file',
done: function (r) {
$("#picImage" + relName).attr("src", r.fileName);
$("#" + relName).val(r.fileName);
},
error: function (r) {
layer.msg(r.msg);
}
});
});
});
$().ready(function () {
validateRule();
});
$.validator.setDefaults({
submitHandler: function () {
update();
}
});
function update() {
$.ajax({
cache: true,
type: "POST",
url: "/novel/websiteInfo/update",
data: $('#signupForm').serialize(),// 你的formid
async: false,
error: function (request) {
layer.alert("Connection error");
},
success: function (data) {
if (data.code == 0) {
layer.msg("操作成功");
} else {
layer.alert(data.msg)
}
}
});
}
function validateRule() {
var icon = "<i class='fa fa-times-circle'></i> ";
$("#signupForm").validate({
ignore: "",
rules: {},
messages: {}
})
}

View File

@ -1,18 +0,0 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '作者表', 'novel/author', 'novel:author:author', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, 'novel:author:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, 'novel:author:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, 'novel:author:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, 'novel:author:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, 'novel:author:batchRemove', '2', null, '6';

View File

@ -1,18 +0,0 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '作家邀请码表', 'novel/authorCode', 'novel:authorCode:authorCode', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, 'novel:authorCode:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, 'novel:authorCode:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, 'novel:authorCode:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, 'novel:authorCode:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, 'novel:authorCode:batchRemove', '2', null, '6';

View File

@ -1,18 +0,0 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '小说表', 'novel/book', 'novel:book:book', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, 'novel:book:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, 'novel:book:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, 'novel:book:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, 'novel:book:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, 'novel:book:batchRemove', '2', null, '6';

View File

@ -1,18 +0,0 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '新闻类别表', 'novel/category', 'novel:category:category', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, 'novel:category:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, 'novel:category:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, 'novel:category:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, 'novel:category:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, 'novel:category:batchRemove', '2', null, '6';

View File

@ -1,18 +0,0 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '新闻表', 'novel/news', 'novel:news:news', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, 'novel:news:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, 'novel:news:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, 'novel:news:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, 'novel:news:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, 'novel:news:batchRemove', '2', null, '6';

View File

@ -1,18 +0,0 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '充值订单', 'novel/pay', 'novel:pay:pay', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, 'novel:pay:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, 'novel:pay:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, 'novel:pay:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, 'novel:pay:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, 'novel:pay:batchRemove', '2', null, '6';

View File

@ -1,18 +0,0 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '', 'novel/user', 'novel:user:user', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, 'novel:user:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, 'novel:user:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, 'novel:user:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, 'novel:user:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, 'novel:user:batchRemove', '2', null, '6';

View File

@ -0,0 +1,36 @@
--菜单SQL
INSERT
INTO`sys_menu`(`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES('247', '网站信息表', 'novel/websiteInfo', 'novel:websiteInfo:websiteInfo', '1', 'fa', '6');
--按钮父菜单ID
set
@parentId
= @@identity;
--菜单对应按钮SQL
INSERT
INTO`sys_menu`(`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT
@parentId,
'查看', null, 'novel:websiteInfo:detail', '2', null, '6';
INSERT
INTO`sys_menu`(`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT
@parentId,
'新增', null, 'novel:websiteInfo:add', '2', null, '6';
INSERT
INTO`sys_menu`(`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT
@parentId,
'修改', null, 'novel:websiteInfo:edit', '2', null, '6';
INSERT
INTO`sys_menu`(`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT
@parentId,
'删除', null, 'novel:websiteInfo:remove', '2', null, '6';
INSERT
INTO`sys_menu`(`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT
@parentId,
'批量删除', null, 'novel:websiteInfo:batchRemove', '2', null, '6';

View File

@ -0,0 +1,93 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<input id="id" name="id" th:value="${websiteInfo.id}"
type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">网站名:</label>
<div class="col-sm-8">
<input id="name" name="name"
th:value="${websiteInfo.name}"
class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">网站域名:</label>
<div class="col-sm-8">
<input id="domain" name="domain"
th:value="${websiteInfo.domain}"
class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">SEO关键词</label>
<div class="col-sm-8">
<input id="keyword" name="keyword"
th:value="${websiteInfo.keyword}"
class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">网站描述:</label>
<div class="col-sm-8">
<input id="description" name="description"
th:value="${websiteInfo.description}"
class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">站长QQ</label>
<div class="col-sm-8">
<input id="qq" name="qq"
th:value="${websiteInfo.qq}"
class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">网站logo图片默认</label>
<div class="col-sm-8">
<input id="description" name="logo"
th:value="${websiteInfo.logo}"
class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">网站logo图片深色</label>
<div class="col-sm-8">
<input id="description" name="logoDark"
th:value="${websiteInfo.logoDark}"
class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
<script type="text/javascript" src="/js/appjs/novel/websiteInfo/edit.js">
</script>
</body>
</html>

View File

@ -0,0 +1,162 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class WebsiteInfo {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String name;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String domain;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String keyword;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String description;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String qq;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String logo;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String logoDark;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getName() {
return name;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getDomain() {
return domain;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setDomain(String domain) {
this.domain = domain == null ? null : domain.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getKeyword() {
return keyword;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setKeyword(String keyword) {
this.keyword = keyword == null ? null : keyword.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getDescription() {
return description;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getQq() {
return qq;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setQq(String qq) {
this.qq = qq == null ? null : qq.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getLogo() {
return logo;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setLogo(String logo) {
this.logo = logo == null ? null : logo.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getLogoDark() {
return logoDark;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setLogoDark(String logoDark) {
this.logoDark = logoDark == null ? null : logoDark.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getCreateUserId() {
return createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUpdateUserId() {
return updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
}

View File

@ -0,0 +1,79 @@
package com.java2nb.novel.mapper;
import java.sql.JDBCType;
import java.util.Date;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.SqlColumn;
import org.mybatis.dynamic.sql.SqlTable;
public final class WebsiteInfoDynamicSqlSupport {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final WebsiteInfo websiteInfo = new WebsiteInfo();
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> id = websiteInfo.id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> name = websiteInfo.name;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> domain = websiteInfo.domain;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> keyword = websiteInfo.keyword;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> description = websiteInfo.description;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> qq = websiteInfo.qq;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> logo = websiteInfo.logo;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> logoDark = websiteInfo.logoDark;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Date> createTime = websiteInfo.createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> createUserId = websiteInfo.createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Date> updateTime = websiteInfo.updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> updateUserId = websiteInfo.updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final class WebsiteInfo extends SqlTable {
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
public final SqlColumn<String> name = column("name", JDBCType.VARCHAR);
public final SqlColumn<String> domain = column("domain", JDBCType.VARCHAR);
public final SqlColumn<String> keyword = column("keyword", JDBCType.VARCHAR);
public final SqlColumn<String> description = column("description", JDBCType.VARCHAR);
public final SqlColumn<String> qq = column("qq", JDBCType.VARCHAR);
public final SqlColumn<String> logo = column("logo", JDBCType.VARCHAR);
public final SqlColumn<String> logoDark = column("logo_dark", JDBCType.VARCHAR);
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
public final SqlColumn<Long> createUserId = column("create_user_id", JDBCType.BIGINT);
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
public final SqlColumn<Long> updateUserId = column("update_user_id", JDBCType.BIGINT);
public WebsiteInfo() {
super("website_info");
}
}
}

View File

@ -0,0 +1,248 @@
package com.java2nb.novel.mapper;
import static com.java2nb.novel.mapper.WebsiteInfoDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import com.java2nb.novel.entity.WebsiteInfo;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
@Mapper
public interface WebsiteInfoMapper {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
BasicColumn[] selectList = BasicColumn.columnList(id, name, domain, keyword, description, qq, logo, logoDark, createTime, createUserId, updateTime, updateUserId);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
long count(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
int delete(DeleteStatementProvider deleteStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
int insert(InsertStatementProvider<WebsiteInfo> insertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
int insertMultiple(MultiRowInsertStatementProvider<WebsiteInfo> multipleInsertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("WebsiteInfoResult")
Optional<WebsiteInfo> selectOne(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="WebsiteInfoResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="domain", property="domain", jdbcType=JdbcType.VARCHAR),
@Result(column="keyword", property="keyword", jdbcType=JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
@Result(column="qq", property="qq", jdbcType=JdbcType.VARCHAR),
@Result(column="logo", property="logo", jdbcType=JdbcType.VARCHAR),
@Result(column="logo_dark", property="logoDark", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT)
})
List<WebsiteInfo> selectMany(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
int update(UpdateStatementProvider updateStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, websiteInfo, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, websiteInfo, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int deleteByPrimaryKey(Long id_) {
return delete(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insert(WebsiteInfo record) {
return MyBatis3Utils.insert(this::insert, record, websiteInfo, c ->
c.map(id).toProperty("id")
.map(name).toProperty("name")
.map(domain).toProperty("domain")
.map(keyword).toProperty("keyword")
.map(description).toProperty("description")
.map(qq).toProperty("qq")
.map(logo).toProperty("logo")
.map(logoDark).toProperty("logoDark")
.map(createTime).toProperty("createTime")
.map(createUserId).toProperty("createUserId")
.map(updateTime).toProperty("updateTime")
.map(updateUserId).toProperty("updateUserId")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertMultiple(Collection<WebsiteInfo> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, websiteInfo, c ->
c.map(id).toProperty("id")
.map(name).toProperty("name")
.map(domain).toProperty("domain")
.map(keyword).toProperty("keyword")
.map(description).toProperty("description")
.map(qq).toProperty("qq")
.map(logo).toProperty("logo")
.map(logoDark).toProperty("logoDark")
.map(createTime).toProperty("createTime")
.map(createUserId).toProperty("createUserId")
.map(updateTime).toProperty("updateTime")
.map(updateUserId).toProperty("updateUserId")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertSelective(WebsiteInfo record) {
return MyBatis3Utils.insert(this::insert, record, websiteInfo, c ->
c.map(id).toPropertyWhenPresent("id", record::getId)
.map(name).toPropertyWhenPresent("name", record::getName)
.map(domain).toPropertyWhenPresent("domain", record::getDomain)
.map(keyword).toPropertyWhenPresent("keyword", record::getKeyword)
.map(description).toPropertyWhenPresent("description", record::getDescription)
.map(qq).toPropertyWhenPresent("qq", record::getQq)
.map(logo).toPropertyWhenPresent("logo", record::getLogo)
.map(logoDark).toPropertyWhenPresent("logoDark", record::getLogoDark)
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
.map(createUserId).toPropertyWhenPresent("createUserId", record::getCreateUserId)
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
.map(updateUserId).toPropertyWhenPresent("updateUserId", record::getUpdateUserId)
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<WebsiteInfo> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, websiteInfo, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<WebsiteInfo> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, websiteInfo, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<WebsiteInfo> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, websiteInfo, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<WebsiteInfo> selectByPrimaryKey(Long id_) {
return selectOne(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, websiteInfo, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateAllColumns(WebsiteInfo record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalTo(record::getId)
.set(name).equalTo(record::getName)
.set(domain).equalTo(record::getDomain)
.set(keyword).equalTo(record::getKeyword)
.set(description).equalTo(record::getDescription)
.set(qq).equalTo(record::getQq)
.set(logo).equalTo(record::getLogo)
.set(logoDark).equalTo(record::getLogoDark)
.set(createTime).equalTo(record::getCreateTime)
.set(createUserId).equalTo(record::getCreateUserId)
.set(updateTime).equalTo(record::getUpdateTime)
.set(updateUserId).equalTo(record::getUpdateUserId);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateSelectiveColumns(WebsiteInfo record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalToWhenPresent(record::getId)
.set(name).equalToWhenPresent(record::getName)
.set(domain).equalToWhenPresent(record::getDomain)
.set(keyword).equalToWhenPresent(record::getKeyword)
.set(description).equalToWhenPresent(record::getDescription)
.set(qq).equalToWhenPresent(record::getQq)
.set(logo).equalToWhenPresent(record::getLogo)
.set(logoDark).equalToWhenPresent(record::getLogoDark)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
.set(updateUserId).equalToWhenPresent(record::getUpdateUserId);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKey(WebsiteInfo record) {
return update(c ->
c.set(name).equalTo(record::getName)
.set(domain).equalTo(record::getDomain)
.set(keyword).equalTo(record::getKeyword)
.set(description).equalTo(record::getDescription)
.set(qq).equalTo(record::getQq)
.set(logo).equalTo(record::getLogo)
.set(logoDark).equalTo(record::getLogoDark)
.set(createTime).equalTo(record::getCreateTime)
.set(createUserId).equalTo(record::getCreateUserId)
.set(updateTime).equalTo(record::getUpdateTime)
.set(updateUserId).equalTo(record::getUpdateUserId)
.where(id, isEqualTo(record::getId))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKeySelective(WebsiteInfo record) {
return update(c ->
c.set(name).equalToWhenPresent(record::getName)
.set(domain).equalToWhenPresent(record::getDomain)
.set(keyword).equalToWhenPresent(record::getKeyword)
.set(description).equalToWhenPresent(record::getDescription)
.set(qq).equalToWhenPresent(record::getQq)
.set(logo).equalToWhenPresent(record::getLogo)
.set(logoDark).equalToWhenPresent(record::getLogoDark)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
.set(updateUserId).equalToWhenPresent(record::getUpdateUserId)
.where(id, isEqualTo(record::getId))
);
}
}

View File

@ -23,7 +23,7 @@ spring:
#连接超时时间毫秒
timeout: 30000
datasource:
url: jdbc:mysql://127.0.0.1:3306/novel_biz?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456
driver-class-name: com.mysql.cj.jdbc.Driver

View File

@ -1,21 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--Mybatis Generator目前有5种运行模式分别为MyBatis3DynamicSqlMyBatis3KotlinMyBatis3MyBatis3SimpleMyBatis3DynamicSqlV1-->
<context id="springboot-base" targetRuntime="MyBatis3DynamicSql">
<commentGenerator>
<!-- 是否去除自动生成的注释 true false: -->
<property name="suppressAllComments" value="true" />
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<jdbcConnection
connectionURL="jdbc:mysql://127.0.0.1:3306/novel_plus?tinyInt1isBit=false&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;serverTimezone=Asia/Shanghai&amp;nullCatalogMeansCurrent=true"
driverClass="com.mysql.jdbc.Driver" password="test123456"
userId="root" />
userId="root"/>
<!-- 默认false把JDBC DECIMAL NUMERIC 类型解析为 Integer true时把JDBC DECIMAL
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- targetProject:生成PO类的位置 -->
@ -23,16 +24,16 @@
targetPackage="com.java2nb.novel.entity"
targetProject="novel-common/src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<property name="enableSubPackages" value="false"/>
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- targetProject:mapper映射文件生成的位置 -->
<sqlMapGenerator targetPackage="mybatis.mapping"
targetProject="novel-common/src/main/resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- targetPackagemapper接口生成的位置 -->
@ -40,11 +41,11 @@
targetPackage="com.java2nb.novel.mapper"
targetProject="novel-common/src/main/java" type="XMLMAPPER">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!--生成全部表tableName设为%-->
<table tableName="book_index"/>
<table tableName="website_info"/>
<!-- 指定数据库表 -->
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->

View File

@ -1,18 +0,0 @@
package com.java2nb.novel.core.config;
import com.java2nb.novel.core.converter.DateConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* @author xiongxiaoyang
*/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverter(new DateConverter());
}
}

View File

@ -1,6 +1,8 @@
package com.java2nb.novel.core.listener;
import com.java2nb.novel.core.config.WebsiteProperties;
import com.java2nb.novel.entity.WebsiteInfo;
import com.java2nb.novel.mapper.WebsiteInfoMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -10,6 +12,7 @@ import javax.servlet.annotation.WebListener;
/**
* 启动监听器
*
* @author xiongxiaoyang
*/
@WebListener
@ -17,12 +20,21 @@ import javax.servlet.annotation.WebListener;
@RequiredArgsConstructor
public class StarterListener implements ServletContextListener {
private final WebsiteProperties websiteConfig;
private final WebsiteProperties websiteProperties;
private final WebsiteInfoMapper websiteInfoMapper;
@Override
public void contextInitialized(ServletContextEvent sce) {
sce.getServletContext().setAttribute("website",websiteConfig);
sce.getServletContext()
.setAttribute("website", websiteInfoMapper.selectByPrimaryKey(1L).orElse(new WebsiteInfo() {{
setName(websiteProperties.getName());
setDomain(websiteProperties.getDomain());
setKeyword(websiteProperties.getKeyword());
setDescription(websiteProperties.getDescription());
setQq(websiteProperties.getQq());
setLogo("/images/logo.png");
setLogoDark("/images/logo_white.png");
}}));
}
}

View File

@ -1,13 +1,13 @@
spring:
profiles:
include: [common-dev]
include: [ common-dev ]
pic:
save:
type: 1 #图片保存方式, 1不保存使用爬取的网络图片 2保存在自己的存储介质
storage: local #存储介质local本地OSS阿里云对象存储fastDfs分布式文件系统
path: /Users/xiongxiaoyang/java #图片保存路径
path: /Users/xiongxiaoyang/java/ #图片保存路径

View File

@ -1,12 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link},~{})">
<title th:utext="${book.bookName}+'_'+${bookIndex.indexName}+'_'+${application.website.name}"></title>
<meta name="keywords" th:content="${book.bookName}+'官方首发,'+${book.bookName}+'小说,'+${book.bookName}+'最新章节,'+${book.bookName}+'txt下载,'+${book.bookName}+'无弹窗,'+${book.bookName}+'吧,'+${book.bookName}+'离线完本'" />
<meta name="description" th:content="${book.bookName}+','+${book.bookName}+'小说阅读,'+${application.website.name}+'提供'+${book.bookName}+'首发最新章节及txt下载,'+${book.bookName}+'最新更新章节,精彩尽在'+${application.website.name}+'。'" />
<link rel="stylesheet" href="/css/read.css" />
<link href="/css/book.css" rel="stylesheet" />
<meta name="keywords"
th:content="${book.bookName}+'官方首发,'+${book.bookName}+'小说,'+${book.bookName}+'最新章节,'+${book.bookName}+'txt下载,'+${book.bookName}+'无弹窗,'+${book.bookName}+'吧,'+${book.bookName}+'离线完本'"/>
<meta name="description"
th:content="${book.bookName}+','+${book.bookName}+'小说阅读,'+${application.website.name}+'提供'+${book.bookName}+'首发最新章节及txt下载,'+${book.bookName}+'最新更新章节,精彩尽在'+${application.website.name}+'。'"/>
<link rel="stylesheet" href="/css/read.css"/>
<link href="/css/book.css" rel="stylesheet"/>
</head>
<link href="/layui/css/layui.css" rel="stylesheet"/>
@ -25,13 +27,13 @@
<script src="/javascript/bookdetail.js" type="text/javascript"></script>
<script type="text/javascript">
BookDetail.SetReadFontFamilyClear(0);
var font = localStorage.getItem("fonts");
var font = localStorage.getItem("fonts");
var colorNum = localStorage.getItem("colorNum");
var fontNum = localStorage.getItem("fontNum");
</script>
<body class="read_style_1" oncontextmenu="return false" onselectstart="return false"
<body class="read_style_1" oncontextmenu="return false" onselectstart="return false"
ondragstart="return false" onbeforecopy="return false" oncopy="document.selection.empty()"
onselect="document.selection.empty()">
@ -42,6 +44,8 @@
<input type="hidden" id="preContentId" th:value="${bookIndex.id}"/>
<input type="hidden" id="preIndexId" th:value="${preBookIndexId}"/>
<input type="hidden" id="nextIndexId" th:value="${nextBookIndexId}"/>
<input type="hidden" id="logo" th:value="${application.website.logo}"/>
<input type="hidden" id="logoDark" th:value="${application.website.logoDark}"/>
<div th:replace="common/top :: top('10')">
</div>
@ -53,29 +57,35 @@
<div class="read_menu">
<div class="menu_left" style="">
<ul>
<li><a class="ico_catalog" th:href="'/book/indexList-'+${book.id}+'.html'" title="目录">
<li><a class="ico_catalog" th:href="'/book/indexList-'+${book.id}+'.html'" title="目录">
<b>目录</b></a></li>
<li><a class="ico_page" th:href="'/book/'+${book.id}+'.html'" title="返回书页"><b>书页</b></a></li>
<li><a class="ico_page" th:href="'/book/'+${book.id}+'.html'" title="返回书页"><b>书页</b></a></li>
<li class="li_shelf" id="cFavs"><a class="ico_shelf" href="javascript:void(0);" title="加入书架"
onclick="javascript:BookDetail.AddFavorites(37,1959973,1);"><b>加书架</b></a></li>
onclick="javascript:BookDetail.AddFavorites(37,1959973,1);"><b>加书架</b></a>
</li>
<li class="li_shelfed" style="display: none;"><a class="ico_shelfed" href="javascript:void(0);"
title="已收藏"><b>已收藏</b></a></li>
<li><a class="ico_comment" th:href="'/book/comment-'+${book.id}+'.html'" title="评论">
<li><a class="ico_comment" th:href="'/book/comment-'+${book.id}+'.html'" title="评论">
<b>评论</b></a></li>
<li><a class="ico_setup" href="javascript:void(0);" title="设置"><b>设置</b></a></li>
</ul>
</div>
<div class="menu_right" style="position: fixed; bottom: 0">
<ul>
<li><a class="ico_pagePrev" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'" title="上一章"><i>上一章</i></a></li>
<li><a class="ico_pageNext" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'" title="下一章"><i>下一章</i></a></li>
<li><a class="ico_pagePrev"
th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'"
title="上一章"><i>上一章</i></a></li>
<li><a class="ico_pageNext"
th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'"
title="下一章"><i>下一章</i></a></li>
</ul>
</div>
</div>
<div class="readWrap">
<div class="bookNav">
<a href="/" >首页 </a>&gt; <a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}">
<a href="/">首页 </a>&gt; <a th:href="'/book/bookclass.html?c='+${book.catId}"
th:text="${book.catName}">
</a>&gt; <a th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}">
</a>
@ -85,10 +95,13 @@
<div class="book_title">
<h1 th:utext="${bookIndex.indexName}">
</h1>
</h1>
<div class="textinfo">
类别<a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a>
作者<a th:href="'javascript:searchByK(\''+${book.authorName}+'\')'" th:utext="${book.authorName}"></a><span th:text="'字数:'+${bookIndex.wordCount}"></span><span th:text="'更新时间:'+${#dates.format(bookIndex.updateTime, 'yy/MM/dd HH:mm:ss')}"></span>
作者<a th:href="'javascript:searchByK(\''+${book.authorName}+'\')'"
th:utext="${book.authorName}"></a><span
th:text="'字数:'+${bookIndex.wordCount}"></span><span
th:text="'更新时间:'+${#dates.format(bookIndex.updateTime, 'yy/MM/dd HH:mm:ss')}"></span>
</div>
</div>
<div class="txtwrap" th:if="${needBuy}">
@ -98,7 +111,8 @@
</p>
<div class="pc_bar" style="display: none;">
<a href="javascript:void(0);" class="icon_pc" onclick="javascript:uFans.startSupportRead();">
<a href="javascript:void(0);" class="icon_pc"
onclick="javascript:uFans.startSupportRead();">
<span><i class="icon_yb"></i><em>捧场</em></span>
</a>
</div>
@ -107,8 +121,10 @@
<h3>此章为VIP章节需要订阅后才能继续阅读</h3>
<form method="post" action="./2052117.html?bid=302&amp;cid=2052117" id="Form1">
<ul class="order_list">
<li>价格<span class="red" th:text="${bookIndex.bookPrice}+'屋币(1元=100屋币)'"></span></li>
<li id="panelPay" class="btns"><a class="btn_red" href="javascript:buyBookIndex()" >购买</a></li>
<li>价格<span class="red" th:text="${bookIndex.bookPrice}+'屋币(1元=100屋币)'"></span>
</li>
<li id="panelPay" class="btns"><a class="btn_red"
href="javascript:buyBookIndex()">购买</a></li>
</ul>
<input type="hidden" name="HidCId" id="HidCId" value="2052117">
@ -118,11 +134,13 @@
</div>
</div>
<div class="txtwrap" th:if="${!needBuy}">
<div id="showReading" class="readBox" style="font-size: 16px; font-family: microsoft yahei" th:utext="${bookContent.content}">
<div id="showReading" class="readBox" style="font-size: 16px; font-family: microsoft yahei"
th:utext="${bookContent.content}">
<div class="pc_bar" style="display: none;">
<a href="javascript:void(0);" class="icon_pc" onclick="javascript:uFans.startSupportRead();">
<a href="javascript:void(0);" class="icon_pc"
onclick="javascript:uFans.startSupportRead();">
<span><i class="icon_yb"></i><em>捧场</em></span>
</a>
</div>
@ -133,8 +151,11 @@
</div>
</div>
<div class="nextPageBox">
<a class="prev" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a> <a class="dir" th:href="'/book/indexList-'+${book.id}+'.html'"
>目录</a> <a class="next" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
<a class="prev"
th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a>
<a class="dir" th:href="'/book/indexList-'+${book.id}+'.html'"
>目录</a> <a class="next"
th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
</div>
</div>
</div>
@ -159,18 +180,31 @@
<li class="readTheme">
<em class="tit">阅读主题:</em>
<a id="setup_color_white" class="white current"
href="javascript:void(0);" title="白色" onclick="javascript:BookDetail.SetBackUpColor(1);"></a><a id="setup_color_green" class="green" href="javascript:void(0);" title="绿色"
onclick="javascript:BookDetail.SetBackUpColor(2);"></a><a id="setup_color_pink" class="pink"
href="javascript:void(0);" title="粉色" onclick="javascript:BookDetail.SetBackUpColor(3);"></a><a id="setup_color_yellow" class="yellow" href="javascript:void(0);" title="黄色"
onclick="javascript:BookDetail.SetBackUpColor(4);"></a><a id="setup_color_gray" class="gray"
href="javascript:void(0);" title="灰色" onclick="javascript:BookDetail.SetBackUpColor(5);"></a><a id="setup_color_night" class="night" href="javascript:void(0);" title="夜间"
onclick="javascript:BookDetail.SetBackUpColor(6);"></a></li>
href="javascript:void(0);" title="白色" onclick="javascript:BookDetail.SetBackUpColor(1);"></a><a
id="setup_color_green" class="green" href="javascript:void(0);" title="绿色"
onclick="javascript:BookDetail.SetBackUpColor(2);"></a><a id="setup_color_pink" class="pink"
href="javascript:void(0);" title="粉色"
onclick="javascript:BookDetail.SetBackUpColor(3);"></a><a
id="setup_color_yellow" class="yellow" href="javascript:void(0);" title="黄色"
onclick="javascript:BookDetail.SetBackUpColor(4);"></a><a id="setup_color_gray" class="gray"
href="javascript:void(0);" title="灰色"
onclick="javascript:BookDetail.SetBackUpColor(5);"></a><a
id="setup_color_night" class="night" href="javascript:void(0);" title="夜间"
onclick="javascript:BookDetail.SetBackUpColor(6);"></a></li>
<li class="setFont setBtn"><em class="tit">正文字体:</em> <a id="setup_font_yahei" class="setYahei current"
href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFontFamily(0);">雅黑</a> <a id="setup_font_simsun" class="setSimsun" href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFontFamily(1);">宋体</a> <a id="setup_font_ks" class="setKs" href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFontFamily(2);">楷书</a> </li>
href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFontFamily(0);">雅黑</a>
<a id="setup_font_simsun" class="setSimsun" href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFontFamily(1);">宋体</a> <a id="setup_font_ks" class="setKs"
href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFontFamily(2);">楷书</a>
</li>
<li class="fontSize setBtn"><em class="tit">字体大小:</em> <a class="small" href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFont(-2);">A-</a><span class="current_font"
id="cFonts">
16</span><a class="big" href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFont(2);">A+</a> </li>
onclick="javascript:BookDetail.SetReadFont(-2);">A-</a><span
class="current_font"
id="cFonts">
16</span><a class="big" href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFont(2);">A+</a></li>
</ul>
</div>
</div>
@ -208,30 +242,32 @@
</form>-->
<script language="javascript" type="text/javascript">
if(font){
var logo = $("#logo").val();
var logoDark = $("#logoDark").val();
if (font) {
$(".readBox").css("font-size", font + "px");
$("#cFonts").html(font);
$("#ChapterBody").attr("class","article-content font"+font);
$("#ChapterBody").attr("class", "article-content font" + font);
BookDetail.reShowCover();
}
if(fontNum){
if (fontNum) {
BookDetail.SetReadFontFamily(fontNum);
}
if(colorNum){
if (colorNum) {
BookDetail.SetBackUpColor(colorNum);
if(colorNum == 6){
$(".logo img").attr("src", "/images/logo_white.png");
if (colorNum == 6) {
$(".logo img").attr("src", logoDark);
}
}
//查询是否在书架
$.ajax({
type: "get",
url: "/user/queryIsInShelf",
data: {'bookId':$("#bookId").val()},
data: {'bookId': $("#bookId").val()},
dataType: "json",
success: function (data) {
if (data.code == 200) {
if(data.data){
if (data.data) {
$("#cFavs").html("<a class=\"ico_shelf\" href=\"javascript:void(0);\"><b>已收藏</b></a>");
}
//添加阅读记录
@ -248,10 +284,10 @@
})
} else if(data.code == 1001){
} else if (data.code == 1001) {
//未登录
}else {
} else {
layer.alert(data.msg);
}
@ -267,7 +303,7 @@
var preIndexId = $("#preIndexId").val();
var nextIndexId = $("#nextIndexId").val();
$(function () {
BookDetail.GetReadSet(bookId,indexId,preIndexId,nextIndexId,1);
BookDetail.GetReadSet(bookId, indexId, preIndexId, nextIndexId, 1);
$(".ico_setup").click(function () {
$(".maskBox,.setupBox").show();
@ -280,68 +316,73 @@
var vtop = $(document).scrollTop();
var vbottom = $(document).height() - vtop - $(window).height();
if (vtop > 50) {
$(".menu_left").css("position", "fixed"); $(".menu_left").css("top", "2px");
}
else {
$(".menu_left").css("position", "absolute"); $(".menu_left").css("top", "60px")
$(".menu_left").css("position", "fixed");
$(".menu_left").css("top", "2px");
} else {
$(".menu_left").css("position", "absolute");
$(".menu_left").css("top", "60px")
}
if (vbottom < 150) {
$(".menu_right").css("position", "absolute"); $(".menu_right").css("bottom", "150px");
}
else {
$(".menu_right").css("position", "fixed"); $(".menu_right").css("bottom", "2px");
$(".menu_right").css("position", "absolute");
$(".menu_right").css("bottom", "150px");
} else {
$(".menu_right").css("position", "fixed");
$(".menu_right").css("bottom", "2px");
}
});
var bgClass = '1';
if (bgClass == 6) {
$(".logo img").attr("src", "/images/logo_white.png");
$(".logo img").attr("src", logoDark);
}
$(".readTheme a").click(function () {
$(".logo img").attr("src", "/images/logo.png");
$(".logo img").attr("src", logo);
})
$("#setup_color_night").click(function () {
$(".logo img").attr("src", "/images/logo_white.png");
$(".logo img").attr("src", logoDark);
});
});
function enterPreIndexPage(bookId,bookIndexId){
if(bookIndexId != 0){
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
}else{
window.location.href = '/book/indexList-' + bookId + '.html';
}
}
function enterNextIndexPage(bookId,bookIndexId){
if(bookIndexId != 0){
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
}else{
function enterPreIndexPage(bookId, bookIndexId) {
if (bookIndexId != 0) {
window.location.href = '/book/' + bookId + '/' + bookIndexId + ".html";
} else {
window.location.href = '/book/indexList-' + bookId + '.html';
}
}
function buyBookIndex(){
function enterNextIndexPage(bookId, bookIndexId) {
if (bookIndexId != 0) {
window.location.href = '/book/' + bookId + '/' + bookIndexId + ".html";
} else {
window.location.href = '/book/indexList-' + bookId + '.html';
}
}
function buyBookIndex() {
$.ajax({
type: "POST",
url: "/user/buyBookIndex",
data: {'bookId':$("#bookId").val(),"bookName":$("#bookName").val(),
"bookIndexId":$("#preContentId").val(),"bookIndexName":$("#preIndexName").val()},
data: {
'bookId': $("#bookId").val(), "bookName": $("#bookName").val(),
"bookIndexId": $("#preContentId").val(), "bookIndexName": $("#preIndexName").val()
},
dataType: "json",
success: function (data) {
if (data.code == 200) {
location.reload();
location.reload();
} else if(data.code == 1001){
} else if (data.code == 1001) {
//未登录
location.href = '/user/login.html?originUrl='+decodeURIComponent(location.href);
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}

View File

@ -21,7 +21,8 @@
</div>
<div class="topMain">
<div class="box_center cf">
<a href="/?m=2" class="logo fl"><img src="/images/logo.png" th:alt="${application.website.name}"/></a>
<a href="/?m=2" class="logo fl"><img th:src="${application.website.logo}"
th:alt="${application.website.name}"/></a>
<div class="searchBar fl">
<div class="search cf">
<input type="text" placeholder="书名、作者、关键字" class="s_int" name="searchKey" id="searchKey"/>
@ -36,7 +37,7 @@
</div>
</div>
<div class="mainNav" id="mainNav" th:style="${navType} == 10?'display:none':''">
<div class="box_center cf" >
<div class="box_center cf">
<ul class="nav" id="navModule">
<li th:class="${navType}==0?'on':''"><a href="/">首页</a></li>

View File

@ -1,12 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link},~{})">
<title th:utext="${book.bookName}+'_'+${bookIndex.indexName}+'_'+${application.website.name}"></title>
<meta name="keywords" th:content="${book.bookName}+'官方首发,'+${book.bookName}+'小说,'+${book.bookName}+'最新章节,'+${book.bookName}+'txt下载,'+${book.bookName}+'无弹窗,'+${book.bookName}+'吧,'+${book.bookName}+'离线完本'" />
<meta name="description" th:content="${book.bookName}+','+${book.bookName}+'小说阅读,'+${application.website.name}+'提供'+${book.bookName}+'首发最新章节及txt下载,'+${book.bookName}+'最新更新章节,精彩尽在'+${application.website.name}+'。'" />
<link rel="stylesheet" href="/css/read.css" />
<link href="/css/book.css" rel="stylesheet" />
<meta name="keywords"
th:content="${book.bookName}+'官方首发,'+${book.bookName}+'小说,'+${book.bookName}+'最新章节,'+${book.bookName}+'txt下载,'+${book.bookName}+'无弹窗,'+${book.bookName}+'吧,'+${book.bookName}+'离线完本'"/>
<meta name="description"
th:content="${book.bookName}+','+${book.bookName}+'小说阅读,'+${application.website.name}+'提供'+${book.bookName}+'首发最新章节及txt下载,'+${book.bookName}+'最新更新章节,精彩尽在'+${application.website.name}+'。'"/>
<link rel="stylesheet" href="/css/read.css"/>
<link href="/css/book.css" rel="stylesheet"/>
</head>
<link href="/layui/css/layui.css" rel="stylesheet"/>
@ -25,13 +27,13 @@
<script src="/javascript/bookdetail.js" type="text/javascript"></script>
<script type="text/javascript">
BookDetail.SetReadFontFamilyClear(0);
var font = localStorage.getItem("fonts");
var font = localStorage.getItem("fonts");
var colorNum = localStorage.getItem("colorNum");
var fontNum = localStorage.getItem("fontNum");
</script>
<body class="read_style_1" oncontextmenu="return false" onselectstart="return false"
<body class="read_style_1" oncontextmenu="return false" onselectstart="return false"
ondragstart="return false" onbeforecopy="return false" oncopy="document.selection.empty()"
onselect="document.selection.empty()">
@ -42,6 +44,8 @@
<input type="hidden" id="preContentId" th:value="${bookIndex.id}"/>
<input type="hidden" id="preIndexId" th:value="${preBookIndexId}"/>
<input type="hidden" id="nextIndexId" th:value="${nextBookIndexId}"/>
<input type="hidden" id="logo" th:value="${application.website.logo}"/>
<input type="hidden" id="logoDark" th:value="${application.website.logoDark}"/>
<div th:replace="common/top :: top('10')">
</div>
@ -53,29 +57,35 @@
<div class="read_menu">
<div class="menu_left" style="">
<ul>
<li><a class="ico_catalog" th:href="'/book/indexList-'+${book.id}+'.html'" title="目录">
<li><a class="ico_catalog" th:href="'/book/indexList-'+${book.id}+'.html'" title="目录">
<b>目录</b></a></li>
<li><a class="ico_page" th:href="'/book/'+${book.id}+'.html'" title="返回书页"><b>书页</b></a></li>
<li><a class="ico_page" th:href="'/book/'+${book.id}+'.html'" title="返回书页"><b>书页</b></a></li>
<li class="li_shelf" id="cFavs"><a class="ico_shelf" href="javascript:void(0);" title="加入书架"
onclick="javascript:BookDetail.AddFavorites(37,1959973,1);"><b>加书架</b></a></li>
onclick="javascript:BookDetail.AddFavorites(37,1959973,1);"><b>加书架</b></a>
</li>
<li class="li_shelfed" style="display: none;"><a class="ico_shelfed" href="javascript:void(0);"
title="已收藏"><b>已收藏</b></a></li>
<li><a class="ico_comment" th:href="'/book/comment-'+${book.id}+'.html'" title="评论">
<li><a class="ico_comment" th:href="'/book/comment-'+${book.id}+'.html'" title="评论">
<b>评论</b></a></li>
<li><a class="ico_setup" href="javascript:void(0);" title="设置"><b>设置</b></a></li>
</ul>
</div>
<div class="menu_right" style="position: fixed; bottom: 0">
<ul>
<li><a class="ico_pagePrev" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'" title="上一章"><i>上一章</i></a></li>
<li><a class="ico_pageNext" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'" title="下一章"><i>下一章</i></a></li>
<li><a class="ico_pagePrev"
th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'"
title="上一章"><i>上一章</i></a></li>
<li><a class="ico_pageNext"
th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'"
title="下一章"><i>下一章</i></a></li>
</ul>
</div>
</div>
<div class="readWrap">
<div class="bookNav">
<a href="/" >首页 </a>&gt; <a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}">
<a href="/">首页 </a>&gt; <a th:href="'/book/bookclass.html?c='+${book.catId}"
th:text="${book.catName}">
</a>&gt; <a th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}">
</a>
@ -85,10 +95,13 @@
<div class="book_title">
<h1 th:utext="${bookIndex.indexName}">
</h1>
</h1>
<div class="textinfo">
类别<a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a>
作者<a th:href="'javascript:searchByK(\''+${book.authorName}+'\')'" th:utext="${book.authorName}"></a><span th:text="'字数:'+${bookIndex.wordCount}"></span><span th:text="'更新时间:'+${#dates.format(bookIndex.updateTime, 'yy/MM/dd HH:mm:ss')}"></span>
作者<a th:href="'javascript:searchByK(\''+${book.authorName}+'\')'"
th:utext="${book.authorName}"></a><span
th:text="'字数:'+${bookIndex.wordCount}"></span><span
th:text="'更新时间:'+${#dates.format(bookIndex.updateTime, 'yy/MM/dd HH:mm:ss')}"></span>
</div>
</div>
<div class="txtwrap" th:if="${needBuy}">
@ -98,7 +111,8 @@
</p>
<div class="pc_bar" style="display: none;">
<a href="javascript:void(0);" class="icon_pc" onclick="javascript:uFans.startSupportRead();">
<a href="javascript:void(0);" class="icon_pc"
onclick="javascript:uFans.startSupportRead();">
<span><i class="icon_yb"></i><em>捧场</em></span>
</a>
</div>
@ -107,8 +121,10 @@
<h3>此章为VIP章节需要订阅后才能继续阅读</h3>
<form method="post" action="./2052117.html?bid=302&amp;cid=2052117" id="Form1">
<ul class="order_list">
<li>价格<span class="red" th:text="${bookIndex.bookPrice}+'屋币(1元=100屋币)'"></span></li>
<li id="panelPay" class="btns"><a class="btn_red" href="javascript:buyBookIndex()" >购买</a></li>
<li>价格<span class="red" th:text="${bookIndex.bookPrice}+'屋币(1元=100屋币)'"></span>
</li>
<li id="panelPay" class="btns"><a class="btn_red"
href="javascript:buyBookIndex()">购买</a></li>
</ul>
<input type="hidden" name="HidCId" id="HidCId" value="2052117">
@ -118,11 +134,13 @@
</div>
</div>
<div class="txtwrap" th:if="${!needBuy}">
<div id="showReading" class="readBox" style="font-size: 16px; font-family: microsoft yahei" th:utext="${bookContent.content}">
<div id="showReading" class="readBox" style="font-size: 16px; font-family: microsoft yahei"
th:utext="${bookContent.content}">
<div class="pc_bar" style="display: none;">
<a href="javascript:void(0);" class="icon_pc" onclick="javascript:uFans.startSupportRead();">
<a href="javascript:void(0);" class="icon_pc"
onclick="javascript:uFans.startSupportRead();">
<span><i class="icon_yb"></i><em>捧场</em></span>
</a>
</div>
@ -133,8 +151,11 @@
</div>
</div>
<div class="nextPageBox">
<a class="prev" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a> <a class="dir" th:href="'/book/indexList-'+${book.id}+'.html'"
>目录</a> <a class="next" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
<a class="prev"
th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a>
<a class="dir" th:href="'/book/indexList-'+${book.id}+'.html'"
>目录</a> <a class="next"
th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
</div>
</div>
</div>
@ -159,18 +180,31 @@
<li class="readTheme">
<em class="tit">阅读主题:</em>
<a id="setup_color_white" class="white current"
href="javascript:void(0);" title="白色" onclick="javascript:BookDetail.SetBackUpColor(1);"></a><a id="setup_color_green" class="green" href="javascript:void(0);" title="绿色"
onclick="javascript:BookDetail.SetBackUpColor(2);"></a><a id="setup_color_pink" class="pink"
href="javascript:void(0);" title="粉色" onclick="javascript:BookDetail.SetBackUpColor(3);"></a><a id="setup_color_yellow" class="yellow" href="javascript:void(0);" title="黄色"
onclick="javascript:BookDetail.SetBackUpColor(4);"></a><a id="setup_color_gray" class="gray"
href="javascript:void(0);" title="灰色" onclick="javascript:BookDetail.SetBackUpColor(5);"></a><a id="setup_color_night" class="night" href="javascript:void(0);" title="夜间"
onclick="javascript:BookDetail.SetBackUpColor(6);"></a></li>
href="javascript:void(0);" title="白色" onclick="javascript:BookDetail.SetBackUpColor(1);"></a><a
id="setup_color_green" class="green" href="javascript:void(0);" title="绿色"
onclick="javascript:BookDetail.SetBackUpColor(2);"></a><a id="setup_color_pink" class="pink"
href="javascript:void(0);" title="粉色"
onclick="javascript:BookDetail.SetBackUpColor(3);"></a><a
id="setup_color_yellow" class="yellow" href="javascript:void(0);" title="黄色"
onclick="javascript:BookDetail.SetBackUpColor(4);"></a><a id="setup_color_gray" class="gray"
href="javascript:void(0);" title="灰色"
onclick="javascript:BookDetail.SetBackUpColor(5);"></a><a
id="setup_color_night" class="night" href="javascript:void(0);" title="夜间"
onclick="javascript:BookDetail.SetBackUpColor(6);"></a></li>
<li class="setFont setBtn"><em class="tit">正文字体:</em> <a id="setup_font_yahei" class="setYahei current"
href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFontFamily(0);">雅黑</a> <a id="setup_font_simsun" class="setSimsun" href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFontFamily(1);">宋体</a> <a id="setup_font_ks" class="setKs" href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFontFamily(2);">楷书</a> </li>
href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFontFamily(0);">雅黑</a>
<a id="setup_font_simsun" class="setSimsun" href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFontFamily(1);">宋体</a> <a id="setup_font_ks" class="setKs"
href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFontFamily(2);">楷书</a>
</li>
<li class="fontSize setBtn"><em class="tit">字体大小:</em> <a class="small" href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFont(-2);">A-</a><span class="current_font"
id="cFonts">
16</span><a class="big" href="javascript:void(0);" onclick="javascript:BookDetail.SetReadFont(2);">A+</a> </li>
onclick="javascript:BookDetail.SetReadFont(-2);">A-</a><span
class="current_font"
id="cFonts">
16</span><a class="big" href="javascript:void(0);"
onclick="javascript:BookDetail.SetReadFont(2);">A+</a></li>
</ul>
</div>
</div>
@ -208,30 +242,32 @@
</form>-->
<script language="javascript" type="text/javascript">
if(font){
var logo = $("#logo").val();
var logoDark = $("#logoDark").val();
if (font) {
$(".readBox").css("font-size", font + "px");
$("#cFonts").html(font);
$("#ChapterBody").attr("class","article-content font"+font);
$("#ChapterBody").attr("class", "article-content font" + font);
BookDetail.reShowCover();
}
if(fontNum){
if (fontNum) {
BookDetail.SetReadFontFamily(fontNum);
}
if(colorNum){
if (colorNum) {
BookDetail.SetBackUpColor(colorNum);
if(colorNum == 6){
$(".logo img").attr("src", "/images/logo_white.png");
if (colorNum == 6) {
$(".logo img").attr("src", logoDark);
}
}
//查询是否在书架
$.ajax({
type: "get",
url: "/user/queryIsInShelf",
data: {'bookId':$("#bookId").val()},
data: {'bookId': $("#bookId").val()},
dataType: "json",
success: function (data) {
if (data.code == 200) {
if(data.data){
if (data.data) {
$("#cFavs").html("<a class=\"ico_shelf\" href=\"javascript:void(0);\"><b>已收藏</b></a>");
}
//添加阅读记录
@ -248,10 +284,10 @@
})
} else if(data.code == 1001){
} else if (data.code == 1001) {
//未登录
}else {
} else {
layer.alert(data.msg);
}
@ -267,7 +303,7 @@
var preIndexId = $("#preIndexId").val();
var nextIndexId = $("#nextIndexId").val();
$(function () {
BookDetail.GetReadSet(bookId,indexId,preIndexId,nextIndexId,1);
BookDetail.GetReadSet(bookId, indexId, preIndexId, nextIndexId, 1);
$(".ico_setup").click(function () {
$(".maskBox,.setupBox").show();
@ -280,68 +316,73 @@
var vtop = $(document).scrollTop();
var vbottom = $(document).height() - vtop - $(window).height();
if (vtop > 50) {
$(".menu_left").css("position", "fixed"); $(".menu_left").css("top", "2px");
}
else {
$(".menu_left").css("position", "absolute"); $(".menu_left").css("top", "60px")
$(".menu_left").css("position", "fixed");
$(".menu_left").css("top", "2px");
} else {
$(".menu_left").css("position", "absolute");
$(".menu_left").css("top", "60px")
}
if (vbottom < 150) {
$(".menu_right").css("position", "absolute"); $(".menu_right").css("bottom", "150px");
}
else {
$(".menu_right").css("position", "fixed"); $(".menu_right").css("bottom", "2px");
$(".menu_right").css("position", "absolute");
$(".menu_right").css("bottom", "150px");
} else {
$(".menu_right").css("position", "fixed");
$(".menu_right").css("bottom", "2px");
}
});
var bgClass = '1';
if (bgClass == 6) {
$(".logo img").attr("src", "/images/logo_white.png");
$(".logo img").attr("src", logoDark);
}
$(".readTheme a").click(function () {
$(".logo img").attr("src", "/images/logo.png");
$(".logo img").attr("src", logo);
})
$("#setup_color_night").click(function () {
$(".logo img").attr("src", "/images/logo_white.png");
$(".logo img").attr("src", logoDark);
});
});
function enterPreIndexPage(bookId,bookIndexId){
if(bookIndexId != 0){
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
}else{
window.location.href = '/book/indexList-' + bookId + '.html';
}
}
function enterNextIndexPage(bookId,bookIndexId){
if(bookIndexId != 0){
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
}else{
function enterPreIndexPage(bookId, bookIndexId) {
if (bookIndexId != 0) {
window.location.href = '/book/' + bookId + '/' + bookIndexId + ".html";
} else {
window.location.href = '/book/indexList-' + bookId + '.html';
}
}
function buyBookIndex(){
function enterNextIndexPage(bookId, bookIndexId) {
if (bookIndexId != 0) {
window.location.href = '/book/' + bookId + '/' + bookIndexId + ".html";
} else {
window.location.href = '/book/indexList-' + bookId + '.html';
}
}
function buyBookIndex() {
$.ajax({
type: "POST",
url: "/user/buyBookIndex",
data: {'bookId':$("#bookId").val(),"bookName":$("#bookName").val(),
"bookIndexId":$("#preContentId").val(),"bookIndexName":$("#preIndexName").val()},
data: {
'bookId': $("#bookId").val(), "bookName": $("#bookName").val(),
"bookIndexId": $("#preContentId").val(), "bookIndexName": $("#preIndexName").val()
},
dataType: "json",
success: function (data) {
if (data.code == 200) {
location.reload();
location.reload();
} else if(data.code == 1001){
} else if (data.code == 1001) {
//未登录
location.href = '/user/login.html?originUrl='+decodeURIComponent(location.href);
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}