page.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. var users = {};
  2. //1.循环遍历users数据
  3. var timestamp = new Date()
  4. console.log(timestamp)
  5. var usermob = getQueryString("userid");
  6. var root = null;
  7. var query = {};
  8. var product = {};
  9. /*
  10. 获取订购记录
  11. */
  12. init()
  13. function init() {
  14. window.root = getRootPath();
  15. parseQueryParms();
  16. $("#useraccount_tt").attr("value", getQueryString("freeflow_token"));
  17. var param = {
  18. "fes": getQueryString('fes'),
  19. "sou": getQueryString('sou'),
  20. }
  21. var def = $.Deferred();
  22. $.ajax({
  23. url: root + "-s1api" + "/ini/getstyle",
  24. type: "POST",
  25. contentType: "application/json",
  26. data: JSON.stringify(param),
  27. timeout: 10000
  28. }).then(function(responseText) {
  29. var response = JSON.parse(responseText);
  30. if (response.resultCode != "0000") {
  31. // window.location.href = window.root + "/404.html";
  32. // def.reject();
  33. // return def;
  34. }
  35. product = response.product[0].fog;
  36. queryWeiboUserInfoak(usermob, product);
  37. }, function(jqXHR, textStatus, errorThrown) {
  38. if (textStatus === "timeout") {
  39. // window.location.href = getRootPath() + "/hot.html?cb=" + encodeURIComponent(window.location.href);
  40. }
  41. })
  42. return def;
  43. }
  44. function queryWeiboUserInfoak(usermob, product) {
  45. // var productid = 2020010201
  46. var param = {
  47. "fog": product,
  48. 'userid': usermob,
  49. 'vipcode': '90009'
  50. }
  51. var def = $.Deferred();
  52. $.ajax({
  53. url: root + "-s1api" + "/rights/querys",
  54. type: "POST",
  55. contentType: "application/json",
  56. data: JSON.stringify(param)
  57. }).then(function(response) {
  58. // console.log(response.data.length)
  59. if (response.resultCode != '0000' || response.data.length == '0') {
  60. return
  61. } else {
  62. $('body').css('background', '#B8D5FF')
  63. $('#bodyt').css('display', 'block')
  64. $('#bodyts').css('display', 'none')
  65. var more = ''
  66. response.data.forEach(function(item) {
  67. if (item.status == "3") {
  68. more += ` <div class="body-as">
  69. <div class="ge-box">
  70. <div class="box-ace">
  71. <span class="txet_cpmcr">产品名称:</span><span class="text-ace">${item.productName}</span>
  72. </div>
  73. <div class="lol">
  74. <p class="text-a">订购时间:<span class="text_asrz">${item.ordertime}</span></p>
  75. <!-- <span class="text-a"></span><span class="text_asrz">${item.ordertime}</span> -->
  76. </div>
  77. <span class="text-ak">权益领取</span>
  78. </div>
  79. </div>
  80. `
  81. }
  82. // console.log(response.data)
  83. if (item.vipuser != null) {
  84. more += `
  85. <div class="body-a">
  86. <div class="ge-box">
  87. <div class="box-ace">
  88. <span class="txet_cpmcr">产品名称:</span> <span class="text-ace">${item.productName}</span>
  89. </div>
  90. <div class="lol">
  91. <p class="text-b">领取号码:<span class="text-f">${item.vipuser}</span></p>
  92. <!-- <span class="text-b">领取号码:</span><span class="text-f">${item.vipuser}</span> -->
  93. </div>
  94. <div class="lols">
  95. <p class="text-c">领取时间:<span class="text-g">${item.ordertime}</span></p>
  96. <!-- <span class="text-c">领取时间:</span><span class="text-g">${item.ordertime}</span> -->
  97. </div>
  98. </div>
  99. </div>
  100. `
  101. }
  102. })
  103. $('#bodyt').append(more)
  104. switch (response.resultCode) {
  105. case "0000":
  106. def.resolve(response);
  107. break;
  108. case "1066":
  109. def.resolve(response);
  110. break;
  111. default:
  112. compnt.showAlert(response.errorInfo)
  113. def.reject(response);
  114. break;
  115. }
  116. }
  117. $('.text-ak').click(function() {
  118. var fes = getQueryString("fes");
  119. var sou = getQueryString("sou");
  120. if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
  121. cbUrls = "https://800.wo.cn/orderchannel/google/5Gbaidu29/draw.html?fes=" + fes + "&sou=" + sou;
  122. } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
  123. cbUrls = "http://100.0.4.69:3344/orderchannel/douyin/baidu/draw20220721.html?fes=" + fes + "&sou=" + sou;
  124. }
  125. location.href = cbUrls
  126. // var d1 = new Date(timestamp); //已知时间戳
  127. // var d2 = new Date(); //当前时间戳
  128. // let minute = (parseInt(d2 - d1) / 1000 / 60) //算出相差的分钟
  129. // console.log(d2)
  130. // console.log(minute)
  131. // if (minute < 10) {
  132. // var spid = $(this).attr("id")
  133. // var productid = $(this).attr("productid");
  134. // var a = getQueryString("cpid");
  135. // var b = getQueryString("userid");
  136. // var c = getQueryString("usermob");
  137. // var fes = getQueryString("fes");
  138. // var sou = getQueryString("sou");
  139. // var cbUrls;
  140. // if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
  141. // cbUrls = "https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?fes=jjd&sou=1m&cpid=" + a + '&userid=' + b + '&usermob=' + c + '&spid=' + spid + '&productid=' + productid;
  142. // } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
  143. // 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;
  144. // }
  145. // location.href = cbUrls
  146. // } else {
  147. // var spid = $(this).attr("id")
  148. // var productid = $(this).attr("productid");
  149. // var cbUrl = 'https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?fes=jjd&sou=1m&spid=' + spid + '&productid=' + productid;
  150. // // var cbUrl = 'https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?' + 'fes=' + fes + '&sou=' + sou;
  151. // if (cbUrl.indexOf('cpid=') > 0) {
  152. // cbUrl = cbUrl.substr(0, cbUrl.indexOf('cpid=') - 1)
  153. // }
  154. // if (window.location.href.indexOf('?') >= 0) {
  155. // cbUrl += '&cpid=2017060800064876';
  156. // } else {
  157. // cbUrl += '?cpid=2017060800064876';
  158. // }
  159. // // 调用南研一键取号页面
  160. // window.location.href = 'https://account.bol.wo.cn/cuuser/unity/redirectOnekeyLogin?clientId=directflow&redirectUrl=' + encodeURIComponent(encodeURIComponent(cbUrl))
  161. // }
  162. });
  163. }).fail(function(error) {
  164. def.reject('服务调用异常')
  165. })
  166. return def;
  167. };
  168. /*
  169. 获取root
  170. */
  171. function getRootPath() {
  172. //获取当前网址,如: http://localhost:8080/ems/Pages/Basic/Person.jsp
  173. var curWwwPath = window.document.location.href;
  174. //获取主机地址之后的目录,如: /ems/Pages/Basic/Person.jsp
  175. var pathName = window.document.location.pathname;
  176. var pos = curWwwPath.indexOf(pathName);
  177. //获取主机地址,如: http://localhost:8080
  178. var localhostPath = curWwwPath.substring(0, pos);
  179. //获取带"/"的项目名,如:/ems
  180. var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
  181. root = (localhostPath + projectName);
  182. return (localhostPath + projectName);
  183. }
  184. function getQueryString(name) {
  185. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  186. var r = window.location.search.substr(1).match(reg);
  187. if (r != null) return unescape(r[2]);
  188. return null;
  189. }
  190. function parseQueryParms() {
  191. var QUERY_SEPARATOR = '&',
  192. VALUE_SEPARATOR = '=';
  193. var queryStr = window.location.search.substring(1);
  194. var startIndex = 0,
  195. vIndex, qIndex;
  196. while (queryStr.length > 0) {
  197. vIndex = queryStr.indexOf(VALUE_SEPARATOR, startIndex);
  198. if (vIndex == -1) {
  199. break;
  200. }
  201. qIndex = queryStr.indexOf(QUERY_SEPARATOR, vIndex + 1);
  202. if (qIndex == -1) {
  203. qIndex = queryStr.length;
  204. }
  205. var key = queryStr.substring(startIndex, vIndex);
  206. var value = queryStr.substring(vIndex + 1, qIndex);
  207. query[key] = decodeURIComponent(value);
  208. startIndex = qIndex + 1;
  209. }
  210. }