一键快速查看资源网我的最新消息

tanzh 8月前 592


import win.ui;
/*DSG{{*/
var winform = win.form(text="Aardio资源网 我的消息";right=759;bottom=469;bgcolor=15780518)
winform.add(
buttonMyMessage={cls="button";text="我的消息";left=134;top=417;right=239;bottom=466;color=14120960;db=1;dl=1;font=LOGFONT(h=-14);note=" 点这里";z=1};
custom={cls="custom";text="自定义控件";left=9;top=10;right=749;bottom=409;db=1;dl=1;dr=1;dt=1;edge=1;z=2}
)
/*}}*/

import web.view
var wb = web.view(winform.custom);
topHtml = /**
<!doctype html><html>
<head><meta charset="utf-8">
<style type="text/css">
html,body{ height:100%; margin:0;font: 13px arial; } 
</style>
<script type="text/javascript"></script>
</head>
<body>
**/
endHtml = /**
</body></html>
**/

import console;
import web.json;
import inet.http;
http = inet.http();
var baseurl = "http://aardio.online";


/////////********这里是你自己的信息
//token从论坛个人中心生成
//https://aar.chengxu.online/my-token.htm
var MyToken = "";            //token不要泄露,因为算法是公开的
var Myname = "";                //网页的登录名,目前token功能较弱,所以需要输入用户名

///////

parasF = function(username, unixtime, mytoken) {
    if (!username) return '';
    import inet.url;
    
    //如果不提供time字符串,就使用系统当前时间戳
    if (!unixtime) unixtime = tostring(tonumber(time()))
    if (!mytoken) mytoken = MyToken;
    //加密方式  时间 + token + user + rand_str
    var rand_str = ..string.random(16);
    var str = unixtime++mytoken++username++rand_str;
    import crypt;
    var hash = crypt.md5(string.lower(str))
    //
    username = inet.url.encodeUri(username);
    if (hash) return '&user='++username++'&check_hash='++hash++"&check_time="++unixtime++"&rand_str="++rand_str;
}

requestData = function(p1 = 'gettime', p2 = '0', para = '') {
    var url = baseurl++"/index-api-"++p1++"-"++p2++".htm?" + parasF(Myname);    
    //console.log(url)
    var data = http.post(url)
    var json = web.json.tryParse(data);
    if (json)return json
    return data;
}

// 获取服务器时间
gettime = function() {
    return requestData();
}

//获取带版本号的帖子
getLibThread = function() {
    return requestData('getlibthread');
}

//获取帖子附件
getAttach = function(tid=0){
    return requestData('getattachinfo',tid);
}


//获取我的消息
getNotice = function() {
    return requestData('getnotice');
}


//我的消息
winform.buttonMyMessage.oncommand = function(id,event){
	var res = getNotice()
	var tab = {}
	for(k,v in res.data){ //去除下标排序
		table.push(tab,{message=v.message,
						from_username=v.from_username,
						create_date=tonumber(v.create_date),
						create_date_fmt=v.create_date_fmt})
	}
	//排序	
	table.sort(tab,function(b){
		return b.create_date < owner.create_date
	});
	//显示网页
	html = "<ol><b>查看 Aardio资源网 我的消息</b></ol>"
	for(k,v in tab){
		//console.log(k,v.create_date);
		html = html + "<ol>";
		mess = string.replace(v.message,'@href="thread','href="'+baseurl+'/thread');
		html = html + "<li>回复贴子:"+mess;
		html = html + "<li>回复人:"+v.from_username;
		html = html + "<li>回复时间:"+tostring(time(tonumber(v.create_date),"%Y-%m-%d %H:%M:%S"));
		html = html + "<li>距离天数:"+v.create_date_fmt;
		html = html + "</ol><hr>";
	}
	wb.html = topHtml + html + endHtml;
	
}


winform.show();
win.loopMessage();


学习大佬的接口,加上自己的 MyToken Myname 就可以用了,一键查看自己在资源网的最新消息

最新回复 (5)
  • 光庆 8月前
    0 2

     厉害

  • Viewer8122 8月前
    0 3
    谢谢分享。
  • lerh 8月前
    0 4
    厉害了
  • 小肥羊 8月前
    0 5
    可以的。
  • aardio 7月前
    0 6
    简约不简单哪..
返回