mirror of
https://github.com/201206030/novel-plus.git
synced 2025-06-24 12:46:38 +00:00
restful api改造
This commit is contained in:
@ -9,10 +9,7 @@ import com.java2nb.novel.service.CrawlService;
|
||||
import com.java2nb.novel.vo.CrawlSingleTaskVO;
|
||||
import com.java2nb.novel.vo.CrawlSourceVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @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){
|
||||
|
||||
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){
|
||||
|
||||
return ResultBean.ok(new PageInfo<>(BeanUtil.copyList(crawlService.listCrawlSingleTaskByPage(page,pageSize), CrawlSingleTaskVO.class)
|
||||
@ -81,8 +78,8 @@ public class CrawlController {
|
||||
/**
|
||||
* 删除采集任务
|
||||
* */
|
||||
@PostMapping("delCrawlSingleTask")
|
||||
public ResultBean delCrawlSingleTask(Long id){
|
||||
@DeleteMapping("delCrawlSingleTask/{id}")
|
||||
public ResultBean delCrawlSingleTask(@PathVariable("id") Long id){
|
||||
|
||||
crawlService.delCrawlSingleTask(id);
|
||||
|
||||
|
@ -96,7 +96,7 @@
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
type: "get",
|
||||
url: "/crawl/listCrawlByPage",
|
||||
data: {'curr':1,'limit':100},
|
||||
dataType: "json",
|
||||
|
@ -125,7 +125,7 @@
|
||||
function search(curr, limit) {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
type: "get",
|
||||
url: "/crawl/listCrawlSingleTaskByPage",
|
||||
data: {'curr': curr, 'limit': limit},
|
||||
dataType: "json",
|
||||
@ -205,9 +205,9 @@
|
||||
function del(id) {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/crawl/delCrawlSingleTask",
|
||||
data: {'id': id},
|
||||
type: "delete",
|
||||
url: "/crawl/delCrawlSingleTask/"+id,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
|
@ -122,7 +122,7 @@
|
||||
function search(curr, limit) {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
type: "get",
|
||||
url: "/crawl/listCrawlByPage",
|
||||
data: {'curr':curr,'limit':limit},
|
||||
dataType: "json",
|
||||
|
Reference in New Issue
Block a user