aardio群 625494397
废话不多说 直接开干!
import web.json;
import console;
import inet.whttp;
web.json.parse( json );//转化json格式
h.addHeaders = {
'Accept-Encoding' = 'gzip, deflate, br';
'Accept-Language' = 'zh-CN,zh;q=0.9';
'User-Agent' = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36'
} //头部添加参数
上代码
//音量调节
import fonts.fontAwesome;
import win.ui;
import inet.whttp;
import console;
//多线程管理器
import thread.manage
import mysql.client;
//var http = inet.whttp("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.221 Safari/537.36 SE 2.X MetaSr 1.0");
var times
times = 5000
/*DSG{{*/
var winform = win.form(text="待审核服务单 音频";right=711;bottom=199;border="dialog frame";max=false)
winform.add(
btnVolumeDown={cls="button";text='\uF028 减少音量';left=288;top=128;right=430;bottom=160;font=LOGFONT(name='FontAwesome');z=5};
btnVolumeUp={cls="button";text='\uF028 增加音量';left=112;top=128;right=254;bottom=160;font=LOGFONT(name='FontAwesome');z=4};
button={cls="button";text='\uF028 播放mp3';left=472;top=128;right=614;bottom=160;font=LOGFONT(name='FontAwesome');z=6};
lbWmplayer={cls="static";left=16;top=16;right=683;bottom=60;dl=1;dr=1;dt=1;notify=1;z=1};
static2={cls="static";text="拖动右侧滑块调整系统音量:";left=8;top=80;right=216;bottom=104;align="right";db=1;dl=1;transparent=1;z=3};
trackbar={cls="trackbar";left=224;top=72;right=680;bottom=102;db=1;dl=1;dr=1;max=100;min=0;z=2}
)
/*}}*/
//创建播放器控件
var wmp = winform.lbWmplayer.createEmbed( "WMPlayer.OCX" )._object;
wmp.url ='';
//wmp.url = "http://rwlpwfyau.hn-bkt.clouddn.com/%E6%96%B0%E8%AE%A2%E5%8D%95%E6%8F%90%E9%86%92.mp3";
var csv="关键词,数量,第一评论,第二评论,第三评论"+'\r\n'
//创建线程管理器
manage = thread.manage(3)
//console.log("正在连接数据库服务器...");
thread.invoke( function()
while(! thread.get("db4free.net:end")){
io.stdout.write(">");sleep(100);
}
)
var dbMysql,err = mysql.client(
server = "127.0.0.1"; //数据库服务器,可省略默认为localhost
uid = "order";//用户名,可省略默认为root
pwd = "wd4PWpK7yDP4Jc5K";
);
thread.set("db4free.net:end",true)
//console.clearScreen ();
if(!dbMysql){
console.log("连接数据库失败",err);
console.pause();
return;
}
//选择数据库
dbMysql.selectDb("order")
var result = dbMysql.query("SELECT cookie FROM `ap_cookie_shop` where id=1 ");
cookie = ''
for level1 in result.each(){
cookie = level1
}
//console.log(cookie)
import sys.audioVolume;
var volumeCtrl = sys.audioVolume();
winform.trackbar.setRange(0,100);
winform.trackbar.pos = volumeCtrl.volume;
//使用volumeCtrl.volume可以更方便的直接调整音量
winform.trackbar.oncommand = function(id,event,pos){
if( event == 8/*_SB_ENDSCROLL*/ ){
volumeCtrl.volume = winform.trackbar.pos;
volumeCtrl.mute = false;
}
elseif( event == 5/*_SB_THUMBTRACK*/) {
volumeCtrl.volume = pos;
volumeCtrl.mute = false;
}
}
//下面提供另外一种调整音量的方法
_APPCOMMAND_VOLUME_UP = 10
_APPCOMMAND_VOLUME_DOWN = 9
_APPCOMMAND_VOLUME_MUTE = 8
winform.btnVolumeUp.oncommand = function(id,event){
::User32.SendMessage(winform.hwnd,0x319/*_WM_APPCOMMAND*/,0x30292, _APPCOMMAND_VOLUME_UP * 0x10000);
}
winform.btnVolumeDown.oncommand = function(id,event){
::User32.SendMessage(winform.hwnd,0x319/*_WM_APPCOMMAND*/,0x30292, _APPCOMMAND_VOLUME_DOWN * 0x10000);
}
getLen= function(str){
return string.len(str);
}
//同步系统音量(一般没有这个必要)
//同步系统音量(一般没有这个必要)
winform.setInterval(
function(){
//whttp.addHeaders = "cookie:"+cookie;
//console.log(cookie)
var h = inet.whttp()
h.addHeaders = {
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9';
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.125 Safari/537.36";
'cookie':cookie;
"authority": "afsvc.jd.com"
}
var url= 'https://afsvc.jd.com/sub_afs/common/getAfsServiceCount?_=1688731251685';
sss = h.get(url);
var tabs = web.json.parse( sss )
if(tonumber( tabs['waitAuditCount']) >0){
wmp.url = "http://rwlpwfyau.hn-bkt.clouddn.com/%E6%96%B0%E8%AE%A2%E5%8D%95%E6%8F%90%E9%86%92.mp3";
times = 60000*2;
win.delay(times)
}
},times
)
winform.button.oncommand = function(id,event){
//参考: https://docs.microsoft.com/zh-cn/windows/win32/wmp/object-model-reference-for-scripting
var wmPlayer = com.CreateObject("WMPlayer.OCX");
//使用 COM 对象打开指定的音频
wmPlayer.url = "http://rwlpwfyau.hn-bkt.clouddn.com/%E6%96%B0%E8%AE%A2%E5%8D%95%E6%8F%90%E9%86%92.mp3";
}
winform.lbWmplayer.oncommand = function(id,event){
}
winform.show(true)
win.loopMessage();
效果图