lushuncheng hace 4 años
padre
commit
c725611e2a
Se han modificado 1 ficheros con 28 adiciones y 12 borrados
  1. 28 12
      public/demo.html

+ 28 - 12
public/demo.html

@@ -45,14 +45,30 @@
     <script type="text/javascript">
       var ua = navigator.userAgent.toLocaleUpperCase().indexOf("WEIBO") >= 0;
       alert(ua);
-      if (ua) {
-        let url = "https://sina.shuncheng.lu/demo.html"; // 要打开的 H5 页面的地址
+      function setCookie(cname, cvalue, exdays) {
+        var d = new Date();
+        d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
+        var expires = "expires=" + d.toGMTString();
+        document.cookie = cname + "=" + cvalue + "; " + expires;
+      }
+      //获取cookie
+      function getCookie(cname) {
+        var name = cname + "=";
+        var ca = document.cookie.split(";");
+        for (var i = 0; i < ca.length; i++) {
+          var c = ca[i].trim();
+          if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
+        }
+        return "";
+      }
+      if (!ua) {
+        let url = "http://www.weibo.cn/demo.html"; // 要打开的 H5 页面的地址
         let scheme = `sinaweibo://browser?url=` + encodeURIComponent(url);
         window.location.href = `https://m.weibo.cn/feature/openapp?scheme=` + encodeURIComponent(scheme);
       } else {
-        if ($.cookie("SUB") == "") {
+        if (getCookie("SUB") == "") {
           alert("未登录");
-          let url = "https://sina.shuncheng.lu/demo.html"; // 要打开的 H5 页面的地址
+          let url = "http://www.weibo.cn/demo.html"; // 要打开的 H5 页面的地址
           //未登录状态下跳转 scheme:
           window.location.href = `sinaweibo://login?redirect_scheme` + encodeURIComponent(url);
         }
@@ -105,7 +121,7 @@
 
           $.ajax({
             type: "POST",
-            url: "https://sina.shuncheng.lu/index/index/checkLogin",
+            url: "http://www.weibo.cn/index/index/checkLogin",
             data: JSON.stringify({ cookie: document.cookie }),
             dataType: "json",
             xhrFields: {
@@ -124,7 +140,7 @@
         $("#config").click(function () {
           let params = { token: loginToken };
           // let encryptedData = Encrypt(JSON.stringify(params));
-          $.post("https://sina.shuncheng.lu/index/login", params, function (res) {
+          $.post("http://www.weibo.cn/index/login", params, function (res) {
             $("#configResult").html(res);
             let decrypted = Decrypt(res.data);
             $("#configResult").html(decrypted);
@@ -133,7 +149,7 @@
         $("#start").click(function () {
           let params = { token: loginToken };
           // let encryptedData = Encrypt(JSON.stringify(params));
-          $.post("https://sina.shuncheng.lu/index/startGame", params, function (res) {
+          $.post("http://www.weibo.cn/index/startGame", params, function (res) {
             $("#startResult").html(JSON.stringify(res));
             let decrypted = res.data;
             gameID = decrypted.gameID;
@@ -142,7 +158,7 @@
         $("#topList").click(function () {
           let params = { token: loginToken };
           // let encryptedData = Encrypt(JSON.stringify(params));
-          $.post("https://sina.shuncheng.lu/index/topList", params, function (res) {
+          $.post("http://www.weibo.cn/index/topList", params, function (res) {
             $("#topListResult").html(JSON.stringify(res));
             // let decrypted = (Decrypt(res.data));
             // $('#topListResult').html(decrypted);
@@ -153,7 +169,7 @@
         $("#end").click(function () {
           let params = { token: loginToken, gameID: gameID, score: 300, gameData: gameResult };
           // let encryptedData = Encrypt(JSON.stringify(params));
-          $.post("https://sina.shuncheng.lu/index/endGame", params, function (res) {
+          $.post("http://www.weibo.cn/index/endGame", params, function (res) {
             $("#endResult").html(JSON.stringify(res));
             // let decrypted = (Decrypt(res.data));
             // $('#endResult').html(decrypted);
@@ -164,7 +180,7 @@
         $("#reward").click(function () {
           let params = { token: loginToken, gameID: gameID };
           // let encryptedData = Encrypt(JSON.stringify(params));
-          $.post("https://sina.shuncheng.lu/index/reward", params, function (res) {
+          $.post("http://www.weibo.cn/index/reward", params, function (res) {
             $("#rewardResult").html(JSON.stringify(res));
             orderID = res.data.orderID;
             // let decrypted = (Decrypt(res.data));
@@ -177,7 +193,7 @@
           mobile = $("#mobile").val();
           let params = { token: loginToken, mobile: mobile };
           // let encryptedData = Encrypt(JSON.stringify(params));
-          $.post("https://sina.shuncheng.lu/index/sendSmsCode", params, function (res) {
+          $.post("http://www.weibo.cn/index/sendSmsCode", params, function (res) {
             $("#smsResult").html(JSON.stringify(res));
             // orderID = res.data.orderID;
             // let decrypted = (Decrypt(res.data));
@@ -199,7 +215,7 @@
             code: code,
           };
           // let encryptedData = Encrypt(JSON.stringify(params));
-          $.post("https://sina.shuncheng.lu/index/saveAddress", params, function (res) {
+          $.post("http://www.weibo.cn/index/saveAddress", params, function (res) {
             $("#saveAddressResult").html(JSON.stringify(res));
             // orderID = res.data.orderID;
             // let decrypted = (Decrypt(res.data));