123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- var users = {};
- //1.循环遍历users数据
- var timestamp = new Date()
- console.log(timestamp)
- var usermob = getQueryString("userid");
- var root = null;
- var query = {};
- var product = {};
- /*
- 获取订购记录
- */
- init()
- function init() {
- window.root = getRootPath();
- parseQueryParms();
- $("#useraccount_tt").attr("value", getQueryString("freeflow_token"));
- var param = {
- "fes": getQueryString('fes'),
- "sou": getQueryString('sou'),
- }
- var def = $.Deferred();
- $.ajax({
- url: root + "-s1api" + "/ini/getstyle",
- type: "POST",
- contentType: "application/json",
- data: JSON.stringify(param),
- timeout: 10000
- }).then(function(responseText) {
- var response = JSON.parse(responseText);
- if (response.resultCode != "0000") {
- // window.location.href = window.root + "/404.html";
- // def.reject();
- // return def;
- }
- product = response.product[0].fog;
- queryWeiboUserInfoak(usermob, product);
- }, function(jqXHR, textStatus, errorThrown) {
- if (textStatus === "timeout") {
- // window.location.href = getRootPath() + "/hot.html?cb=" + encodeURIComponent(window.location.href);
- }
- })
- return def;
- }
- function queryWeiboUserInfoak(usermob, product) {
- // var productid = 2020010201
- var param = {
- "fog": product,
- 'userid': usermob,
- 'vipcode': '90001'
- }
- var def = $.Deferred();
- $.ajax({
- url: root + "-s1api" + "/rights/querys",
- type: "POST",
- contentType: "application/json",
- data: JSON.stringify(param)
- }).then(function(response) {
- // console.log(response.data.length)
- if (response.resultCode != '0000' || response.data.length == '0') {
- return
- } else {
- $('body').css('background', '#B8D5FF')
- $('#bodyt').css('display', 'block')
- $('#bodyts').css('display', 'none')
- var more = ''
- response.data.forEach(function(item) {
- if (item.status == "3") {
- more += ` <div class="body-as">
- <div class="ge-box">
- <div class="box-ace">
- <span class="txet_cpmcr">产品名称:</span><span class="text-ace">${item.productName}</span>
- </div>
- <span class="text-a">订购时间:</span><span class="text_asrz">${item.ordertime}</span>
- <span class="text-ak">权益领取</span>
- </div>
- </div>
- `
- }
- // console.log(response.data)
- if (item.vipuser != null) {
- more += `
-
- <div class="body-a">
- <div class="ge-box">
- <div class="box-ace">
- <span class="txet_cpmcr">产品名称:</span> <span class="text-ace">${item.productName}</span>
- </div>
- <span class="text-b">领取号码:</span><span class="text-f">${item.vipuser}</span>
- <span class="text-c">领取时间:</span><span class="text-g">${item.ordertime}</span>
-
- </div>
- </div>
- </div>
- `
- }
- })
- $('#bodyt').append(more)
- switch (response.resultCode) {
- case "0000":
- def.resolve(response);
- break;
- case "1066":
- def.resolve(response);
- break;
- default:
- compnt.showAlert(response.errorInfo)
- def.reject(response);
- break;
- }
- }
- $('.text-ak').click(function() {
- var fes = getQueryString("fes");
- var sou = getQueryString("sou");
- if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
- cbUrls = "https://800.wo.cn/orderchannel/douyin/baidu/draw20220721.html?fes=" + fes + "&sou=" + sou;
- } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
- cbUrls = "http://100.0.4.69:3344/orderchannel/douyin/baidu/draw20220721.html?fes=" + fes + "&sou=" + sou;
- }
- location.href = cbUrls
- // var d1 = new Date(timestamp); //已知时间戳
- // var d2 = new Date(); //当前时间戳
- // let minute = (parseInt(d2 - d1) / 1000 / 60) //算出相差的分钟
- // console.log(d2)
- // console.log(minute)
- // if (minute < 10) {
- // var spid = $(this).attr("id")
- // var productid = $(this).attr("productid");
- // var a = getQueryString("cpid");
- // var b = getQueryString("userid");
- // var c = getQueryString("usermob");
- // var fes = getQueryString("fes");
- // var sou = getQueryString("sou");
- // var cbUrls;
- // if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
- // cbUrls = "https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?fes=jjd&sou=1m&cpid=" + a + '&userid=' + b + '&usermob=' + c + '&spid=' + spid + '&productid=' + productid;
- // } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
- // cbUrls = "http://100.0.4.69:3344/orderchannel/douyin/15/draw20220313.html?fes=" + fes + "&sou=" + sou + '&cpid=' + a + '&userid=' + b + '&usermob=' + c + '&spid=' + spid + '&productid=' + productid;
- // }
- // location.href = cbUrls
- // } else {
- // var spid = $(this).attr("id")
- // var productid = $(this).attr("productid");
- // var cbUrl = 'https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?fes=jjd&sou=1m&spid=' + spid + '&productid=' + productid;
- // // var cbUrl = 'https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?' + 'fes=' + fes + '&sou=' + sou;
- // if (cbUrl.indexOf('cpid=') > 0) {
- // cbUrl = cbUrl.substr(0, cbUrl.indexOf('cpid=') - 1)
- // }
- // if (window.location.href.indexOf('?') >= 0) {
- // cbUrl += '&cpid=2017060800064876';
- // } else {
- // cbUrl += '?cpid=2017060800064876';
- // }
- // // 调用南研一键取号页面
- // window.location.href = 'https://account.bol.wo.cn/cuuser/unity/redirectOnekeyLogin?clientId=directflow&redirectUrl=' + encodeURIComponent(encodeURIComponent(cbUrl))
- // }
- });
- }).fail(function(error) {
- def.reject('服务调用异常')
- })
- return def;
- };
- /*
- 获取root
- */
- function getRootPath() {
- //获取当前网址,如: http://localhost:8080/ems/Pages/Basic/Person.jsp
- var curWwwPath = window.document.location.href;
- //获取主机地址之后的目录,如: /ems/Pages/Basic/Person.jsp
- var pathName = window.document.location.pathname;
- var pos = curWwwPath.indexOf(pathName);
- //获取主机地址,如: http://localhost:8080
- var localhostPath = curWwwPath.substring(0, pos);
- //获取带"/"的项目名,如:/ems
- var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
- root = (localhostPath + projectName);
- return (localhostPath + projectName);
- }
- function getQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
- var r = window.location.search.substr(1).match(reg);
- if (r != null) return unescape(r[2]);
- return null;
- }
- function parseQueryParms() {
- var QUERY_SEPARATOR = '&',
- VALUE_SEPARATOR = '=';
- var queryStr = window.location.search.substring(1);
- var startIndex = 0,
- vIndex, qIndex;
- while (queryStr.length > 0) {
- vIndex = queryStr.indexOf(VALUE_SEPARATOR, startIndex);
- if (vIndex == -1) {
- break;
- }
- qIndex = queryStr.indexOf(QUERY_SEPARATOR, vIndex + 1);
- if (qIndex == -1) {
- qIndex = queryStr.length;
- }
- var key = queryStr.substring(startIndex, vIndex);
- var value = queryStr.substring(vIndex + 1, qIndex);
- query[key] = decodeURIComponent(value);
- startIndex = qIndex + 1;
- }
- }
|