Compare commits

...

1 Commits

Author SHA1 Message Date
repair-agent
4dd56ce58c fix: auto repair bugs #41, #40, #39 2026-02-25 15:22:29 +08:00
3 changed files with 3 additions and 3 deletions

View File

@ -174,7 +174,7 @@ def list_all_devices_admin(request):
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
page_size = int(request.GET.get('page_size', 20)) page_size = int(request.GET.get('page_size', 20))
start = page * page_size start = (page - 1) * page_size
total = qs.count() total = qs.count()
items = [_serialize_device(d) for d in qs[start:start + page_size]] items = [_serialize_device(d) for d in qs[start:start + page_size]]

View File

@ -136,7 +136,7 @@ class PaymentService:
Returns: Returns:
Decimal: 退款金额 Decimal: 退款金额
""" """
if refund_ratio < 0: if not (0 < refund_ratio <= 1):
raise ValueError(f'退款比例不能为负数: refund_ratio={refund_ratio}') raise ValueError(f'退款比例不能为负数: refund_ratio={refund_ratio}')
amount = Decimal(str(paid_amount)) * Decimal(str(refund_ratio)) amount = Decimal(str(paid_amount)) * Decimal(str(refund_ratio))

View File

@ -101,6 +101,6 @@ class UserService:
qs = qs.filter(phone__contains=phone) qs = qs.filter(phone__contains=phone)
if nickname: if nickname:
qs = qs.filter(nickname__contains=nickname) qs = qs.filter(nickname__contains=nickname)
if is_active: if is_active is not None:
qs = qs.filter(is_active=is_active) qs = qs.filter(is_active=is_active)
return qs return qs