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mCAAS,GAA8B,IAAI,yBAAyB,EAAE,CAAC;IAuE1F,gCAAC;KAAA;kBAzEoB,yBAAyB","file":"","sourceRoot":"/","sourcesContent":["import { channel, GameConfig } from \"../../GameConfig\";\nimport { HttpClient } from \"../../network/HttpClient\";\n\nexport default class CustomerServiceDataCenter {\n    /**单例对象 */\n    private static _instance: CustomerServiceDataCenter = new CustomerServiceDataCenter();\n    /**网络请求对象 */\n    private _httpObj: HttpClient = new HttpClient(\"\");\n    private _showCustomerServiceBtn: boolean = true;\n    private _tipLabel: string = \"\";\n    private _qrCodePath: string = \"\";\n\n    init() {\n        this.requestCooperationDataFromOSS();\n    }\n\n    /**获取数据中心单例对象 */\n    public static getInstance(): CustomerServiceDataCenter {\n        return CustomerServiceDataCenter._instance;\n    }\n\n    /**从oss上拉取配置文件 */\n    public async requestCooperationDataFromOSS() {\n        try {\n            let configPath = `https://weixingame.icesimba.com/weixingame/icesimba/${GameConfig.debug ? \"dev\" : \"release\"}/customerService/${channel}/${GameConfig.gameId}/config.json`;\n            let resStr = await this._httpObj.get(configPath) as string;\n            let res = JSON.parse(resStr);\n            if (res) {\n                let items = res.items as { showCustomerServiceBtn: boolean, tipLabel: string, qrCodeImg: string }[];\n                if (items) {\n                    for (let i = 0; i < items.length; i++) {\n                        let item = items[i];\n                        if (item && item.qrCodeImg && \"\" !== item.qrCodeImg) {\n                            if (item.showCustomerServiceBtn) {\n                                this._showCustomerServiceBtn = item.showCustomerServiceBtn;\n                            }\n                            if (item.tipLabel) {\n                                this._tipLabel = item.tipLabel;\n                            }\n                            if (item.qrCodeImg) {\n                                this._qrCodePath = item.qrCodeImg;\n                            }\n                        }\n                    }\n                }\n            }\n        } catch (e) {\n            console.error(e);\n        }\n    }\n    /**刷新QRCode */\n    refreshQRCode(imgPath: string, spr: cc.Sprite): Promise<any> {\n        return new Promise<any>((resolve, reject) => {\n            let path: string = `https://weixingame.icesimba.com/weixingame/icesimba/${GameConfig.debug ? \"dev\" : \"release\"}/customerService/${channel}/${GameConfig.gameId}/${imgPath}`;\n            cc.assetManager.loadRemote(path, (err, sprite) => {\n                if (err) {\n                    reject(err)\n                } else {\n                    spr.spriteFrame = new cc.SpriteFrame(sprite);\n                    resolve(true)\n                }\n            });\n        })\n    }\n\n    getShowCustomerServiceBtn(): boolean {\n        return this._showCustomerServiceBtn;\n    }\n\n    getTipLabel(): string {\n        return this._tipLabel;\n    }\n\n    getQRCodePath(): string {\n        return this._qrCodePath;\n    }\n}\n"]}