fix(shop): 修改道具不存在时的提示信息 (#2061)
Some checks failed
检查bot是否运行正常 / bot check (push) Has been cancelled
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
Sequential Lint and Type Check / ruff-call (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Force Sync to Aliyun / sync (push) Has been cancelled
Update Version / update-version (push) Has been cancelled
Sequential Lint and Type Check / pyright-call (push) Has been cancelled

- 将道具不存在时的提示信息从具体的道具名称改为通用提示,避免暴露内部实现细节,
提升用户体验和安全性。
- resolve Bug: 使用道具功能优化
Fixes #2060
This commit is contained in:
molanp 2025-10-09 09:01:20 +08:00 committed by GitHub
parent 74a9f3a843
commit 1cc18bb195
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -367,7 +367,7 @@ class ShopManage:
else: else:
goods_info = await GoodsInfo.get_or_none(goods_name=goods_name) goods_info = await GoodsInfo.get_or_none(goods_name=goods_name)
if not goods_info: if not goods_info:
return f"{goods_name} 不存在..." return "对应的道具不存在..."
if goods_info.is_passive: if goods_info.is_passive:
return f"{goods_info.goods_name} 是被动道具, 无法使用..." return f"{goods_info.goods_name} 是被动道具, 无法使用..."
goods = cls.uuid2goods.get(goods_info.uuid) goods = cls.uuid2goods.get(goods_info.uuid)