mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-10-21 16:27:15 +08:00
commit
cf754de6bf
@ -18,16 +18,24 @@ class ConfigManager:
|
|||||||
:param value: 新配置值
|
:param value: 新配置值
|
||||||
"""
|
"""
|
||||||
if config_name not in cls.config.dict(by_alias=True).keys():
|
if config_name not in cls.config.dict(by_alias=True).keys():
|
||||||
return f'没有配置项为{config_name}'
|
return f"没有配置项为{config_name}"
|
||||||
if '启用' in config_name or '开关' in config_name or config_name in {'自动接受好友请求', '自动接受群邀请'}:
|
if (
|
||||||
if value not in ['开', '关', 'true', 'false', 'on', 'off']:
|
"启用" in config_name
|
||||||
return '参数错误'
|
or "开关" in config_name
|
||||||
value = value in ['开', 'true', 'on']
|
or config_name in {"自动接受好友请求", "自动接受群邀请", "绑定二维码以链接形式发送"}
|
||||||
elif config_name != 'CookieWeb地址' and not value.isdigit():
|
):
|
||||||
return '配置项不合法,必须为数字'
|
if value not in ["开", "关", "true", "false", "on", "off"]:
|
||||||
cls.config.update(config_name=value)
|
return "参数错误"
|
||||||
|
value = value in ["开", "true", "on"]
|
||||||
|
elif config_name == "重启时修改群名片群列表":
|
||||||
|
return "该配置项暂时不支持此方法修改,请在后台管理页面进行更改"
|
||||||
|
elif config_name not in ["CookieWeb地址", "Web端管理员密码", "Web端token密钥", "github资源地址"]:
|
||||||
|
if not value.isdigit():
|
||||||
|
return "配置项不合法,必须为数字"
|
||||||
|
value = int(value)
|
||||||
|
cls.config.update(**{config_name: value})
|
||||||
cls.save()
|
cls.save()
|
||||||
return f'成功设置{config_name}为{value}'
|
return f"成功设置{config_name}为{value}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def save(cls):
|
def save(cls):
|
||||||
|
@ -9,7 +9,7 @@ class ConfigModel(BaseModel):
|
|||||||
qrcode_bind_use_url: bool = Field(False, alias='绑定二维码以链接形式发送')
|
qrcode_bind_use_url: bool = Field(False, alias='绑定二维码以链接形式发送')
|
||||||
|
|
||||||
img_use_cache: bool = Field(True, alias='图片资源缓存开关')
|
img_use_cache: bool = Field(True, alias='图片资源缓存开关')
|
||||||
reboot_card_enable: List[int] = Field([], alias='启用重启时修改群名片群列表')
|
reboot_card_enable: List[int] = Field([], alias='重启时修改群名片群列表')
|
||||||
|
|
||||||
sim_gacha_cd_group: int = Field(30, alias='模拟抽卡群冷却')
|
sim_gacha_cd_group: int = Field(30, alias='模拟抽卡群冷却')
|
||||||
sim_gacha_cd_member: int = Field(60, alias='模拟抽卡群员冷却')
|
sim_gacha_cd_member: int = Field(60, alias='模拟抽卡群员冷却')
|
||||||
|
Loading…
Reference in New Issue
Block a user