为PHPCMSV9添加自定义URL规则
2011-09-28 01:09:02
在phpcms v9版本中,URL规则中只有目录和年约日期等几个自定义规则参数,如果想添加一个有利于SEO的规则,就跟着我一起操作吧。
API接口: task/list 获取登录用户的具体分类下的任务列表
本接口用于获取登录用户当前所有待处理任务的某分类下的任务列表
接口基本信息
- URL:
- 格式: xml,json
- HTTP请求方式: GET
- 是否需要鉴权:true
- 请求数限制:true
请求参数:
- format: json或xml,默认为json
- appName 任务所属app
- taskType 任务类别标识ID
- count 【数字,不能为0,不填则默认取10】每页显示数量,或理解为每次请求返回的任务信息数量
- page 【数字,从1开始,不填时则默认为1】需要返回的任务信息当前页数,与count配合使用,返回 countpage < index < pagecount + count的任务信息
(参数名为了可读性,使用了驼峰写法,使用时,请都改为小写)
- 使用说明:
http://sys.baidu.com/api/task/list?format=json&tasktype=AccessoryAdjust&count=15&page=1
此接口有如下几个任务的列表数据是特殊的,具体请向下翻阅查看:
- 【自动触发故障单】任务接口返回数据
- 【日常操作】任务接口返回数据
- 【机架状态变更 | 服务器快速自动化上线】任务接口返回数据
- 【故障处理】任务接口返回数据
- 【服务器操作】任务接口返回数据
接口常规返回数据[JSON]
{
"status": 1, // 请求返回状态标识
"page": 1, // 当前数据所在页数
"pages": 3, // 数据总页数
"total": 20, // 数据总数
"taskType": "AccessoryAdjust", // 任务类型标识ID
"data": [
{
"id": "38", // 任务ID
"creator": "张三", // 任务创建人
"department": "NS", // 所属部门
"createDate": "04\/11\/2011 15:15", //任务创建日期
"statusDescription": "RA 尚未审核", //任务状态描述
"additionalInfo": "", //任务附加信息
"handleUrl": "http://**********" //任务单的处理地址
},
......
],
"columns": [
{
"field": "id", //列关联的数据字段
"title": '单号' //列标题
},
{
"field": "department",
"title": "部门"
},
{
"field": "creator",
"title": "创建者"
},
{
"field": "createDate",
"title": "创建日期"
},
{
"field": "statusDescription",
"title": "当前状态"
},
{
"field": "additionalInfo",
"title": "附加信息"
}
]
}
【自动触发故障单】任务接口返回数据[JSON]
此数据是【自动触发故障单】的接口返回数据:
{
"status": 1, // 请求返回状态标识
"page": 1, // 当前数据所在页数
"pages": 3, // 数据总页数
"total": 20, // 数据总数
"taskType": "CactiServerFailure", // 任务类型标识ID
"data": [
{
"id": "18", // 任务ID
"department": "NS", // 所属部门
"product": "NS", // 产品线
"service": "NS", // 子分类
"taskNumber": 48, // 故障单数
"handleUrl": "http://**********" //任务单的处理地址
},
......
],
"columns": [
{
"field": "id", //列关联的数据字段
"title": '单号' //列标题
},
{
"field": "department",
"title": "部门"
},
{
"field": "product",
"title": "产品线"
},
{
"field": "service",
"title": "子分类"
},
{
"field": "taskNumber",
"title": "单子数量"
}
]
}
【日常操作】任务接口返回数据[JSON]
此数据是【日常操作】的接口返回数据:
{
"status": 1, // 请求返回状态标识
"page": 1, // 当前数据所在页数
"pages": 3, // 数据总页数
"total": 20, // 数据总数
"taskType": "AccessoryAdjust", // 任务类型标识ID
"data": [
{
"id": "38", // 任务ID
"creator": "张三", // 任务创建人
"department": "NS", // 所属部门
"createDate": "04\/11\/2011 15:15", //任务创建日期
"statusDescription": "RA 尚未审核", //任务状态描述,
"operationType": 备份设备及备份介质的处理", //操作类型
"additionalInfo": "", //任务附加信息
"handleUrl": "http://**********" //任务单的处理地址
},
......
],
"columns": [
{
"field": "id", //列关联的数据字段
"title": '单号' //列标题
},
{
"field": "department",
"title": "部门"
},
{
"field": "creator",
"title": "创建者"
},
{
"field": "createDate",
"title": "创建日期"
},
{
"field": "statusDescription",
"title": "当前状态"
},
{
"field": "operationType",
"title": "操作类型"
},
{
"field": "additionalInfo",
"title": "附加信息"
}
]
}
【机架状态变更 | 服务器快速自动化上线】任务接口返回数据[JSON]
此数据是【机架状态变更 | 服务器快速自动化上线】的接口返回数据:
{
"status": 1, // 请求返回状态标识
"page": 1, // 当前数据所在页数
"pages": 3, // 数据总页数
"total": 20, // 数据总数
"taskType": "AccessoryAdjust", // 任务类型标识ID
"data": [
{
"id": "38", // 任务ID
"creator": "张三", // 任务创建人
"department": "NS", // 所属部门
"createDate": "04\/11\/2011 15:15", //任务创建日期
"statusDescription": "RA 尚未审核", //任务状态描述,
"idc": "TC", //操作类型
"additionalInfo": "", //任务附加信息
"handleUrl": "http://**********" //任务单的处理地址
},
......
],
"columns": [
{
"field": "id", //列关联的数据字段
"title": '单号' //列标题
},
{
"field": "department",
"title": "部门"
},
{
"field": "creator",
"title": "创建者"
},
{
"field": "createDate",
"title": "创建日期"
},
{
"field": "statusDescription",
"title": "当前状态"
},
{
"field": "idc",
"title": "机房"
},
{
"field": "additionalInfo",
"title": "附加信息"
}
]
}
【故障处理】任务接口返回数据[JSON]
此数据是【故障处理】的接口返回数据:
{
"status": 1, // 请求返回状态标识
"page": 1, // 当前数据所在页数
"pages": 3, // 数据总页数
"total": 20, // 数据总数
"taskType": "AccessoryAdjust", // 任务类型标识ID
"data": [
{
"id": "38", // 任务ID
"creator": "张三", // 任务创建人
"department": "NS", // 所属部门
"createDate": "04\/11\/2011 15:15", //任务创建日期
"statusDescription": "RA 尚未审核", //任务状态描述,
"overTime": "20天10小时20分", //超时时间
"outSource": "", //关联外包单
"additionalInfo": "", //任务附加信息
"handleUrl": "http://**********" //任务单的处理地址
},
......
],
"columns": [
{
"field": "id", //列关联的数据字段
"title": '单号' //列标题
},
{
"field": "department",
"title": "部门"
},
{
"field": "creator",
"title": "创建者"
},
{
"field": "createDate",
"title": "创建日期"
},
{
"field": "statusDescription",
"title": "当前状态"
},
{
"field": "overTime",
"title": "超时时间"
},
{
"field": "outSource",
"title": "关联外包单"
},
{
"field": "additionalInfo",
"title": "附加信息"
}
]
}
【服务器操作】任务接口返回数据[JSON]
此数据是【服务器操作】的接口返回数据:
window.addEvent("domready",
function() {
$$(".GoodsSearchWrap .buy-select").each(function(a) {
new QMenu(a, $E(".buy-select-list", a))
})
});
window.addEvent("domready",
function() {
var d = new Cookie("S[GFAV]", {
duration: 365
});
var b = {
"star-on": "off",
"star-off": "on",
off: "Del",
on: "Add",
off_: "erase",
on_: "include"
};
var a = function(g, h, f) {
if (h == "on") {
g.className = "star-on";
var e = g.children[0];
while (e.nodeType != 3) {
e = e.firstChild
}
e.nodeValue = "已加入收藏"
} else {
g.className = "star-off";
var e = g.children[0];
while (e.nodeType != 3) {
e = e.firstChild
}
e.nodeValue = "收藏此商品"
}
if (!f) {
return
}
d.write($splat((d.read("S[GFAV]") || "").split(","))[b[h + "_"]](f).clean().join(","));
new Request().post("index.php?member-" + f + "-ajax" + b[h] + "Fav.html", $H({
t: $time()
}))
};
var c = $splat((d.read("S[GFAV]") || "").split(","));
$$("li[star]").each(function(f) {
var e = f.get("star");
if (c.contains(e)) {
a(f, "on")
}
f.addEvent("click",
function(g) {
g.stop();
a(f, b[f.className], e)
})
})
});
window.addEvent("domready",
function() {
var e = $("goods-compare") || new Element("div").set("html", ["<div class='FormWrap goods-compare' id='goods-compare' style='display:none'>", "<div class='title'><h3>商品对比<span class='close-gc' onclick='gcompare.hide()'>[关闭]</span></h3></div>", "<form action='" + Shop.url.diff + "' method='post' target='_compare_goods'>", "<input type='hidden' name='t' value=" + $time() + ">", "<ul class='compare-box'>", "<li class='division clearfix tpl'>", "<div class='span-3'>", "<a href='#' gid='{gid}' title='{gname}'>{gname}</a>", "</div>", "<span class='floatRight lnk' onclick='gcompare.erase(\"{gid}\",this);'>删除</span>", "</li>", "</ul>", "<div class='compare-bar'>", "<input type='button' name='comareing' onclick='gcompare.submit()' class='btn-compare' value='对比'>", "<input type='button' class='btn-compare' onclick='gcompare.empty()' value='清空'>", "</div>", "</form>", "</div>"].join("\n")).getFirst().inject(document.body);
var d = e.getElement(".compare-box");
var b = e.getElement(".compare-box .tpl").get("html");
var f = "division clearfix";
var c = function() {
if (e.style.display == "none") {
return
}
e.setStyle("top", window.getScrollTop())
};
window.addEvents({
resize: c,
scroll: c
});
var a = new Cookie("S[GCOMPARE]");
gcompare = {
init: function() {
var g = $splat((a.read("S[GCOMPARE]") || "").split("|")).erase("").clean();
if (g.length) {
g.each(function(h) {
this.add(JSON.decode(h), true)
}.bind(this))
}
},
hide: function() {
e.hide()
},
show: function() {
e.show();
c()
},
add: function(g, k) {
this.show();
if (!k) {
var j = $splat((a.read("S[GCOMPARE]") || "").split("|")).erase("").clean();
if (j.length && j.some(function(l) {
return (JSON.decode(l)["gtype"] + "_") != (g.gtype + "_")
})) {
return MessageBox.error("只能对比同类的商品.")
}
if (j.length > 4) {
return MessageBox.error("最多只能对比5个商品.")
}
a.write(j.include(JSON.encode(g)).join("|"))
}
if (d.getElement('a[gid="' + g.gid + '"]')) {
return
}
var h = new Element("li", {
"class": f
}).set("html", b.substitute(g));
var i = h.getElement("a");
i.set("href", "?product-" + g.gid + ".html");
d.adopt(h)
},
erase: function(h, g) {
var j = $splat((a.read("S[GCOMPARE]") || "").split("|")).erase("").clean();
var i;
j.each(function(m, k) {
if (h == JSON.decode(m)["gid"]) {
i = k
}
});
j.splice(i, 1);
a.write(j.join("|"));
$(g).getParent("li").remove()
},
empty: function() {
a.dispose();
d.getElements("li").each(function(g) {
if (!g.hasClass("tpl")) {
return g.remove()
}
})
},
submit: function() {
if (Browser.Engine.webkit) {
d.getParent("form").action = Shop.url.diff
}
d.getParent("form").submit()
}
};
gcompare.init()
});
blog comments powered by Disqus
