QQ群信息统计

接口一:

1:QQ群信息统计 地址:http://localhost:8080/webServices/messageSort  

注意:连接地址提交的是一个txt文件,返回是一个list的json字符串,解释json字符串网上例子很多,请自行解释。

2:接口实例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>知识网</title>
<script src="/uploadify/jquery_1_7_2_min.js" language="javascript" type="text/javascript"></script>
<script type="text/javascript" src="/uploadify/jquery.uploadify.min.js"></script>
<link type="text/css" href="/uploadify/uploadify.css" rel="stylesheet" />
<link id="artDialogSkin" href="/artDialog4.1.7/skins/red.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/artDialog4.1.7/artDialog.js"></script>
<script type="text/javascript" src="/uploadify/jquery.form.js"></script>
<script type="text/javascript">
	var myDialog;
//uploadify控件
	$(function() {
		$("#filePath").uploadify(
						{
							swf : '/uploadify/uploadify.swf',
							uploader : 'http://localhost:8080/webServices/messageSort',
							buttonText : '提交文件',
							fileSizeLimit : '20MB',
							height : 22,
							fileTypeDesc : '不超过20M的文件(*.txt)',
							fileTypeExts : '*.txt',
							multi : false,
							width : 90,
							onUploadError : function(file, errorCode, errorMsg,
									errorString) {
								art.dialog({
									icon : 'error',
									content : errorString
								});
							},
							onUploadStart : function(file) {
								$(".aui_content").css({
									"width" : "100%",
									"height" : "100%"
								});
								myDialog = art.dialog();// 初始化一个带有loading图标的空对话框
							},
							onUploadSuccess : function(file, data, response) {
								$(".aui_content").css({
									"width" : "400px",
									"height" : "500px",
									"overflow" : "auto"
								});
								var info = "<table width=\"100%\"><tr><td>群成员</td><td align=\"center\">QQ号</td><td align=\"center\">描述内容</td><td align=\"center\">信息条数</td></tr>";
								var dataObj = eval(data);//
								for ( var index in dataObj) {
									info += "<tr><td>" + dataObj[index].name
											+ "</td><td align=\"center\">"
											+ dataObj[index].qq
											+ "</td><td align=\"center\">"
											+ dataObj[index].mark
											+ "</td><td align=\"center\">"
											+ dataObj[index].count
											+ "</td><tr>";
								}
								info += "</table>";
								myDialog.content(info);// 填充对话框内容
							}
						});
	});
//jquery.from.js控件
	function upload2() {
		myDialog = art.dialog();// 初始化一个带有loading图标的空对话框
		var options = {
			url : "http://localhost:8080/webServices/messageSort",
			type : "POST",
			//dataType : "json",
			success : function(data) {
				var info = "<table width=\"100%\"><tr><td>群成员</td><td align=\"center\">QQ号</td><td align=\"center\">描述内容</td><td align=\"center\">信息条数</td></tr>";
				var dataObj=eval(data);//
				for ( var index in dataObj) {
					info += "<tr><td>" + dataObj[index].name
							+ "</td><td align=\"center\">" + dataObj[index].qq
							+ "</td><td align=\"center\">"
							+ dataObj[index].mark
							+ "</td><td align=\"center\">"
							+ dataObj[index].count + "</td><tr>";
				}
				info += "</table>";
				myDialog.content(info);// 填充对话框内容
			}
		};
		$("#proAdd").ajaxSubmit(options);
	}
</script>
</head>
<body>

	<div class="webcontent">
		接口一: <br />1:QQ群信息统计 地址:http://localhost:8080/webServiceTest/webServices/messageSort
		<br/>
		<br/>
		在线统计QQ群信息:
		<table>
			<tr>
				<td>文件提交方式1:uploadify控件</td>
				<td><input type="file" id="filePath" name="filePath" multiple="true" /></td>
			</tr>
			<tr>
				<td>文件提交方式2:jquery.from.js控件</td>
				<td>
				<form id="proAdd" name="proAdd" method="post" enctype="multipart/form-data">
				<input type="file" id="filePath" name="filePath" multiple="true" οnchange="upload2();"/>
				</form>
				</td>
			</tr>
		</table>
	</div>

</body>
</html>












已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页