page.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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': '90001'
  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. <span class="text-a">订购时间:</span><span class="text_asrz">${item.ordertime}</span>
  74. <span class="text-ak">权益领取</span>
  75. </div>
  76. </div>
  77. `
  78. }
  79. // console.log(response.data)
  80. if (item.vipuser != null) {
  81. more += `
  82. <div class="body-a">
  83. <div class="ge-box">
  84. <div class="box-ace">
  85. <span class="txet_cpmcr">产品名称:</span> <span class="text-ace">${item.productName}</span>
  86. </div>
  87. <span class="text-b">领取号码:</span><span class="text-f">${item.vipuser}</span>
  88. <span class="text-c">领取时间:</span><span class="text-g">${item.ordertime}</span>
  89. </div>
  90. </div>
  91. </div>
  92. `
  93. }
  94. })
  95. $('#bodyt').append(more)
  96. switch (response.resultCode) {
  97. case "0000":
  98. def.resolve(response);
  99. break;
  100. case "1066":
  101. def.resolve(response);
  102. break;
  103. default:
  104. compnt.showAlert(response.errorInfo)
  105. def.reject(response);
  106. break;
  107. }
  108. }
  109. $('.text-ak').click(function() {
  110. var fes = getQueryString("fes");
  111. var sou = getQueryString("sou");
  112. if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
  113. cbUrls = "https://800.wo.cn/orderchannel/douyin/baidu/draw20220721.html?fes=" + fes + "&sou=" + sou;
  114. } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
  115. cbUrls = "http://100.0.4.69:3344/orderchannel/douyin/baidu/draw20220721.html?fes=" + fes + "&sou=" + sou;
  116. }
  117. location.href = cbUrls
  118. // var d1 = new Date(timestamp); //已知时间戳
  119. // var d2 = new Date(); //当前时间戳
  120. // let minute = (parseInt(d2 - d1) / 1000 / 60) //算出相差的分钟
  121. // console.log(d2)
  122. // console.log(minute)
  123. // if (minute < 10) {
  124. // var spid = $(this).attr("id")
  125. // var productid = $(this).attr("productid");
  126. // var a = getQueryString("cpid");
  127. // var b = getQueryString("userid");
  128. // var c = getQueryString("usermob");
  129. // var fes = getQueryString("fes");
  130. // var sou = getQueryString("sou");
  131. // var cbUrls;
  132. // if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
  133. // cbUrls = "https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?fes=jjd&sou=1m&cpid=" + a + '&userid=' + b + '&usermob=' + c + '&spid=' + spid + '&productid=' + productid;
  134. // } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
  135. // 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;
  136. // }
  137. // location.href = cbUrls
  138. // } else {
  139. // var spid = $(this).attr("id")
  140. // var productid = $(this).attr("productid");
  141. // var cbUrl = 'https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?fes=jjd&sou=1m&spid=' + spid + '&productid=' + productid;
  142. // // var cbUrl = 'https://800.wo.cn/orderchannel/douyin/15/draw20220313.html?' + 'fes=' + fes + '&sou=' + sou;
  143. // if (cbUrl.indexOf('cpid=') > 0) {
  144. // cbUrl = cbUrl.substr(0, cbUrl.indexOf('cpid=') - 1)
  145. // }
  146. // if (window.location.href.indexOf('?') >= 0) {
  147. // cbUrl += '&cpid=2017060800064876';
  148. // } else {
  149. // cbUrl += '?cpid=2017060800064876';
  150. // }
  151. // // 调用南研一键取号页面
  152. // window.location.href = 'https://account.bol.wo.cn/cuuser/unity/redirectOnekeyLogin?clientId=directflow&redirectUrl=' + encodeURIComponent(encodeURIComponent(cbUrl))
  153. // }
  154. });
  155. }).fail(function(error) {
  156. def.reject('服务调用异常')
  157. })
  158. return def;
  159. };
  160. /*
  161. 获取root
  162. */
  163. function getRootPath() {
  164. //获取当前网址,如: http://localhost:8080/ems/Pages/Basic/Person.jsp
  165. var curWwwPath = window.document.location.href;
  166. //获取主机地址之后的目录,如: /ems/Pages/Basic/Person.jsp
  167. var pathName = window.document.location.pathname;
  168. var pos = curWwwPath.indexOf(pathName);
  169. //获取主机地址,如: http://localhost:8080
  170. var localhostPath = curWwwPath.substring(0, pos);
  171. //获取带"/"的项目名,如:/ems
  172. var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
  173. root = (localhostPath + projectName);
  174. return (localhostPath + projectName);
  175. }
  176. function getQueryString(name) {
  177. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  178. var r = window.location.search.substr(1).match(reg);
  179. if (r != null) return unescape(r[2]);
  180. return null;
  181. }
  182. function parseQueryParms() {
  183. var QUERY_SEPARATOR = '&',
  184. VALUE_SEPARATOR = '=';
  185. var queryStr = window.location.search.substring(1);
  186. var startIndex = 0,
  187. vIndex, qIndex;
  188. while (queryStr.length > 0) {
  189. vIndex = queryStr.indexOf(VALUE_SEPARATOR, startIndex);
  190. if (vIndex == -1) {
  191. break;
  192. }
  193. qIndex = queryStr.indexOf(QUERY_SEPARATOR, vIndex + 1);
  194. if (qIndex == -1) {
  195. qIndex = queryStr.length;
  196. }
  197. var key = queryStr.substring(startIndex, vIndex);
  198. var value = queryStr.substring(vIndex + 1, qIndex);
  199. query[key] = decodeURIComponent(value);
  200. startIndex = qIndex + 1;
  201. }
  202. }