restful api改造

This commit is contained in:
xiongxiaoyang 2020-12-12 10:03:15 +08:00
parent a8c74d061c
commit 355cb80458
35 changed files with 95 additions and 135 deletions

View File

@ -9,10 +9,7 @@ import com.java2nb.novel.service.CrawlService;
import com.java2nb.novel.vo.CrawlSingleTaskVO; import com.java2nb.novel.vo.CrawlSingleTaskVO;
import com.java2nb.novel.vo.CrawlSourceVO; import com.java2nb.novel.vo.CrawlSourceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author Administrator * @author Administrator
@ -39,7 +36,7 @@ public class CrawlController {
/** /**
* 爬虫源分页列表查询 * 爬虫源分页列表查询
* */ * */
@PostMapping("listCrawlByPage") @GetMapping("listCrawlByPage")
public ResultBean listCrawlByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){ public ResultBean listCrawlByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
return ResultBean.ok(new PageInfo<>(BeanUtil.copyList(crawlService.listCrawlByPage(page,pageSize), CrawlSourceVO.class) return ResultBean.ok(new PageInfo<>(BeanUtil.copyList(crawlService.listCrawlByPage(page,pageSize), CrawlSourceVO.class)
@ -71,7 +68,7 @@ public class CrawlController {
/** /**
* 单本采集任务分页列表查询 * 单本采集任务分页列表查询
* */ * */
@PostMapping("listCrawlSingleTaskByPage") @GetMapping("listCrawlSingleTaskByPage")
public ResultBean listCrawlSingleTaskByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){ public ResultBean listCrawlSingleTaskByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
return ResultBean.ok(new PageInfo<>(BeanUtil.copyList(crawlService.listCrawlSingleTaskByPage(page,pageSize), CrawlSingleTaskVO.class) return ResultBean.ok(new PageInfo<>(BeanUtil.copyList(crawlService.listCrawlSingleTaskByPage(page,pageSize), CrawlSingleTaskVO.class)
@ -81,8 +78,8 @@ public class CrawlController {
/** /**
* 删除采集任务 * 删除采集任务
* */ * */
@PostMapping("delCrawlSingleTask") @DeleteMapping("delCrawlSingleTask/{id}")
public ResultBean delCrawlSingleTask(Long id){ public ResultBean delCrawlSingleTask(@PathVariable("id") Long id){
crawlService.delCrawlSingleTask(id); crawlService.delCrawlSingleTask(id);

View File

@ -96,7 +96,7 @@
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
$(function () { $(function () {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/crawl/listCrawlByPage", url: "/crawl/listCrawlByPage",
data: {'curr':1,'limit':100}, data: {'curr':1,'limit':100},
dataType: "json", dataType: "json",

View File

@ -125,7 +125,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/crawl/listCrawlSingleTaskByPage", url: "/crawl/listCrawlSingleTaskByPage",
data: {'curr': curr, 'limit': limit}, data: {'curr': curr, 'limit': limit},
dataType: "json", dataType: "json",
@ -205,9 +205,9 @@
function del(id) { function del(id) {
$.ajax({ $.ajax({
type: "POST", type: "delete",
url: "/crawl/delCrawlSingleTask", url: "/crawl/delCrawlSingleTask/"+id,
data: {'id': id}, data: {},
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (data.code == 200) { if (data.code == 200) {

View File

@ -122,7 +122,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/crawl/listCrawlByPage", url: "/crawl/listCrawlByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -13,10 +13,7 @@ import com.java2nb.novel.service.BookService;
import com.java2nb.novel.service.FriendLinkService; import com.java2nb.novel.service.FriendLinkService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -38,7 +35,7 @@ public class AuthorController extends BaseController{
/** /**
* 校验笔名是否存在 * 校验笔名是否存在
* */ * */
@PostMapping("checkPenName") @GetMapping("checkPenName")
public ResultBean checkPenName(String penName){ public ResultBean checkPenName(String penName){
return ResultBean.ok(authorService.checkPenName(penName)); return ResultBean.ok(authorService.checkPenName(penName));
@ -47,7 +44,7 @@ public class AuthorController extends BaseController{
/** /**
* 作家发布小说分页列表查询 * 作家发布小说分页列表查询
* */ * */
@PostMapping("listBookByPage") @GetMapping("listBookByPage")
public ResultBean listBookByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize ,HttpServletRequest request){ public ResultBean listBookByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize ,HttpServletRequest request){
return ResultBean.ok(new PageInfo<>(bookService.listBookPageByUserId(getUserDetails(request).getId(),page,pageSize) return ResultBean.ok(new PageInfo<>(bookService.listBookPageByUserId(getUserDetails(request).getId(),page,pageSize)
@ -90,8 +87,8 @@ public class AuthorController extends BaseController{
/** /**
* 删除章节 * 删除章节
*/ */
@PostMapping("deleteIndex") @DeleteMapping("deleteIndex/{indexId}")
public ResultBean deleteIndex(Long indexId, HttpServletRequest request) { public ResultBean deleteIndex(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
Author author = checkAuthor(request); Author author = checkAuthor(request);
@ -136,8 +133,8 @@ public class AuthorController extends BaseController{
/** /**
* 查询章节内容 * 查询章节内容
*/ */
@PostMapping("queryIndexContent") @GetMapping("queryIndexContent/{indexId}")
public ResultBean queryIndexContent(Long indexId, HttpServletRequest request) { public ResultBean queryIndexContent(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
Author author = checkAuthor(request); Author author = checkAuthor(request);
@ -167,7 +164,7 @@ public class AuthorController extends BaseController{
/** /**
* 作家日收入统计数据分页列表查询 * 作家日收入统计数据分页列表查询
* */ * */
@PostMapping("listIncomeDailyByPage") @GetMapping("listIncomeDailyByPage")
public ResultBean listIncomeDailyByPage(@RequestParam(value = "curr", defaultValue = "1") int page, public ResultBean listIncomeDailyByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
@RequestParam(value = "limit", defaultValue = "10") int pageSize , @RequestParam(value = "limit", defaultValue = "10") int pageSize ,
@RequestParam(value = "bookId", defaultValue = "0") Long bookId, @RequestParam(value = "bookId", defaultValue = "0") Long bookId,
@ -183,7 +180,7 @@ public class AuthorController extends BaseController{
/** /**
* 作家月收入统计数据分页列表查询 * 作家月收入统计数据分页列表查询
* */ * */
@PostMapping("listIncomeMonthByPage") @GetMapping("listIncomeMonthByPage")
public ResultBean listIncomeMonthByPage(@RequestParam(value = "curr", defaultValue = "1") int page, public ResultBean listIncomeMonthByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
@RequestParam(value = "limit", defaultValue = "10") int pageSize , @RequestParam(value = "limit", defaultValue = "10") int pageSize ,
@RequestParam(value = "bookId", defaultValue = "0") Long bookId, @RequestParam(value = "bookId", defaultValue = "0") Long bookId,

View File

@ -12,10 +12,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
@ -41,7 +38,7 @@ public class BookController extends BaseController{
/** /**
* 查询首页小说设置列表数据 * 查询首页小说设置列表数据
* */ * */
@PostMapping("listBookSetting") @GetMapping("listBookSetting")
public ResultBean listBookSetting(){ public ResultBean listBookSetting(){
return ResultBean.ok(bookService.listBookSettingVO()); return ResultBean.ok(bookService.listBookSettingVO());
} }
@ -49,7 +46,7 @@ public class BookController extends BaseController{
/** /**
* 查询首页点击榜单数据 * 查询首页点击榜单数据
* */ * */
@PostMapping("listClickRank") @GetMapping("listClickRank")
public ResultBean listClickRank(){ public ResultBean listClickRank(){
return ResultBean.ok(bookService.listClickRank()); return ResultBean.ok(bookService.listClickRank());
} }
@ -57,7 +54,7 @@ public class BookController extends BaseController{
/** /**
* 查询首页新书榜单数据 * 查询首页新书榜单数据
* */ * */
@PostMapping("listNewRank") @GetMapping("listNewRank")
public ResultBean listNewRank(){ public ResultBean listNewRank(){
return ResultBean.ok(bookService.listNewRank()); return ResultBean.ok(bookService.listNewRank());
} }
@ -65,7 +62,7 @@ public class BookController extends BaseController{
/** /**
* 查询首页更新榜单数据 * 查询首页更新榜单数据
* */ * */
@PostMapping("listUpdateRank") @GetMapping("listUpdateRank")
public ResultBean listUpdateRank(){ public ResultBean listUpdateRank(){
return ResultBean.ok(bookService.listUpdateRank()); return ResultBean.ok(bookService.listUpdateRank());
} }
@ -73,7 +70,7 @@ public class BookController extends BaseController{
/** /**
* 查询小说分类列表 * 查询小说分类列表
* */ * */
@PostMapping("listBookCategory") @GetMapping("listBookCategory")
public ResultBean listBookCategory(){ public ResultBean listBookCategory(){
return ResultBean.ok(bookService.listBookCategory()); return ResultBean.ok(bookService.listBookCategory());
} }
@ -81,7 +78,7 @@ public class BookController extends BaseController{
/** /**
* 分页搜索 * 分页搜索
* */ * */
@PostMapping("searchByPage") @GetMapping("searchByPage")
public ResultBean searchByPage(BookSP bookSP, @RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize){ public ResultBean searchByPage(BookSP bookSP, @RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize){
PageInfo<BookVO> pageInfo = bookService.searchByPage(bookSP,page,pageSize); PageInfo<BookVO> pageInfo = bookService.searchByPage(bookSP,page,pageSize);
return ResultBean.ok(pageInfo); return ResultBean.ok(pageInfo);
@ -90,8 +87,8 @@ public class BookController extends BaseController{
/** /**
* 查询小说详情信息 * 查询小说详情信息
* */ * */
@PostMapping("queryBookDetail") @GetMapping("queryBookDetail/{id}")
public ResultBean queryBookDetail(Long id){ public ResultBean queryBookDetail(@PathVariable("id") Long id){
return ResultBean.ok(bookService.queryBookDetail(id)); return ResultBean.ok(bookService.queryBookDetail(id));
} }
@ -99,7 +96,7 @@ public class BookController extends BaseController{
/** /**
* 查询小说排行信息 * 查询小说排行信息
* */ * */
@PostMapping("listRank") @GetMapping("listRank")
public ResultBean listRank(@RequestParam(value = "type",defaultValue = "0") Byte type,@RequestParam(value = "limit",defaultValue = "30") Integer limit){ public ResultBean listRank(@RequestParam(value = "type",defaultValue = "0") Byte type,@RequestParam(value = "limit",defaultValue = "30") Integer limit){
return ResultBean.ok(bookService.listRank(type,limit)); return ResultBean.ok(bookService.listRank(type,limit));
} }
@ -120,7 +117,7 @@ public class BookController extends BaseController{
/** /**
* 查询章节相关信息 * 查询章节相关信息
* */ * */
@PostMapping("queryBookIndexAbout") @GetMapping("queryBookIndexAbout")
public ResultBean queryBookIndexAbout(Long bookId,Long lastBookIndexId) { public ResultBean queryBookIndexAbout(Long bookId,Long lastBookIndexId) {
Map<String,Object> data = new HashMap<>(2); Map<String,Object> data = new HashMap<>(2);
data.put("bookIndexCount",bookService.queryIndexCount(bookId)); data.put("bookIndexCount",bookService.queryIndexCount(bookId));
@ -135,7 +132,7 @@ public class BookController extends BaseController{
/** /**
* 根据分类id查询同类推荐书籍 * 根据分类id查询同类推荐书籍
* */ * */
@PostMapping("listRecBookByCatId") @GetMapping("listRecBookByCatId")
public ResultBean listRecBookByCatId(Integer catId) { public ResultBean listRecBookByCatId(Integer catId) {
return ResultBean.ok(bookService.listRecBookByCatId(catId)); return ResultBean.ok(bookService.listRecBookByCatId(catId));
} }
@ -144,7 +141,7 @@ public class BookController extends BaseController{
/** /**
*分页查询书籍评论列表 *分页查询书籍评论列表
* */ * */
@PostMapping("listCommentByPage") @GetMapping("listCommentByPage")
public ResultBean listCommentByPage(@RequestParam("bookId") Long bookId,@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize) { public ResultBean listCommentByPage(@RequestParam("bookId") Long bookId,@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize) {
return ResultBean.ok(new PageInfo<>(bookService.listCommentByPage(null,bookId,page,pageSize))); return ResultBean.ok(new PageInfo<>(bookService.listCommentByPage(null,bookId,page,pageSize)));
} }
@ -165,7 +162,7 @@ public class BookController extends BaseController{
/** /**
* 根据小说ID查询小说前十条最新更新目录集合 * 根据小说ID查询小说前十条最新更新目录集合
* */ * */
@PostMapping("queryNewIndexList") @GetMapping("queryNewIndexList")
public ResultBean queryNewIndexList(Long bookId){ public ResultBean queryNewIndexList(Long bookId){
return ResultBean.ok(bookService.queryIndexList(bookId,"index_num desc",1,10)); return ResultBean.ok(bookService.queryIndexList(bookId,"index_num desc",1,10));
} }
@ -173,7 +170,7 @@ public class BookController extends BaseController{
/** /**
* 目录页 * 目录页
* */ * */
@PostMapping("/queryIndexList") @GetMapping("/queryIndexList")
public ResultBean indexList(Long bookId,@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,@RequestParam(value = "orderBy") String orderBy) { public ResultBean indexList(Long bookId,@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,@RequestParam(value = "orderBy") String orderBy) {
return ResultBean.ok(new PageInfo<>(bookService.queryIndexList(bookId,orderBy,page,pageSize))); return ResultBean.ok(new PageInfo<>(bookService.queryIndexList(bookId,orderBy,page,pageSize)));
} }

View File

@ -4,6 +4,7 @@ import com.java2nb.novel.core.bean.ResultBean;
import com.java2nb.novel.service.FriendLinkService; import com.java2nb.novel.service.FriendLinkService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -22,7 +23,7 @@ public class FriendLinkController {
/** /**
* 查询首页友情链接 * 查询首页友情链接
* */ * */
@PostMapping("listIndexLink") @GetMapping("listIndexLink")
public ResultBean listIndexLink(){ public ResultBean listIndexLink(){
return ResultBean.ok(friendLinkService.listIndexLink()); return ResultBean.ok(friendLinkService.listIndexLink());
} }

View File

@ -5,10 +5,7 @@ import com.java2nb.novel.core.bean.ResultBean;
import com.java2nb.novel.service.NewsService; import com.java2nb.novel.service.NewsService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author 11797 * @author 11797
@ -24,7 +21,7 @@ public class NewsController {
/** /**
* 查询首页新闻 * 查询首页新闻
* */ * */
@PostMapping("listIndexNews") @GetMapping("listIndexNews")
public ResultBean listIndexNews(){ public ResultBean listIndexNews(){
return ResultBean.ok(newsService.listIndexNews()); return ResultBean.ok(newsService.listIndexNews());
} }
@ -32,7 +29,7 @@ public class NewsController {
/** /**
* 分页查询新闻列表 * 分页查询新闻列表
* */ * */
@PostMapping("listByPage") @GetMapping("listByPage")
public ResultBean listByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize){ public ResultBean listByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize){
return ResultBean.ok(new PageInfo<>(newsService.listByPage(page,pageSize))); return ResultBean.ok(new PageInfo<>(newsService.listByPage(page,pageSize)));
} }

View File

@ -15,10 +15,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
@ -115,7 +112,7 @@ public class UserController extends BaseController {
/** /**
* 查询小说是否已加入书架 * 查询小说是否已加入书架
*/ */
@PostMapping("queryIsInShelf") @GetMapping("queryIsInShelf")
public ResultBean queryIsInShelf(Long bookId, HttpServletRequest request) { public ResultBean queryIsInShelf(Long bookId, HttpServletRequest request) {
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {
@ -140,8 +137,8 @@ public class UserController extends BaseController {
/** /**
* 移出书架 * 移出书架
* */ * */
@PostMapping("removeFromBookShelf") @DeleteMapping("removeFromBookShelf/{bookId}")
public ResultBean removeFromBookShelf(Long bookId, HttpServletRequest request) { public ResultBean removeFromBookShelf(@PathVariable("bookId") Long bookId, HttpServletRequest request) {
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {
return ResultBean.fail(ResponseStatus.NO_LOGIN); return ResultBean.fail(ResponseStatus.NO_LOGIN);
@ -153,7 +150,7 @@ public class UserController extends BaseController {
/** /**
* 分页查询书架 * 分页查询书架
* */ * */
@PostMapping("listBookShelfByPage") @GetMapping("listBookShelfByPage")
public ResultBean listBookShelfByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) { public ResultBean listBookShelfByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) {
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {
@ -165,7 +162,7 @@ public class UserController extends BaseController {
/** /**
* 分页查询阅读记录 * 分页查询阅读记录
* */ * */
@PostMapping("listReadHistoryByPage") @GetMapping("listReadHistoryByPage")
public ResultBean listReadHistoryByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) { public ResultBean listReadHistoryByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) {
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {
@ -203,7 +200,7 @@ public class UserController extends BaseController {
/** /**
* 分页查询我的反馈列表 * 分页查询我的反馈列表
* */ * */
@PostMapping("listUserFeedBackByPage") @GetMapping("listUserFeedBackByPage")
public ResultBean listUserFeedBackByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize, HttpServletRequest request){ public ResultBean listUserFeedBackByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize, HttpServletRequest request){
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {
@ -215,7 +212,7 @@ public class UserController extends BaseController {
/** /**
* 查询个人信息 * 查询个人信息
* */ * */
@PostMapping("userInfo") @GetMapping("userInfo")
public ResultBean userInfo(HttpServletRequest request) { public ResultBean userInfo(HttpServletRequest request) {
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {
@ -263,7 +260,7 @@ public class UserController extends BaseController {
/** /**
* 分页查询用户书评 * 分页查询用户书评
* */ * */
@PostMapping("listCommentByPage") @GetMapping("listCommentByPage")
public ResultBean listCommentByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,HttpServletRequest request) { public ResultBean listCommentByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,HttpServletRequest request) {
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {

View File

@ -2,39 +2,13 @@ var SCYC = {
} }
$.extend($.fn.validatebox.defaults.rules, { $.extend($.fn.validatebox.defaults.rules, {
checkBookName: { checkPenName: {
validator: function (value, param) {
var url = "/aspx/book/booklist.aspx";
var data = { bid: param, bname: value, act: "getbooknamerepeat" };
var bool = false;
$.ajax({
type: "post",
dataType: 'html',
async: false,
url: url,
data: data,
cache: false,
success: function (result) {
if (result == "1") {
$.fn.validatebox.defaults.rules.checkBookName.message = '该书名已存在,请重新输入';
bool = false;
} else {
$.fn.validatebox.defaults.rules.checkBookName.message = '';
bool = true;
}
}
});
return bool;
message: '';
}
},
checkNiceName: {
validator: function (value, param) { validator: function (value, param) {
var url = "/author/checkPenName"; var url = "/author/checkPenName";
var data = { penName: value}; var data = { penName: value};
var bool = false; var bool = false;
$.ajax({ $.ajax({
type: "post", type: "get",
dataType: 'json', dataType: 'json',
async: false, async: false,
url: url, url: url,
@ -42,10 +16,10 @@ $.extend($.fn.validatebox.defaults.rules, {
cache: false, cache: false,
success: function (result) { success: function (result) {
if (result.data) { if (result.data) {
$.fn.validatebox.defaults.rules.checkNiceName.message = '笔名已存在,请重新输入'; $.fn.validatebox.defaults.rules.checkPenName.message = '笔名已存在,请重新输入';
bool = false; bool = false;
} else { } else {
$.fn.validatebox.defaults.rules.checkNiceName.message = ''; $.fn.validatebox.defaults.rules.checkPenName.message = '';
bool = true; bool = true;
} }
} }

View File

@ -56,7 +56,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/news/listByPage", url: "/news/listByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -118,7 +118,7 @@
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/author/listIncomeMonthByPage", url: "/author/listIncomeMonthByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -124,7 +124,7 @@
} }
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/author/listIncomeDailyByPage", url: "/author/listIncomeDailyByPage",
data: data, data: data,
dataType: "json", dataType: "json",

View File

@ -134,9 +134,9 @@
} }
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/author/queryIndexContent", url: "/author/queryIndexContent/"+indexId,
data: {'indexId':indexId}, data: {},
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (data.code == 200) { if (data.code == 200) {

View File

@ -144,7 +144,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/author/listBookByPage", url: "/author/listBookByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -144,7 +144,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/queryIndexList", url: "/book/queryIndexList",
data: {'bookId': bookId, 'curr': curr, 'limit': limit, 'orderBy': 'index_num desc'}, data: {'bookId': bookId, 'curr': curr, 'limit': limit, 'orderBy': 'index_num desc'},
dataType: "json", dataType: "json",
@ -299,9 +299,9 @@
layer.close(index); layer.close(index);
$.ajax({ $.ajax({
type: "POST", type: "delete",
url: "/author/deleteIndex", url: "/author/deleteIndex/"+indexId,
data: {'indexId': indexId}, data: {},
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (data.code == 200) { if (data.code == 200) {

View File

@ -60,7 +60,7 @@
作者笔名 作者笔名
</td> </td>
<td> <td>
<input name="penName" th:value="${author.penName}" type="text" maxlength="8" id="TxtNiceName" class="easyui-validatebox inpMain" data-options="required:true" validType="checkNiceName" /> <input name="penName" th:value="${author.penName}" type="text" maxlength="8" id="TxtNiceName" class="easyui-validatebox inpMain" data-options="required:true" validType="checkPenName" />
</td> </td>
<td> <td>

View File

@ -119,7 +119,7 @@
function searchComments(curr, limit) { function searchComments(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listCommentByPage", url: "/book/listCommentByPage",
data: {'bookId': $("#bookId").val(),'curr':curr,'limit':limit}, data: {'bookId': $("#bookId").val(),'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -234,7 +234,7 @@
} }
//查询是否在书架 //查询是否在书架
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/queryIsInShelf", url: "/user/queryIsInShelf",
data: {'bookId':$("#bookId").val()}, data: {'bookId':$("#bookId").val()},
dataType: "json", dataType: "json",

View File

@ -199,7 +199,7 @@
var lastBookIndexId = $("#lastBookIndexId").val(); var lastBookIndexId = $("#lastBookIndexId").val();
if(lastBookIndexId){ if(lastBookIndexId){
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/queryBookIndexAbout", url: "/book/queryBookIndexAbout",
data: {'bookId': bookId, 'lastBookIndexId': lastBookIndexId}, data: {'bookId': bookId, 'lastBookIndexId': lastBookIndexId},
dataType: "json", dataType: "json",
@ -226,7 +226,7 @@
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
//查询是否在书架 //查询是否在书架
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/queryIsInShelf", url: "/user/queryIsInShelf",
data: {'bookId': $("#bookId").val()}, data: {'bookId': $("#bookId").val()},
dataType: "json", dataType: "json",
@ -255,7 +255,7 @@
function loadCommentList(){ function loadCommentList(){
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listCommentByPage", url: "/book/listCommentByPage",
data: {'bookId': $("#bookId").val()}, data: {'bookId': $("#bookId").val()},
dataType: "json", dataType: "json",
@ -335,7 +335,7 @@
var bookCatId = $("#bookCatId").val(); var bookCatId = $("#bookCatId").val();
//查询同类推荐 //查询同类推荐
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listRecBookByCatId", url: "/book/listRecBookByCatId",
data: {'catId': bookCatId}, data: {'catId': bookCatId},
dataType: "json", dataType: "json",

View File

@ -88,7 +88,7 @@
function listRank(rankType){ function listRank(rankType){
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listRank", url: "/book/listRank",
data: {'type':rankType,'limit':30}, data: {'type':rankType,'limit':30},
dataType: "json", dataType: "json",

View File

@ -163,7 +163,7 @@
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/searchByPage", url: "/book/searchByPage",
data: searchData, data: searchData,
dataType: "json", dataType: "json",
@ -227,7 +227,7 @@
function listBookCategory(c) { function listBookCategory(c) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listBookCategory", url: "/book/listBookCategory",
data: {}, data: {},
dataType: "json", dataType: "json",

View File

@ -157,7 +157,7 @@
$(function () { $(function () {
//加载首页书籍设置数据 //加载首页书籍设置数据
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listBookSetting", url: "/book/listBookSetting",
data: {}, data: {},
dataType: "json", dataType: "json",
@ -331,7 +331,7 @@
}) })
//首页新闻查询 //首页新闻查询
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/news/listIndexNews", url: "/news/listIndexNews",
data: {}, data: {},
dataType: "json", dataType: "json",
@ -359,7 +359,7 @@
//点击榜单数据查询 //点击榜单数据查询
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listClickRank", url: "/book/listClickRank",
data: {}, data: {},
dataType: "json", dataType: "json",
@ -402,7 +402,7 @@
}) })
//新书榜单查询 //新书榜单查询
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listNewRank", url: "/book/listNewRank",
data: {}, data: {},
dataType: "json", dataType: "json",
@ -446,7 +446,7 @@
}) })
//更新榜单查询 //更新榜单查询
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listUpdateRank", url: "/book/listUpdateRank",
data: {}, data: {},
dataType: "json", dataType: "json",
@ -504,7 +504,7 @@
}) })
//友情链接查询 //友情链接查询
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/friendLink/listIndexLink", url: "/friendLink/listIndexLink",
data: {}, data: {},
dataType: "json", dataType: "json",

View File

@ -195,7 +195,7 @@
<script> <script>
//查询是否在书架 //查询是否在书架
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/queryIsInShelf", url: "/user/queryIsInShelf",
data: {'bookId': $("#bookIdHidden").val()}, data: {'bookId': $("#bookIdHidden").val()},
dataType: "json", dataType: "json",
@ -221,7 +221,7 @@
//查询最新目录集合 //查询最新目录集合
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/queryNewIndexList", url: "/book/queryNewIndexList",
data: {'bookId': $("#bookIdHidden").val()}, data: {'bookId': $("#bookIdHidden").val()},
dataType: "json", dataType: "json",

View File

@ -168,7 +168,7 @@
} }
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/searchByPage", url: "/book/searchByPage",
data: searchData, data: searchData,
dataType: "json", dataType: "json",

View File

@ -235,7 +235,7 @@
<script> <script>
//加载首页书籍设置数据 //加载首页书籍设置数据
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listBookSetting", url: "/book/listBookSetting",
data: {}, data: {},
dataType: "json", dataType: "json",
@ -318,7 +318,7 @@
//更新榜单查询 //更新榜单查询
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/book/listUpdateRank", url: "/book/listUpdateRank",
data: {}, data: {},
dataType: "json", dataType: "json",

View File

@ -86,7 +86,7 @@
//查询用户信息 //查询用户信息
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/userInfo", url: "/user/userInfo",
data: {}, data: {},
dataType: "json", dataType: "json",

View File

@ -52,7 +52,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/listCommentByPage", url: "/user/listCommentByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -80,7 +80,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/listBookShelfByPage", url: "/user/listBookShelfByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -59,7 +59,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/listUserFeedBackByPage", url: "/user/listUserFeedBackByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -67,7 +67,7 @@
function search(curr, limit) { function search(curr, limit) {
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/listReadHistoryByPage", url: "/user/listReadHistoryByPage",
data: {'curr':curr,'limit':limit}, data: {'curr':curr,'limit':limit},
dataType: "json", dataType: "json",

View File

@ -57,7 +57,7 @@
<script type="text/javascript"> <script type="text/javascript">
//查询用户信息 //查询用户信息
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/userInfo", url: "/user/userInfo",
data: {}, data: {},
dataType: "json", dataType: "json",

View File

@ -53,7 +53,7 @@
<script type="text/javascript"> <script type="text/javascript">
//查询用户信息 //查询用户信息
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/userInfo", url: "/user/userInfo",
data: {}, data: {},
dataType: "json", dataType: "json",

View File

@ -45,7 +45,7 @@
<script type="text/javascript"> <script type="text/javascript">
//查询用户信息 //查询用户信息
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/userInfo", url: "/user/userInfo",
data: {}, data: {},
dataType: "json", dataType: "json",

View File

@ -81,7 +81,7 @@
<script type="text/javascript"> <script type="text/javascript">
//查询用户信息 //查询用户信息
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/userInfo", url: "/user/userInfo",
data: {}, data: {},
dataType: "json", dataType: "json",
@ -113,7 +113,7 @@
}) })
//查询书架列表 //查询书架列表
$.ajax({ $.ajax({
type: "POST", type: "get",
url: "/user/listBookShelfByPage", url: "/user/listBookShelfByPage",
data: {'limit':2}, data: {'limit':2},
dataType: "json", dataType: "json",