dzduole hace 10 horas
padre
commit
d793a8afc3

+ 311 - 39
client/laya/bin/js/bundle.js

@@ -51,6 +51,10 @@
     let POWER_CHANGE = "POWER_CHANGE";
     let POWER_TIME = "POWER_TIME";
     let keyForLoginInfo = "userInfo";
+    let TIP_MSG_key = {
+        loginTimeOut: "Login timed out, please log in again.",
+        pleaseLoginIn: "Please log in."
+    };
     let baseHeadUrl = "https://mygame1.tangro.cn/headimg/";
     let poolKey = {
         inHoleEft: "inHoleEft",
@@ -150,6 +154,7 @@
         POWER_CHANGE: POWER_CHANGE,
         POWER_TIME: POWER_TIME,
         keyForLoginInfo: keyForLoginInfo,
+        TIP_MSG_key: TIP_MSG_key,
         baseHeadUrl: baseHeadUrl,
         poolKey: poolKey,
         get GameMode () { return GameMode; },
@@ -5761,6 +5766,38 @@
     }
     ui_UIShop.URL = "ui://isxx5ak7g1giv4ep";
 
+    class ui_UIMsg extends fgui.GComponent {
+        static createInstance() {
+            return (fgui.UIPackage.createObject("game", "UIMsg"));
+        }
+        onConstruct() {
+            this.tipsNode = (this.getChild("tipsNode"));
+        }
+    }
+    ui_UIMsg.URL = "ui://isxx5ak7hkrz3qt";
+
+    class UIMsg extends UIBase {
+        constructor() {
+            super();
+        }
+        onConstructor() {
+            this.ui = ui_UIMsg.createInstance();
+            this.contentPane = this.ui;
+            this.isEject = false;
+            this.isMuti = true;
+        }
+        show(msg, callback) {
+            super.show();
+            this.ui.tipsNode.msgTxt.text = msg;
+            this.ui.alpha = 1;
+            Laya.Tween.to(this.ui, { alpha: 0 }, 500, null, Laya.Handler.create(this, () => {
+                this.hide();
+                callback && callback();
+            }), 1000);
+        }
+    }
+    UIMsg.uiName = "UIMsg";
+
     class BallRodDisplay {
         constructor(ui, index) {
             this.index = 0;
@@ -5822,6 +5859,7 @@
                     let data = cfgTable.ballrodData[this.index + 1];
                     let need = data.price;
                     if (DataMgr.diamondEnough(need)) {
+                        this.buyQiuGan(data);
                         DataMgr.setDiamond(-need);
                         DataMgr.setBallRod(this.index, 1);
                         DataMgr.setCurBallRod(this.index);
@@ -5837,6 +5875,44 @@
                     break;
             }
         }
+        buyQiuGan(qgItem) {
+            console.log('zh:buyQiuGan=' + JSON.stringify(qgItem));
+            let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.qiuGanData = qgItem;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyQiuGan', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.loginTimeOut);
+                        xGame.uiMgr.Show(UIMsg, msg);
+                        return;
+                    }
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                        DataMgr.getUserZiChanInfo();
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
+        }
         logEventForGouMaiGan(qiuGanName) {
             const ev = {
                 value: qiuGanName
@@ -5847,38 +5923,6 @@
         }
     }
 
-    class ui_UIMsg extends fgui.GComponent {
-        static createInstance() {
-            return (fgui.UIPackage.createObject("game", "UIMsg"));
-        }
-        onConstruct() {
-            this.tipsNode = (this.getChild("tipsNode"));
-        }
-    }
-    ui_UIMsg.URL = "ui://isxx5ak7hkrz3qt";
-
-    class UIMsg extends UIBase {
-        constructor() {
-            super();
-        }
-        onConstructor() {
-            this.ui = ui_UIMsg.createInstance();
-            this.contentPane = this.ui;
-            this.isEject = false;
-            this.isMuti = true;
-        }
-        show(msg, callback) {
-            super.show();
-            this.ui.tipsNode.msgTxt.text = msg;
-            this.ui.alpha = 1;
-            Laya.Tween.to(this.ui, { alpha: 0 }, 500, null, Laya.Handler.create(this, () => {
-                this.hide();
-                callback && callback();
-            }), 1000);
-        }
-    }
-    UIMsg.uiName = "UIMsg";
-
     class DaoJuDisplay {
         constructor(ui, index) {
             this.index = 0;
@@ -5906,7 +5950,7 @@
             console.log('zh:点击购买 djItem =' + JSON.stringify(djItem));
             let userInfo = LocalStorageManager.getItem('userInfo');
             if (userInfo == null) {
-                xGame.uiMgr.Show(UIMsg, 'Please log in to your account .');
+                xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
                 return;
             }
             let reqData = xGame.httpMgr.getReqData();
@@ -5918,8 +5962,14 @@
                     console.log('zh:buySp res = ' + JSON.stringify(res));
                     let code = res.code;
                     let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.pleaseLoginIn);
+                        return;
+                    }
                     if (code == 200) {
                         xGame.uiMgr.Show(UIMsg, msg);
+                        DataMgr.getUserZiChanInfo();
                     }
                     else {
                         xGame.uiMgr.Show(UIMsg, msg);
@@ -5973,6 +6023,11 @@
                 try {
                     let code = res.code;
                     let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.pleaseLoginIn);
+                        return;
+                    }
                     if (code == 200) {
                         let data = res.data;
                         for (let index = 0; index < data.length; index++) {
@@ -6966,7 +7021,42 @@
             this.hide();
         }
         gotoBuy() {
-            this.hide();
+            let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.productId = 1;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyFuLi', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.loginTimeOut);
+                        xGame.uiMgr.Show(UIMsg, msg);
+                        return;
+                    }
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                        DataMgr.getUserZiChanInfo();
+                        this.closeSelf();
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
         }
     }
     UIFuli1.uiName = "UIFuli1";
@@ -7002,7 +7092,42 @@
             this.hide();
         }
         gotoBuy() {
-            this.hide();
+            let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.productId = 2;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyFuLi', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.loginTimeOut);
+                        xGame.uiMgr.Show(UIMsg, msg);
+                        return;
+                    }
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                        DataMgr.getUserZiChanInfo();
+                        this.closeSelf();
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
         }
     }
     UIFuli2.uiName = "UIFuli2";
@@ -18477,6 +18602,26 @@
             this.userData.ballRod[index] = val;
             this.saveUserData();
         }
+        static setBallRodFormServer(haveQiuGanJsonStr) {
+            if (!haveQiuGanJsonStr) {
+                console.log("setBallRodFormServer数据为空或未定义");
+                return;
+            }
+            let haveQiuGanJsonObj = JSON.parse(haveQiuGanJsonStr);
+            const keys = Object.keys(haveQiuGanJsonObj);
+            keys.forEach(key => {
+                let v = haveQiuGanJsonObj[key];
+                let k = parseInt(key);
+                let idx = k - 1;
+                console.log('zh:更新IDX = ' + idx);
+                console.log('this.userData.ballRod[idx]===' + this.userData.ballRod[idx]);
+                if (this.userData.ballRod[idx] === 0) {
+                    console.log('zh: uuuuu  ' + (k - 1));
+                    this.userData.ballRod[k - 1] = 1;
+                    this.saveUserData();
+                }
+            });
+        }
         static getCurBallRod() {
             return this.userData.curBallRod;
         }
@@ -18637,7 +18782,7 @@
                     let data = res.data;
                     if (code == 401) {
                         Laya.LocalStorage.setItem(keyForLoginInfo, null);
-                        alert('Please log in.');
+                        alert(TIP_MSG_key.pleaseLoginIn);
                         return;
                     }
                     if (code == 200) {
@@ -18667,6 +18812,11 @@
                     console.log('zh:buySp res = ' + JSON.stringify(res));
                     let code = res.code;
                     let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.pleaseLoginIn);
+                        return;
+                    }
                     if (code == 200) {
                         let d = res.data;
                         let zuanShi = d.zuanShi;
@@ -18674,6 +18824,8 @@
                         let haveQiuGanJson = d.haveQiuGanJson;
                         DataMgr.setDiamondFormServer(zuanShi);
                         DataMgr.setCoinFormServer(jinBi);
+                        console.log('zh:更新球杆信息');
+                        DataMgr.setBallRodFormServer(haveQiuGanJson);
                     }
                     else {
                         alert(msg);
@@ -22707,6 +22859,7 @@
                     let data = cfgTable.ballrodData[this.index + 1];
                     let need = data.price;
                     if (DataMgr.diamondEnough(need)) {
+                        this.buyQiuGan(data);
                         DataMgr.setDiamond(-need);
                         DataMgr.setBallRod(this.index, 1);
                         DataMgr.setCurBallRod(this.index);
@@ -22722,6 +22875,44 @@
                     break;
             }
         }
+        buyQiuGan(qgItem) {
+            console.log('zh:buyQiuGan=' + JSON.stringify(qgItem));
+            let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg$1, TIP_MSG_key.pleaseLoginIn);
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.qiuGanData = qgItem;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyQiuGan', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.loginTimeOut);
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                        return;
+                    }
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                        DataMgr.getUserZiChanInfo();
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
+        }
         logEventForGouMaiGan(qiuGanName) {
             const ev = {
                 value: qiuGanName
@@ -22759,7 +22950,7 @@
             console.log('zh:点击购买 djItem =' + JSON.stringify(djItem));
             let userInfo = LocalStorageManager.getItem('userInfo');
             if (userInfo == null) {
-                xGame.uiMgr.Show(UIMsg$1, 'Please log in to your account .');
+                xGame.uiMgr.Show(UIMsg$1, TIP_MSG_key.pleaseLoginIn);
                 return;
             }
             let reqData = xGame.httpMgr.getReqData();
@@ -22771,8 +22962,14 @@
                     console.log('zh:buySp res = ' + JSON.stringify(res));
                     let code = res.code;
                     let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.pleaseLoginIn);
+                        return;
+                    }
                     if (code == 200) {
                         xGame.uiMgr.Show(UIMsg$1, msg);
+                        DataMgr.getUserZiChanInfo();
                     }
                     else {
                         xGame.uiMgr.Show(UIMsg$1, msg);
@@ -22826,6 +23023,11 @@
                 try {
                     let code = res.code;
                     let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.pleaseLoginIn);
+                        return;
+                    }
                     if (code == 200) {
                         let data = res.data;
                         for (let index = 0; index < data.length; index++) {
@@ -23438,7 +23640,42 @@
             this.hide();
         }
         gotoBuy() {
-            this.hide();
+            let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg$1, TIP_MSG_key.pleaseLoginIn);
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.productId = 1;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyFuLi', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.loginTimeOut);
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                        return;
+                    }
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                        DataMgr.getUserZiChanInfo();
+                        this.closeSelf();
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
         }
     }
     UIFuli1$1.uiName = "UIFuli1";
@@ -23463,7 +23700,42 @@
             this.hide();
         }
         gotoBuy() {
-            this.hide();
+            let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg$1, TIP_MSG_key.pleaseLoginIn);
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.productId = 2;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyFuLi', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 401) {
+                        Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                        alert(TIP_MSG_key.loginTimeOut);
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                        return;
+                    }
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                        DataMgr.getUserZiChanInfo();
+                        this.closeSelf();
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
         }
     }
     UIFuli2$1.uiName = "UIFuli2";

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
client/laya/bin/js/bundle.js.map


+ 1 - 1
client/laya/bin/js/cfgTable.js

@@ -62,7 +62,7 @@ cfgTable.aiskillData = {
         skilllevel: [6, 9],
     },
 }
-//ballrod表数据
+//ballrod表数据,需要于数据库中的一致
 cfgTable.ballrodData = {
     [1]: {
         id: 1,

+ 50 - 2
client/laya/src/data/DataMgr.ts

@@ -1,7 +1,10 @@
-import { CHANGE_SECRETARY, COIN_CHANGE, DIAMOND_CHANGE, POWER_CHANGE, keyForLoginInfo } from "../data/Define";
+import { CHANGE_SECRETARY, COIN_CHANGE, DIAMOND_CHANGE, POWER_CHANGE, keyForLoginInfo, TIP_MSG_key } from "../data/Define";
 import { xGame } from "../xGame";
 import { GameData, ItemData, UserData, Diy2025GameData } from "./Data"
 
+
+//import { LocalStorageManager } from "../utils/LocalStorageManager";
+
 export default class DataMgr {
     public static isNewUser: boolean = false;
     public static fristEnter: boolean = true;
@@ -497,6 +500,39 @@ export default class DataMgr {
         this.userData.ballRod[index] = val;
         this.saveUserData();
     }
+    /**
+     * 根据数据库中的球杆数据更新本地数据
+     * @param haveQiuGanJsonObj 
+     */
+    public static setBallRodFormServer(haveQiuGanJsonStr) {
+        if (!haveQiuGanJsonStr) {
+            // 处理 null、undefined、空字符串、0 等情况
+            console.log("setBallRodFormServer数据为空或未定义");
+            return;
+        }
+
+        let haveQiuGanJsonObj = JSON.parse(haveQiuGanJsonStr);
+        //   public ballRod: Array<number> = [1, 0, 0, 0, 0, 1];
+        //haveQiuGanJsonObj==demo =   {"4": 1, "5": 1}
+        // 获取对象的所有键
+        const keys = Object.keys(haveQiuGanJsonObj);
+        // console.log("keys count:", keys.length);
+        keys.forEach(key => {
+            let v = haveQiuGanJsonObj[key];
+            //  console.log("key:", key, "value:", v);
+            //key 就是球杆的id 就是:123456  v=是否拥有(购买)
+            let k = parseInt(key);
+            let idx = k - 1;
+            console.log('zh:更新IDX = '+idx)
+            console.log('this.userData.ballRod[idx]==='+this.userData.ballRod[idx])
+            if (this.userData.ballRod[idx] === 0) {
+                console.log('zh: uuuuu  ' + (k - 1))
+                this.userData.ballRod[k - 1] = 1;//标识拥有
+                this.saveUserData();
+            }
+        });
+    }
+
     //
     public static getCurBallRod() {
         return this.userData.curBallRod;
@@ -694,7 +730,7 @@ export default class DataMgr {
                 let data = res.data;
                 if (code == 401) {
                     Laya.LocalStorage.setItem(keyForLoginInfo, null);
-                    alert('Please log in.');
+                    alert(TIP_MSG_key.pleaseLoginIn);
                     //import UIMsg from "./UIMsg";
                     //xGame.uiMgr.Show(UIMsg, msg)
                     return;
@@ -717,6 +753,7 @@ export default class DataMgr {
 
     /**
      * 获取用户资产信息,此次应该会被经常调用,所以后期需要挪走到模块中
+     * 
      */
     public static getUserZiChanInfo() {
         console.log('zh:开始获取用户资产信息');
@@ -733,13 +770,24 @@ export default class DataMgr {
                 console.log('zh:buySp res = ' + JSON.stringify(res))
                 let code = res.code;
                 let msg = res.msg;
+                if (code == 401) {
+                    Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                    alert(TIP_MSG_key.pleaseLoginIn);
+                    //import UIMsg from "./UIMsg";
+                    //xGame.uiMgr.Show(UIMsg, msg)
+                    return;
+                }
                 if (code == 200) {
                     let d = res.data;
                     let zuanShi = d.zuanShi;
                     let jinBi = d.jinBi;
+                    ///
                     let haveQiuGanJson = d.haveQiuGanJson;
+                    ///
                     DataMgr.setDiamondFormServer(zuanShi);
                     DataMgr.setCoinFormServer(jinBi);
+                    console.log('zh:更新球杆信息')
+                    DataMgr.setBallRodFormServer(haveQiuGanJson);
                     // "noAdAll": 0,
                     // "noAdChaping": 0,
                     // "noAdJiangli": 0,

+ 9 - 0
client/laya/src/data/Define.ts

@@ -48,6 +48,15 @@ export let POWER_TIME = "POWER_TIME";
  * 账号登录,本地报错信息KEY
  */
 export let keyForLoginInfo="userInfo";
+/**
+ * 提示信息
+ */
+export let TIP_MSG_key = {
+    /**登录超时,请重新登录 */
+    loginTimeOut: "Login timed out, please log in again.",
+    /**请登录账号 */
+    pleaseLoginIn: "Please log in."
+}
 
 
 //url链接

+ 45 - 3
client/laya/src/ui/UIFuli1.ts

@@ -1,6 +1,11 @@
 import UIBase from "../fgui/core/UIBase";
 import ui_UIFuli1 from "../fgui/res/game/ui_UIFuli1";
-
+import { LocalStorageManager } from "../utils/LocalStorageManager";
+import UIMsg from "./UIMsg";
+import { xGame } from "../xGame";
+import { keyForLoginInfo, TIP_MSG_key } from "../data/Define";
+import { GameData } from "../data/Data";
+import DataMgr from "../data/DataMgr";
 export default class UIFuli1 extends UIBase {
     protected ui: ui_UIFuli1;
 
@@ -24,8 +29,45 @@ export default class UIFuli1 extends UIBase {
         this.hide();
     }
     gotoBuy() {
-        this.hide();
-       
+        let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+        if (userInfo == null) {
+            xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
+            // JSBridgeUtils.instance.showToast2(TIP_MSG_key.pleaseLoginIn);
+            return;
+        }
+        let reqData = xGame.httpMgr.getReqData();
+        let pd: any = JSON.parse(reqData);
+        pd.productId = 1;
+        reqData = JSON.stringify(pd);
+        xGame.httpMgr.sendPost2025('user/buyFuLi', reqData, (res) => {
+            try {
+                console.log('zh:buySp res = ' + JSON.stringify(res))
+                let code = res.code;
+                let msg = res.msg;
+                if (code == 401) {
+                    Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                    alert(TIP_MSG_key.loginTimeOut);
+                    xGame.uiMgr.Show(UIMsg, msg)
+                    return;
+                }
+                if (code == 200) {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                    DataMgr.getUserZiChanInfo();
+                    this.closeSelf();
+                } else {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                }
+                // if (Laya.Browser.onAndroid) {
+                //     JSBridgeUtils.instance.showToast2(msg);
+                // }
+            } catch (error) {
+                console.log('error=' + error);
+                alert(error);
+            } finally {
+
+            }
+        });
+
     }
 }
 UIFuli1.uiName = "UIFuli1";

+ 44 - 1
client/laya/src/ui/UIFuli2.ts

@@ -1,6 +1,12 @@
 import UIBase from "../fgui/core/UIBase";
 import ui_UIFuli2 from "../fgui/res/game/ui_UIFuli2";
+import UIMsg from "./UIMsg";
+import { xGame } from "../xGame";
+import { LocalStorageManager } from "../utils/LocalStorageManager";
+import { keyForLoginInfo, TIP_MSG_key } from "../data/Define";
 
+import { GameData } from "../data/Data";
+import DataMgr from "../data/DataMgr";
 export default class UIFuli2 extends UIBase {
     protected ui: ui_UIFuli2;
 
@@ -24,7 +30,44 @@ export default class UIFuli2 extends UIBase {
         this.hide();
     }
     gotoBuy() {
-        this.hide();
+        let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+        if (userInfo == null) {
+            xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
+            // JSBridgeUtils.instance.showToast2(TIP_MSG_key.pleaseLoginIn);
+            return;
+        }
+        let reqData = xGame.httpMgr.getReqData();
+        let pd: any = JSON.parse(reqData);
+        pd.productId = 2;
+        reqData = JSON.stringify(pd);
+        xGame.httpMgr.sendPost2025('user/buyFuLi', reqData, (res) => {
+            try {
+                console.log('zh:buySp res = ' + JSON.stringify(res))
+                let code = res.code;
+                let msg = res.msg;
+                if (code == 401) {
+                    Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                    alert(TIP_MSG_key.loginTimeOut);
+                    xGame.uiMgr.Show(UIMsg, msg)
+                    return;
+                }
+                if (code == 200) {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                    DataMgr.getUserZiChanInfo();
+                    this.closeSelf();
+                } else {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                }
+                // if (Laya.Browser.onAndroid) {
+                //     JSBridgeUtils.instance.showToast2(msg);
+                // }
+            } catch (error) {
+                console.log('error=' + error);
+                alert(error);
+            } finally {
+
+            }
+        });
 
     }
 }

+ 12 - 4
client/laya/src/ui/UIShop.ts

@@ -7,6 +7,7 @@ import BallRodDisplay from "./item/BallRodDisplay";
 import DaoJuDisplay from "./item/DaoJuDisplay";
 import MoneyNode from "./item/MoneyNode";
 import UIMsg from "../ui/UIMsg";
+import { keyForLoginInfo, TIP_MSG_key } from "../data/Define";
 export default class UIShop extends UIBase {
     protected ui: ui_UIShop;
     public moneyNode: MoneyNode;
@@ -40,14 +41,14 @@ export default class UIShop extends UIBase {
 
         this.loadDjdata_old();
 
-        
+
         //this.getProductList();
 
     }
     private loadDjdata_old() {
         //道具数据----------------start
         let fff = cfgTable.daoJuData;
-      //  console.log('zh:fff=' + JSON.stringify(fff));
+        //  console.log('zh:fff=' + JSON.stringify(fff));
         //{"1":{"id":1,"spbt":"Gem50","spjg":0.99,"spms":"Gem50","img":"sp_zs1","sort":1},"2":{"id":1,"spbt":"Gem100","spjg":1.99,"spms":"Gem100","img":"sp_zs2","sort":2},"3":{"id":1,"spbt":"Gem150","spjg":3.99,"spms":"Gem150","img":"sp_zs3","sort":3}}
         this.ui.myNode.djList.itemRenderer = Laya.Handler.create(this, this.renderDaoJu, null, false);
         this.daoJuArr = [];
@@ -64,16 +65,23 @@ export default class UIShop extends UIBase {
         reqData = JSON.stringify(pd);
         xGame.httpMgr.sendPost2025('game2/getProductList', reqData, (res) => {
             try {
-              //  console.log('zh:res = ' + JSON.stringify(res))
+                //  console.log('zh:res = ' + JSON.stringify(res))
                 let code = res.code;
                 let msg = res.msg;
+                if (code == 401) {
+                    Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                    alert(TIP_MSG_key.pleaseLoginIn);
+                    //import UIMsg from "./UIMsg";
+                    //xGame.uiMgr.Show(UIMsg, msg)
+                    return;
+                }
                 if (code == 200) {
                     let data = res.data;
                     for (let index = 0; index < data.length; index++) {
                         let element = data[index];
                         cfgTable.daoJuData[element.spid] = element;
                     }
-                    console.log("fffddd="+JSON.stringify(cfgTable.daoJuData))
+                    console.log("fffddd=" + JSON.stringify(cfgTable.daoJuData))
                 } else {
                     xGame.uiMgr.Show(UIMsg, msg)
                 }

+ 53 - 5
client/laya/src/ui/item/BallRodDisplay.ts

@@ -2,10 +2,13 @@ import SpineMgr from "../../core/mgrs/SpineMgr";
 import DataMgr from "../../data/DataMgr";
 import ui_BallRodDisplay from "../../fgui/res/game/ui_BallRodDisplay";
 import { xGame } from "../../xGame";
+import UIMsg from "../UIMsg";
 import UIAddProp from "../UIAddProp";
 import UIShop from "../UIShop";
 import JSBridgeUtils from "../../utils/JSBridgeUtils";
-
+import { keyForLoginInfo, TIP_MSG_key } from "../../data/Define";
+import { LocalStorageManager } from "../../utils/LocalStorageManager";
+import { GameData } from "../../data/Data";
 export default class BallRodDisplay {
     public ui: ui_BallRodDisplay;
     //
@@ -54,14 +57,13 @@ export default class BallRodDisplay {
         }
     }
     buyBallRod() {
-
         xGame.soundMgr.playSound(xGame.common.btnClickStr);
         let selectedIndex = this.ui.purchaseBtn.c1.selectedIndex;
         switch (selectedIndex) {
-            case 0:
+            case 0://使用中
                 //  console.log('zh:点击了 000000000000000');
                 break;
-            case 1:
+            case 1://点击使用
                 console.log('zh:点击了 USE THIS');
                 DataMgr.setCurBallRod(this.index);
 
@@ -73,11 +75,12 @@ export default class BallRodDisplay {
                 let ui = <UIShop>xGame.uiMgr.getUI(UIShop);
                 ui.updateBallRod();
                 break;
-            case 2:
+            case 2: //钻石购买
                 // console.log('zh:点击了 2222222222222');
                 let data = cfgTable.ballrodData[this.index + 1];
                 let need = data.price;
                 if (DataMgr.diamondEnough(need)) {
+                    this.buyQiuGan(data);
                     DataMgr.setDiamond(-need);
                     //
                     DataMgr.setBallRod(this.index, 1);
@@ -96,6 +99,51 @@ export default class BallRodDisplay {
                 break;
         }
     }
+    /**
+     * 保存球杆到数据库
+     * @param item 
+     */
+    buyQiuGan(qgItem) {
+        console.log('zh:buyQiuGan=' + JSON.stringify(qgItem));
+        let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
+        if (userInfo == null) {
+            xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
+            // JSBridgeUtils.instance.showToast2(TIP_MSG_key.pleaseLoginIn);
+            return;
+        }
+        let reqData = xGame.httpMgr.getReqData();
+        let pd: any = JSON.parse(reqData);
+        pd.qiuGanData = qgItem;
+        reqData = JSON.stringify(pd);
+        xGame.httpMgr.sendPost2025('user/buyQiuGan', reqData, (res) => {
+            try {
+                console.log('zh:buySp res = ' + JSON.stringify(res))
+                let code = res.code;
+                let msg = res.msg;
+                if (code == 401) {
+                    Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                    alert(TIP_MSG_key.loginTimeOut);
+                    xGame.uiMgr.Show(UIMsg, msg)
+                    return;
+                }
+                if (code == 200) {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                    DataMgr.getUserZiChanInfo();
+                } else {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                }
+                // if (Laya.Browser.onAndroid) {
+                //     JSBridgeUtils.instance.showToast2(msg);
+                // }
+            } catch (error) {
+                console.log('error=' + error);
+                alert(error);
+            } finally {
+
+            }
+        });
+    }
+
 
 
 

+ 12 - 5
client/laya/src/ui/item/DaoJuDisplay.ts

@@ -7,6 +7,7 @@ import UIShop from "../UIShop";
 import UIMsg from "../UIMsg";
 import JSBridgeUtils from "../../utils/JSBridgeUtils";
 import ui_daoJuDisplay from "../../fgui/res/game/ui_daoJuDisplay";
+import { keyForLoginInfo, TIP_MSG_key } from "../../data/Define";
 import { LocalStorageManager } from "../../utils/LocalStorageManager";
 export default class DaoJuDisplay {
     public ui: ui_daoJuDisplay;
@@ -43,8 +44,8 @@ export default class DaoJuDisplay {
         console.log('zh:点击购买 djItem =' + JSON.stringify(djItem));
         let userInfo = LocalStorageManager.getItem('userInfo');
         if (userInfo == null) {
-            xGame.uiMgr.Show(UIMsg, 'Please log in to your account .');
-            // JSBridgeUtils.instance.showToast2('Please log in to your account .');
+            xGame.uiMgr.Show(UIMsg, TIP_MSG_key.pleaseLoginIn);
+            // JSBridgeUtils.instance.showToast2(TIP_MSG_key.pleaseLoginIn);
             return;
         }
         let reqData = xGame.httpMgr.getReqData();
@@ -56,11 +57,17 @@ export default class DaoJuDisplay {
                 console.log('zh:buySp res = ' + JSON.stringify(res))
                 let code = res.code;
                 let msg = res.msg;
+                if (code == 401) {
+                    Laya.LocalStorage.setItem(keyForLoginInfo, null);
+                    alert(TIP_MSG_key.pleaseLoginIn);
+                    //import UIMsg from "./UIMsg";
+                    //xGame.uiMgr.Show(UIMsg, msg)
+                    return;
+                }
                 if (code == 200) {
                     xGame.uiMgr.Show(UIMsg, msg)
-                    //todo:之后开始重新从服务器获取用户资产信息
-
-
+                    //之后开始重新从服务器获取用户资产信息
+                    DataMgr.getUserZiChanInfo();
                 } else {
                     xGame.uiMgr.Show(UIMsg, msg)
                 }

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio