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

@ -2,39 +2,13 @@ var SCYC = {
}
$.extend($.fn.validatebox.defaults.rules, {
checkBookName: {
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: {
checkPenName: {
validator: function (value, param) {
var url = "/author/checkPenName";
var data = { penName: value};
var bool = false;
$.ajax({
type: "post",
type: "get",
dataType: 'json',
async: false,
url: url,
@ -42,10 +16,10 @@ $.extend($.fn.validatebox.defaults.rules, {
cache: false,
success: function (result) {
if (result.data) {
$.fn.validatebox.defaults.rules.checkNiceName.message = '笔名已存在,请重新输入';
$.fn.validatebox.defaults.rules.checkPenName.message = '笔名已存在,请重新输入';
bool = false;
} else {
$.fn.validatebox.defaults.rules.checkNiceName.message = '';
$.fn.validatebox.defaults.rules.checkPenName.message = '';
bool = true;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@
作者笔名:
</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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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