Merge branch 'main' into dev: 同步充值渠道切换修复
This commit is contained in:
@@ -140,6 +140,32 @@ class TestDouyuGoldRechargeChannel:
|
|||||||
|
|
||||||
assert channel == {"gold_recharge_channel": "supplier_api"}
|
assert channel == {"gold_recharge_channel": "supplier_api"}
|
||||||
|
|
||||||
|
def test_update_config_switching_recharge_channel_and_peace_enabled(self):
|
||||||
|
from web.backend.routers.douyu import update_config
|
||||||
|
from web.backend.schemas import DouyuConfigUpdate
|
||||||
|
|
||||||
|
admin_user = self.session.get(User, self.task.created_by)
|
||||||
|
|
||||||
|
# 1. 切换到 supplier_api
|
||||||
|
req = DouyuConfigUpdate(
|
||||||
|
gold_recharge_channel="supplier_api",
|
||||||
|
peace_enabled=True,
|
||||||
|
)
|
||||||
|
res = update_config(req, db=self.session, current=admin_user)
|
||||||
|
dumped = res.model_dump()
|
||||||
|
assert dumped["gold_recharge_channel"] == "supplier_api"
|
||||||
|
assert dumped["peace_enabled"] is True
|
||||||
|
|
||||||
|
# 2. 切换回 wechat_qr
|
||||||
|
req2 = DouyuConfigUpdate(
|
||||||
|
gold_recharge_channel="wechat_qr",
|
||||||
|
peace_enabled=False,
|
||||||
|
)
|
||||||
|
res2 = update_config(req2, db=self.session, current=admin_user)
|
||||||
|
dumped2 = res2.model_dump()
|
||||||
|
assert dumped2["gold_recharge_channel"] == "wechat_qr"
|
||||||
|
assert dumped2["peace_enabled"] is False
|
||||||
|
|
||||||
def test_recharge_audit_detail_includes_safe_account_identity(self):
|
def test_recharge_audit_detail_includes_safe_account_identity(self):
|
||||||
record_audit(
|
record_audit(
|
||||||
self.session,
|
self.session,
|
||||||
|
|||||||
@@ -414,6 +414,7 @@ def _task_out(task: DouyuTask, *, include_detail: bool = False) -> DouyuTaskOut:
|
|||||||
def _config_out(config: DouyuConfig) -> DouyuConfigOut:
|
def _config_out(config: DouyuConfig) -> DouyuConfigOut:
|
||||||
text = lambda field: str(douyu_config_value(field, getattr(config, field)))
|
text = lambda field: str(douyu_config_value(field, getattr(config, field)))
|
||||||
number = lambda field: int(douyu_config_value(field, getattr(config, field)))
|
number = lambda field: int(douyu_config_value(field, getattr(config, field)))
|
||||||
|
boolean = lambda field: bool(douyu_config_value(field, getattr(config, field)))
|
||||||
return DouyuConfigOut(
|
return DouyuConfigOut(
|
||||||
manual_id=text("manual_id"),
|
manual_id=text("manual_id"),
|
||||||
rid=text("rid"),
|
rid=text("rid"),
|
||||||
@@ -429,6 +430,7 @@ def _config_out(config: DouyuConfig) -> DouyuConfigOut:
|
|||||||
esports_chicken_skin_id=text("esports_chicken_skin_id"),
|
esports_chicken_skin_id=text("esports_chicken_skin_id"),
|
||||||
esports_firework_gift_id=text("esports_firework_gift_id"),
|
esports_firework_gift_id=text("esports_firework_gift_id"),
|
||||||
esports_firework_skin_id=text("esports_firework_skin_id"),
|
esports_firework_skin_id=text("esports_firework_skin_id"),
|
||||||
|
peace_enabled=boolean("peace_enabled"),
|
||||||
xpd_act_alias=text("xpd_act_alias"),
|
xpd_act_alias=text("xpd_act_alias"),
|
||||||
xpd_act_id=text("xpd_act_id"),
|
xpd_act_id=text("xpd_act_id"),
|
||||||
xpd_rid=text("xpd_rid"),
|
xpd_rid=text("xpd_rid"),
|
||||||
|
|||||||
Reference in New Issue
Block a user