var users = {}; //1.循环遍历users数据 var usermob = getQueryString("userid"); var root = null; /* 获取订购记录 */ root = getRootPath(); queryWeiboUserInfoak(usermob); function queryWeiboUserInfoak(usermob) { // var productid = 2020010201 var param = { "fog": 'df3958be828815ec18613612fa1e7a55e6077a33cfc0098b64a25eeabaa4e118976fdec7a362c595035df466add330085bd685bd54bf9abc229f4b59abe09f1618473ede33aa3665bd2c88a2ad1bc7cc690066e6a331a0cc078fd38b86681cbab250b233fcb92ba4b318f90df696b5ae', 'userid': usermob } var def = $.Deferred(); $.ajax({ url: root + "-s1api" + "/rights/query", type: "POST", contentType: "application/json", data: JSON.stringify(param) }).then(function(response) { var more = '' response.data.forEach(function(item) { console.log(response.data) switch (item.vipname) { case '爱奇艺视频会员周卡': var img = '202203/images/爱奇艺.png' break; case '美团外卖红包5元': var img = '202203/images/美团.png' break; case '抖音币50个': var img = '202203/images/抖音币.png' break; case '优酷视频会员周卡': var img = '202203/images/优酷.png' break; case '腾讯视频会员周卡': var img = '202203/images/腾讯视频.png' break; case '芒果TV PC移动影视会员周卡': var img = '202203/images/芒果tv.png' break; case '蜻蜓FM超级会员周卡': var img = '202203/images/蜻蜓.png' break; default: break; } more += `
${item.vipname}
所属产品:抖音定向流量权益包 领取号码:${item.vipuser} 领取时间:${item.ordertime}
` }) $('#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; } }).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 + "-s1api"); } 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; }