From 1ffc4ac6e71cd9639f4b82922292030ad9d496ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Mon, 29 Aug 2022 11:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivaDiceMaster/msgCustom.py | 6 ++++++ OlivaDiceMaster/msgCustomManager.py | 8 ++++++++ OlivaDiceMaster/webAPI.py | 11 +++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/OlivaDiceMaster/msgCustom.py b/OlivaDiceMaster/msgCustom.py index dd3d4aa..8bc56b1 100644 --- a/OlivaDiceMaster/msgCustom.py +++ b/OlivaDiceMaster/msgCustom.py @@ -18,6 +18,12 @@ import OlivaDiceCore import OlivaDiceMaster +dictConsoleSwitchTemplate = { + 'default' : { + 'masterAutoUpdate': 1 + } +} + dictStrCustomDict = {} dictStrCustom = { diff --git a/OlivaDiceMaster/msgCustomManager.py b/OlivaDiceMaster/msgCustomManager.py index c7c3b46..a32d3c5 100644 --- a/OlivaDiceMaster/msgCustomManager.py +++ b/OlivaDiceMaster/msgCustomManager.py @@ -34,3 +34,11 @@ def initMsgCustom(bot_info_dict): OlivaDiceCore.msgCustom.dictStrConst.update(OlivaDiceMaster.msgCustom.dictStrConst) OlivaDiceCore.msgCustom.dictGValue.update(OlivaDiceMaster.msgCustom.dictGValue) OlivaDiceCore.msgCustom.dictTValue.update(OlivaDiceMaster.msgCustom.dictTValue) + for dictConsoleSwitchTemplate_this in OlivaDiceMaster.msgCustom.dictConsoleSwitchTemplate: + if dictConsoleSwitchTemplate_this in OlivaDiceCore.console.dictConsoleSwitchTemplate: + OlivaDiceCore.console.dictConsoleSwitchTemplate[dictConsoleSwitchTemplate_this].update( + OlivaDiceMaster.msgCustom.dictConsoleSwitchTemplate[dictConsoleSwitchTemplate_this] + ) + OlivaDiceCore.console.initConsoleSwitchByBotDict(bot_info_dict) + OlivaDiceCore.console.readConsoleSwitch() + OlivaDiceCore.console.saveConsoleSwitch() diff --git a/OlivaDiceMaster/webAPI.py b/OlivaDiceMaster/webAPI.py index ecaa724..d4a1916 100644 --- a/OlivaDiceMaster/webAPI.py +++ b/OlivaDiceMaster/webAPI.py @@ -29,17 +29,24 @@ def init_getCheckAPI(botDict:dict): def getCheckAPI(botDict:dict): while True: try: + flagSkip = False webRes = None for botDict_this in botDict: + if OlivaDiceCore.console.getConsoleSwitchByHash( + 'masterAutoUpdate', + botDict_this + ) != 1: + flagSkip = True + break webRes = None webRes = OlivaDiceMaster.webTool.GETHttpJson2Dict('http://api.oliva.icu/checkout/?hash=%s' % str(botDict_this)) - if webRes == None: + if not flagSkip and webRes == None: if OlivaDiceMaster.data.globalProc != None: OlivaDiceMaster.data.globalProc.log(3, '访问更新检测接口失败!', [ ('OlivaDice', 'default'), ('autoupdate', 'default') ]) - if webRes != None and 'code' in webRes and webRes['code'] == 0: + if not flagSkip and webRes != None and 'code' in webRes and webRes['code'] == 0: if ( 'data' in webRes ) and (