|
发表于 2018-10-23 11:39:00
|
显示全部楼层
js代码找到了,但是,关键点还是在sn参数哪里,其他参数都是明文的。
唯独sn参数,没看错的话,需要axaj从后端获取,sn参数是一个固定的值- function downloadSoft() {
- download.onClick();
- }
- var payLayer = null;
- var wxtLayer = null;
- function hidedownloadLayer() {
- layer.close(wxtLayer);
- }
- function openscan() {
- payLayer = layer.open({
- type: 2,
- area: ['530px', '440px'],
- shadeClose: false,
- closeBtn: 0,
- title: false,
- content: [$('#hid_OrderCenterUrl').val() + '/soft/xx?button=' + encodeURIComponent('立即下载') + '&softid=' + $("#hid_softid").val()+ '&sourceid=' + $("#hid_sourceid").val() + '&callback=downloadSoft', 'no']
- });
- }
- function closeLayer() {
- layer.close(payLayer);
- }
- function openDialog(msg) {
- layer.open({
- type: 1
- , title: '下载错误提示消息'
- , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
- , area: ['500px', '300px']
- , id: 'layerInfo'//防止重复弹出
- , content: '<div style="padding-top:80px; text-align:center">' + msg + '</div>'
- , btn: '确认'
- , btnAlign: 'c' //按钮居中
- , shade: 0 //不显示遮罩
- , yes: function () {
- layer.closeAll();
- }
- });
- }
- var download = {
- };
- //下载点击
- download.onClick = function () {
- var softId = $("#hid_softid").val();
- $.ajax({
- url: "http://www.xuekeedu.com/download.aspx?action=checkpayinfo&SoftId=" + softId,
- type: "get",
- contentType: "application/json",
- dataType: "json",
- data: "",
- cache: false,
- error: function (d) {
- openDialog("获取用户下载许可失败!");
- console.log("获取用户下载许可失败," + d.errMsg);
- },
- success: function (d) {
- //errNo
- if (d.errNo > 0) {
- //提示充值
- if (d.errNo >= 13 && d.errNo <= 17) {
- openscan();
- }
- else if (d.errNo == 1) {
- xiaoxue.popLogin();
- }
- //网校通过期提示
- else if (d.errNo >= 18&&d.errNo<=21) {
- if (d.errNo == 18 || d.errNo == 19) {
- var area = ['530px', '200px'];
- }
- else {
- var area = ['530px', '260px'];
- }
- wxtLayer = layer.open({
- type: 2,
- area: area,
- shadeClose: false,
- closeBtn: 0,
- title: false,
- content: ['http://www.xuekeedu.com/PopWxt.aspx?resultCode=' + encodeURIComponent(d.errNo) + '&resultMessage=' + encodeURIComponent(d.errMsg), 'no']
- });
- }
- //网校通超过下载次数限制
- else if (d.errNo == 23 || d.errNo == 24) {
- var area = ['580px', '415px'];
- if (d.errNo == 24) {
- area = ['580px', '260px'];
- }
- wxtLayer = layer.open({
- type: 2,
- area: area,
- shadeClose: false,
- closeBtn: 0,
- title: false,
- content: ['http://www.xuekeedu.com/PopWxt_Account.aspx?resultCode=' + encodeURIComponent(d.errNo) + '&resultMessage=' + encodeURIComponent(d.errMsg), 'no']
- });
- }
- //弹窗提示
- else {
- openDialog(d.errMsg);
- }
- return;
- }
- else {
- //可以正常下载
- download.goDownload('http://www.xuekeedu.com/Download.aspx?UrlID=41&SoftID=' + softId);
- }
- }
- });
- }
- download.lastTimeFlag = new Date();
- //下载点击的不能过于频繁
- download.check_LastClickTime = function () {
- var now = new Date();
- if (now - this.lastTimeFlag < 1500) {
- return false;
- }
- this.lastTimeFlag = now;
- return true;
- }
- //下载前验证
- download.check_BeforeDownload = function (url) {
- if (!xiaoxue.chkLogin()) {
- return false;
- }
- var d = Storage.Get("download", "timeFlag");
- if (!d) {
- Storage.Set("download", "timeFlag", new Date().getTime());
- Storage.Set("download", "count", 1);
- return true;
- }
- else {
- var icount = parseInt(Storage.Get("download", "count"));
- Storage.Set("download", "count", ++icount);
- var interval = new Date().getTime() - Storage.Get("download", "timeFlag");
- if (interval > 300000) {
- //下载间隔超过5分钟,重置标记
- Storage.Set("download", "timeFlag", new Date().getTime());
- Storage.Set("download", "count", 1);
- return true;
- }
- else if (icount >= 10000) {
- //显示验证码
- xiaoxue.popupVerifyCode(url);
- return false;
- }
- else {
- return true;
- }
- }
- }
- download.check_XiaoBenUser = function () {
- var xiaobenUser = Util.cookie.get("xiaobenuser");
- if (xiaobenUser) {//校本用户加积分
- $.get("http://58.130.116.200/member/updatepoint.htm?username=" + xiaobenUser);
- }
- return true;
- }
- //跳转到下载前的检查
- download.goDownload = function (url) {
- for (var i = 0; i < this.checks.length; i++) {
- if (!this.checks[i]()) {
- return;
- }
- }
- location.href = url;
- }
- //配置下载验证逻辑
- download.checks =
- [download.check_LastClickTime
- , download.check_BeforeDownload
- , download.check_XiaoBenUser];
- $(function () {
- //下载弹窗事件
- $(".downloadbtn").click(function () {
- if (!xiaoxue.chkLogin()) {
- return false;
- }
- downloadSoft();
- });
- //关闭弹窗
- });
复制代码
|
|