page.js 8.8 KB

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