34995549 大佬有话说 : 2019-12-14 12:54:02
[干货]使用腾讯云函数进行联通掌厅签到领金币
本帖最后由 34995549 于 2019-12-14 12:59 编辑
1、首先获取cookies
开启抓包软件 httpcanary ,打开联通手机营业厅,随便点击一个页面,回到抓包软件查看请求cookies即可。
httpcanary很方便的就能复制cookies
本人博客交换友链:xiaomcm.com
2、脚本部署
登录腾讯云scf(无服务器云函数) https://console.cloud.tencent.com/scf
选择:函数服务=》(选择区域,上海,广州,成都,香港,北京)=》新建=》空白函数=》函数名称(随便写,比如lt_qiandao)=》运行环境(php7.2)=》下一步。
然后粘贴下面的代码进去:
<?php
function main_handler($event,$time){
//脚本设置
$phone = ”;//填写手机号
$cookie = ”; //填写cookies
$sckey = ”; //填写sever酱sckey
$data = ‘className=signinIndex’;
$date = date(‘YmdHis’);
$headers = array(
"Referer: https://act.10010.com/SigninApp/signin/querySigninActivity.htm?desmobile=".$phone."&[email protected]",
"Accept: text/html, application/xhtml+xml, image/jxr, */*",
"User-Agent: Mozilla/5.0 (Linux; Android 9; MI MAX 3 Build/PKQ1.180729.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.157 Mobile Safari/537.36; unicom{version:[email protected],desmobile:15690507717};devicetype{deviceBrand:Xiaomi,deviceModel:MI MAX 3}"
);
$random = mt_rand(100000,999999);
$renzheng = post(‘https://act.10010.com/SigninApp/signin/rewardReminder.do?vesion=0.018936113139′.$random,’ ‘,$cookie,$headers);
//金币查询
$count1 = post(‘https://act.10010.com/SigninApp/signin/goldTotal.do?vesion=0.019762071301′.$random,’ ‘,$cookie,$headers);
//签到
$output = post(‘https://act.10010.com/SigninApp/signin/daySign.do’,$data,$cookie,$headers);
$qd1 = json_decode($output,true);
if($qd1[‘msgCode’] == ‘0000’){
$qd1_result = ‘签到成功,获得了’.$qd1[‘continuCount’].’金币’;
}elseif($qd1[‘msgCode’] == ‘0008’){
$qd1_result = ‘签到失败,今天已签到!’;
}else{
$qd1_result = ‘签到失败,cookie过期。’;
file_get_contents(‘https://sc.ftqq.com/’.$sckey.’.send?text=’.urlencode(‘联通营业厅签到cookie过期啦!’));
return ‘error’;
}
//WB签到
$wb = post(‘https://act.10010.com/signinAppH/commonTask?vesion=0.01839278081′.$random,’transId=’.$data.’0.19402970817′.$random.’&userNumber=’.$phone.’&taskCode=TA590934984&finishTime=20191213174953&taskType=DAILY_TASK’,$cookie,$headers);
$qd2 = json_decode($wb,true);
if($qd2[‘respCode’] == ‘0000’){
$qd2_result = ‘签到成功’;
}elseif($qd2[‘respCode’] == ‘0003’){
$qd2_result = ‘签到失败,今天已签到!’;
}else{
$qd2_result = ‘签到失败,cookie过期。’;
}
//金币查询
$count2 = post(‘https://act.10010.com/SigninApp/signin/goldTotal.do?vesion=0.019762071301′.$random,’ ‘,$cookie,$headers);
echo ‘脚本执行完成。<br>营业厅签到结果:’.$qd1_result.'<br>WB双签结果:’.$qd2_result.'<br>签到前金币:’.$count1.'<br>签到后金币:’.$count2;
}
function post($url, $data, $cookie,$headers) {
//初使化init方法
$ch = curl_init();
//指定URL
curl_setopt($ch, CURLOPT_URL, $url);
//设定请求后返回结果
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//声明使用POST方式来进行发送
curl_setopt($ch, CURLOPT_POST, 1);
//发送什么数据呢
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
//忽略证书
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
//设置超时时间
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
//发送请求
$output = curl_exec($ch);
//关闭curl
curl_close($ch);
//返回数据
return $output;
}
?>
自己按照提示修改里面的三项参数!然后继续设置出发方式!
=》触发方式=》定时触发 / 名称:lt_timer /自定义触发周期 0 0 3 * * * * =》保存
=》函数代码=》测试查看日志内容即可
成功以后就是下发图片这种:
https://ae01.alicdn.com/kf/U30a5503eebc84efeb1771f2193f383e7u.jpg
dforel 大佬有话说 : 2019-12-14 12:54:35
本帖最后由 dforel 于 2019-12-14 13:00 编辑
大佬6666,前排支持下
忘江湖 大佬有话说 : 2019-12-14 12:56:38
一个cookie能活几天呢。。。
assistance 大佬有话说 : 2019-12-14 12:57:21
我这里金币只能换各种广告优惠券。。。
edisonangel 大佬有话说 : 2019-12-14 12:57:44
虽然没看懂,但是还是赞一下
34995549 大佬有话说 : 2019-12-14 13:07:13
顶一个
Wine 大佬有话说 : 2019-12-14 13:07:48
移动帮顶
chwl 大佬有话说 : 2019-12-14 13:11:42
这个挺牛的啊!
SВ 大佬有话说 : 2019-12-14 13:58:57
感谢分享。
lunatic 大佬有话说 : 2019-12-14 14:16:53
感谢大佬的分享,已进行测试和整理,然后转载到签名博客(底部有作者名称及转载说明):lol如不允许转载我马上删除