|
0测试积点
本帖最后由 jiangcgenc 于 2010-11-8 15:39 编辑
<html><head><TITLE>edb test</TITLE>
<META name=GENERATOR content="MSHTML 8.00.6001.18702">
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<script src=".\js\jquery-1.3.2.js"></script>
<script src=".\js\json.js"></script>
<script type="text/javascript" language="javascript">
/* URL参数*/
var svrtype ="/edb/orders";
var sig= "sig=asdfsdfsdf";
var tsp = "timestamp="+now();
var Okey = "key=123_123";
var Qkey = "key=1_1";
/* 公用函数*/
function myCallBack(data){
$("#resultDisp").empty().html(data); }
function appendCallBack(data){
$("#resultDisp").append("<br/><br/>返回: "+data); }
function errCallback(xmlRequest, errMsg, except){
alert(xmlRequest.statusText); }
function post(_url, param, callback){
$.ajax({
type:"OST",
url:_url,
dataType:"html",
contentType:"multipart/form-data",
data:JSON.stringify(param),
success:callback,
error:errCallback,
async:false});
};
function get(_url, callback){
//$.get(_url,callback);
$.ajax({
type:"GET",
url:_url,
dataType:"html",
contentType:"multipart/form-data",
success:callback,
error:errCallback,
async:false});
}
function put(_url, param,callback){
$.ajax({
type:"UT",
url:_url,
dataType:"html",
contentType:"multipart/form-data",
data:JSON.stringify(param),
success:callback,
error:errCallback,
beforeSend: function(XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("X-HTTP-Method-Override", "UT");
},
async:false});
}
function del(_url, callback){
$.ajax({
type:"DELETE",
url:_url,
dataType:"html",
contentType:"multipart/form-data",
success:callback,
error:errCallback,
beforeSend: function(XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("X-HTTP-Method-Override", "DELETE");
},
async:false});
}
function now(){
var theDate = new Date();
return theDate.getTime();
}
function getTS(){
var theDate = new Date();
$("#queryDisp").html(theDate+" -- timestamp:"+ theDate.getTime());
}
/* 按钮函数*/
//$.extend({
function creatOrder(){
var theOrder = {
acceptor("#Oacceptor").attr("value"),
appId:parseInt($("#OappId").attr("value")),
bookTel("#ObookTel").attr("value"),
bookTime("#ObookTime").attr("value"),
bookType:parseInt($("#ObookType").attr("value")),
booker("#Obooker").attr("value"),
cartId("#OcartId").attr("value"),
content("#Ocontent").attr("value"),
deliverFee:parseFloat($("#OdeliverFee").attr("value")),
deliverId("#OdeliverId").attr("value"),
deliverType:parseInt($("#OdeliverType").attr("value")),
entId("#OentId").attr("value"),
fee:parseFloat($("#Ofee").attr("value")),
linkMan("#OlinkMan").attr("value"),
linkTel("#OlinkTel").attr("value"),
memoToPartner:$("#OmemoToPartner").attr("value"),
offeringId:$("#OofferingId").attr("value"),
offeringInfo:$("#OofferingInfo").attr("value"),
offeringNum:parseInt($("#OofferingNum").attr("value")),
orderId:$("#OorderId").attr("value"),
//orderId:"E"+now(),
orderMemo:$("#OorderMemo").attr("value"),
orderType:parseInt($("#OorderType").attr("value")),
//orderType:$("#OorderType").attr("value"),
oriStatus:parseInt($("#OoriStatus").attr("value")),
partnerId:$("#OpartnerId").attr("value"),
partnerName:$("#OpartnerName").attr("value"),
payId:$("#OpayId").attr("value"),
payStatus:parseInt($("#OpayStatus").attr("value")),
payTime:$("#OpayTime").attr("value"),
payType:parseInt($("#OpayType").attr("value")),
personId:$("#OpersonId").attr("value"),
purchaser:$("#Opurchaser").attr("value"),
receiverAddr:$("#OreceiverAddr").attr("value"),
receiverName:$("#OreceiverName").attr("value"),
receiverTel:$("#OreceiverTel").attr("value"),
status:parseInt($("#Ostatus").attr("value")),
sysId:parseInt($("#OsysId").attr("value")),
updateTime:$("#OupdateTime").attr("value")
};
for (var item in theOrder){
if ( theOrder[item] == null || theOrder[item].length == 0) {
delete theOrder[item];
} }
return theOrder;
}
$(function(){
/*新增订单*/
$("#orderAdd").click(function(){
post(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey,creatOrder(),myCallBack);
$("#queryDisp").html("the data being POST is : "+"<br/>"+JSON.stringify(creatOrder()));
});
/*修改订单*/
$("#orderUpdate").click(function(){
theOrder = creatOrder();
put(svrIPp+svrtype+"/"+theOrder.orderId+"?"+sig+"&"+tsp+"&"+Qkey,theOrder,myCallBack)
$("#queryDisp").html("the data being PUT is : "+"<br/>"+JSON.stringify(theOrder));
});
/*删除订单*/
$("#orderDelete").click(function(){
theOrder = creatOrder()
del(svrIPp+svrtype+"/"+theOrder.orderId+"?app_id="+theOrder.appId+"&sys_id="+theOrder.sysId+"&"+sig+"&"+tsp+"&"+Qkey,myCallBack)
$("#queryDisp").html("the data being DELETE is : "+"<br/>"+JSON.stringify(theOrder));
});
/*清空订单*/
$("#bt_emptyall").click(function(){
var form = testOrder;
for (var i=0;i<form.length;i++){
if (form.type == "text") {
form.value= "";}
}
});
/*查询订单*/
$("#bt_orderQuery1").click(function(){
QorderId = $("#OQorderId").attr("value");
Qapp_id = $("#OQappId")[0].value;
Qsys_id = $("#OQsysId").attr("value");
get(encodeURI(svrIPp+"/edb/orders/"+QorderId+"?"+"app_id="+Qapp_id+"&sys_id="+Qsys_id+"&"+sig+"&"+tsp+"&"+Qkey),myCallBack);
$("#queryDisp").html(svrIPp+"/edb/orders/"+QorderId+"?"+"app_id="+Qapp_id+"&sys_id="+Qsys_id+"&"+sig+"&"+tsp+"&"+Qkey);
});
$("#bt_startIndex").click(function(){
QorderId = $("#OQorderId").attr("value");
Qapp_id = $("#OQappId")[0].value;
Qsys_id = $("#OQsysId").attr("value");
QstartIndex = $("#OQstartIndex").attr("value");
get(encodeURI(svrIPp+"/edb/orders/"+QorderId+"?"+"app_id="+Qapp_id+"&sys_id="+Qsys_id+"&"+sig+"&"+tsp+"&"+Qkey+"&"+"startIndex="+QstartIndex+"&sortBy=orderId&sortOrder=1&count=15"),myCallBack);
$("#queryDisp").html(svrIPp+"/edb/orders/"+QorderId+"?"+"app_id="+Qapp_id+"&sys_id="+Qsys_id+"&"+sig+"&"+tsp+"&"+Qkey+"&"+"startIndex="+QstartIndex+"&sortBy=orderId&sortOrder=1count=15");
});
$("#bt_QpersonId").click(function(){
QpersonId = $("#OQpersonId").attr("value");
filter = "filter=[{'filterBy':'personId','filterOp':'equals','filterRel':0,'filterVal':'";
get(encodeURI(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QpersonId+"'}]"),myCallBack);
$("#queryDisp").html(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QpersonId+"'}]");
});
$("#bt_QentId").click(function(){
QentId = $("#OQentId").attr("value");
filter = "filter=[{'filterBy':'entId','filterOp':'equals','filterRel':0,'filterVal':'";
get(encodeURI(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QentId+"'}]"),myCallBack);
$("#queryDisp").html(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QentId+"'}]");
});
$("#bt_QpartnerId").click(function(){
QpartnerId = $("#OQpartnerId").attr("value");
filter = "filter=[{'filterBy':'partnerId','filterOp':'equals','filterRel':0,'filterVal':'";
get(encodeURI(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QpartnerId+"'}]"),myCallBack);
$("#queryDisp").html(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QpartnerId+"'}]");
});
$("#bt_Qcontent").click(function(){
Qcontent = $("#OQcontent").attr("value");
filter = "filter=[{'filterBy':'content','filterOp':'contains','filterRel':0,'filterVal':'";
// filter = "filter=[{'filterBy':'content','filterOp':'equals','filterRel':0,'filterVal':'";
get(encodeURI(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+Qcontent+"'}]"),myCallBack);
$("#queryDisp").html(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+Qcontent+"'}]");
});
$("#bt_QbookTime").click(function(){
QbookTime = $("#OQbookTime").attr("value");
QstartDate = $("#OQstartDate").attr("value");
QendDate = $("#OQendDate").attr("value");
filter1 = "filter=[{'filterOp':'noless','filterRel':0,'filterBy':'bookTime','filterVal':";
filter2 = "},{'filterOp':'nogreater','filterRel':1,'filterBy':'bookTime','filterVal':";
sortOpt = "sortBy=bookTime&count=12&startIndex=0";
get(encodeURI(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter1+"'"+QstartDate+"'"+filter2+"'"+QendDate+"'}]"),myCallBack);
$("#queryDisp").html(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter1+"'"+QstartDate+"'"+filter2+"'"+QendDate+"'}]")
});
$("#bt_QbookTel").click(function(){
QbookTel = $("#OQbookTel").attr("value");
filter = "filter=[{'filterBy':'bookTel','filterOp':'equals','filterRel':0,'filterVal':'";
get(encodeURI(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QbookTel+"'}]"),myCallBack);
$("#queryDisp").html(svrIPp+svrtype+"?"+sig+"&"+tsp+"&"+Qkey+"&"+filter+QbookTel+"'}]")
});
/*模糊查询*/
$("#bt_QString").click(function(){
QString = $("#OQString").attr("value");
//filter = "filter=[{'filterBy':'bookTel','filterOp':'equals','filterRel':0,'filterVal':'";
get(encodeURI(svrIPp+svrtype+"?"+"queryString="+QString+"&"+sig+"&"+tsp+"&"+Qkey),myCallBack);
// $("#resultDisp").html(svrIPp+svrtype+"?"+"queryString="+QString+"&"+sig+"&"+tsp+"&"+Qkey);
});
/* url + data 形式*/
$("#bt_post").click(function(){
theURL=$("#in_posturl").attr("value");
theData= $("#in_postdata").attr("value");
post(theURL,theData,myCallBack);
});
$("#bt_put").click(function(){
theURL=$("#in_posturl").attr("value");
theData= $("#in_postdata").attr("value");
put(theURL,theData,myCallBack);
});
$("#bt_del").click(function(){
theURL=$("#in_posturl").attr("value");
del(theURL,myCallBack);
});
$("#bt_get").click(function(){
theURL=$("#in_posturl").attr("value");
get(theURL,myCallBack);
});
$("#bt_orderDisp").click(function(){
$("#queryDisp").html("the data being post is : "+"<br/>"+JSON.stringify(creatOrder()));
});
});
</script>
<body>
<h3 style="text-align: center;" >数据中心测试 </h3>
<h4 style="text-align: left;" >query: </h4>
<span id="queryDisp"></span><br />
<h4 style="text-align: left;" >Results: </h4>
<span id="resultDisp"></span>
<hr color="#FF9900"> </hr>
<!-- <h5> 订单 </h5> <h4 style="text-align: right;"> Tests </h4> -->
<br />订单查询:<br/>
orderId:<input id="OQorderId" value="" />
app_id:<input id="OQappId" value="3" />
sys_id:<input id="OQsysId" value="21" />
<input type=button id="bt_orderQuery1" value="按此3条件查询"/><br/>
startIndex:<input id="OQstartIndex" value="11" />
<input type=button id="bt_startIndex" value="从第N条显示"/><br/>
<br />
1 <input id="OQpersonId" value="123" /><button id = "bt_QpersonId">按personId查</button><br />
2 <input id="OQentId" value="null" /><button id = "bt_QentId">按entId查</button><br />
3 <input id="OQpartnerId" value="0" /><button id = "bt_QpartnerId">按partnerId查</button><br />
4 <input id="OQcontent" value="基本信息:票数=2" /><button id = "bt_Qcontent">按content查</button><br />
5 开始时间<input id="OQstartDate" value="2010-06-8 21:18:36" /> 截止时间<input id="OQendDate" value="2010-06-11 21:18:36" /><button id = "bt_QbookTime">按bookTime查</button><br />
6 <input id="OQbookTel" value="13360099308" /><button id = "bt_QbookTel">按bookTel查询</button><br />
<!--
7 <input id="OQString" value="深圳" /><button id = "bt_QString">模糊查询(content)</button><br />
-->
<br />
<input type=button id="orderAdd" value="新增订单"/>
<input type=button id="orderUpdate" value="修改订单"/>
<input type=button id="orderDelete" value="删除订单"/>
<input type=button id="bt_emptyall" value="清空订单"/>
<input type=button id="bt_orderDisp" value="显示订单"/>
<br />
<td><form id="orderForm" name= "testOrder" >订单内容:
<br/>orderId<input id="OorderId" value="F20100706_0001"/>
<br/>sysId<input id="OsysId" value="21"/>
<br/>appId<input id="OappId" value="21"/>
<br/>orderMemo<input id="OorderMemo" value=""/>
<br/>orderType<input id="OorderType" value="1"/> ( =1时,entId不能为空,=0时,personId不能空)
<br/>entId<input id="OentId" value="11"/>
<br/> ------
<br/>personId<input id="OpersonId" value="123"/>(字符串)
<br/>status<input id="Ostatus" value="900200"/>(要求:100100-900900)
<br/>bookType<input id="ObookType" value="2" /> (要求 1-4)
<br/>bookTel<input id="ObookTel" value="13316090000"/> (不能为空)
<br/>linkMan<input id="OlinkMan" value="李"/> (不能为空)
<br/>linkTel<input id="OlinkTel" value="13316090000"/> (不能为空)
<br/>acceptor:<input id="Oacceptor" value=""/>
<br/> ------
<br/>bookTime<input id="ObookTime" value="2010-06-16 11:18:36"/>
<br/>booker<input id="Obooker" value="李"/>
<br/> ------
<br/>cartId<input id="OcartId" value=""/>
<br/>content<input id="Ocontent" value="基本信息:房间数量=11,消费金额=450,酒店名称=广州花园,联系人姓名=姚明,联系人电话=38639560"/>
<br/>deliverFee<input id="OdeliverFee" value="0.0"/>
<br/>deliverId<input id="OdeliverId" value=""/>
<br/>deliverType<input id="OdeliverType" value="0"/>
<br/>fee<input id="Ofee" value="450.0"/>
<br/>memoToPartner<input id="OmemoToPartner" value=""/>
<br/> ------
<br/>offeringId<input id="OofferingId" value="0"/>
<br/>offeringInfo<input id="OofferingInfo" value=""/>
<br/>offeringNum<input id="OofferingNum" value="1"/>
<br/>oriStatus<input id="OoriStatus" value="9"/>
<br/>partnerId<input id="OpartnerId" value="0"/>
<br/>partnerName<input id="OpartnerName" value="广州鸣泉居度假村"/>
<br/> ------
<br/>payId<input id="OpayId" value=""/>
<br/>payStatus<input id="OpayStatus" value="0"/>
<br/>payTime<input id="OpayTime" value="2010-07-06 11:28:32"/>
<br/>payType<input id="OpayType" value="0"/>
<br/>purchaser<input id="Opurchaser" value=""/>
<br/>receiverAddr<input id="OreceiverAddr" value="中山大道西109"/>
<br/>receiverName<input id="OreceiverName" value="收货人"/>
<br/>receiverTel<input id="OreceiverTel" value=""/>
<br/> ------
<br/>unitId<input id="OunitId" value=""/>
<br/>updateTime<input id="OupdateTime" value=""/>
</form></td>
<br />
<h5> 会员 (todo)</h5>
<hr color="#0099FF"> </hr> <h5 style="text-align: right;" > Advance </h5>
Server url: <input id="serverIPp" value="http://192.168.36.52:8083" /><br /><br />
<!-- 体验环境http://121.32.89.4:52083 功能环境 http://192.168.36.214:8083 -->
post url :<input type=text id="in_posturl" size="50" />
<input type=button id="bt_post" value="OST"/>
<input type=button id="bt_put" value="UT"/>
<input type=button id="bt_del" value="DELETE"/>
<input type=button id="bt_get" value="GET"/>
<br />post data :<input type=text id="in_postdata" size="100" />
<!-- http://10.17.38.208:8080 -->
<br/><button onclick =debug() > debug </button>
<button onclick =getTS() > TimeStamp </button>
</body></html>
这段代码执行出来时一个数据中心接口的功能方面测试 但是一些功能键不能使用 求解。请问代码有错吗 每次点击界面上的功能键都提示内部服务器错误,或者没有反应 |
|