fix bug
This commit is contained in:
1 parent
ec96465a96
commit
360e2cd20d
3 files changed
+10
-6
No files matched your search
@@ -107,6 +107,7 @@ async def recharge_balance(
|
||||
transaction_id = hashlib.md5(f"{timestamp}{user_id}{balance}{typ}".encode('utf-8')).hexdigest()
|
||||
if payment_service.check_transaction_id_exists(transaction_id):
|
||||
return ResponseUtils.error(message="Transaction ID already exists")
|
||||
print(f"user_id: {user_id}, amount: {balance}, typ: {typ}, transaction_id: {transaction_id}")
|
||||
success = payment_service.platform_payment(user_id=user_id, amount=balance, typ=typ, transaction_id=transaction_id)
|
||||
if not success:
|
||||
return ResponseUtils.error(message="Failed to recharge wallet balance")
|
||||
|
||||
@@ -266,7 +266,6 @@ class McpManagerService:
|
||||
|
||||
# Get service's API list
|
||||
apis = self.mcp_tool_api_repository.get_by_service_id(id)
|
||||
|
||||
# Build return data
|
||||
service_info = {
|
||||
"id": service.id,
|
||||
@@ -274,7 +273,7 @@ class McpManagerService:
|
||||
"short_description": service.short_description,
|
||||
"long_description": service.long_description,
|
||||
"base_url": service.base_url,
|
||||
"auth_method": service.auth_method.value if service.auth_method else None,
|
||||
"auth_method": service.auth_method.value if service.auth_method != AuthMethod.FREE else "none",
|
||||
"auth_header": service.auth_header,
|
||||
"auth_token": service.auth_token,
|
||||
"charge_type": service.charge_type.value if service.charge_type else None,
|
||||
|
||||
@@ -188,8 +188,10 @@ class PaymentService:
|
||||
amount = history.amount
|
||||
user_wallet = self.user_wallet_repository.get_by_user_id(user_id)
|
||||
if not user_wallet:
|
||||
logger.error(f"User wallet not found for user_id {user_id}")
|
||||
return False
|
||||
user_wallet = self.user_wallet_repository.create(user_id=user_id)
|
||||
if not user_wallet:
|
||||
logger.error(f"Failed to create wallet for user_id {user_id}")
|
||||
return False
|
||||
|
||||
# Retry mechanism for optimistic locking
|
||||
for attempt in range(max_retries):
|
||||
@@ -246,8 +248,10 @@ class PaymentService:
|
||||
# Validate user wallet exists
|
||||
user_wallet = self.user_wallet_repository.get_by_user_id(user_id)
|
||||
if not user_wallet:
|
||||
logger.error(f"User wallet not found for user_id {user_id}")
|
||||
return False
|
||||
user_wallet = self.user_wallet_repository.create(user_id=user_id)
|
||||
if not user_wallet:
|
||||
logger.error(f"Failed to create wallet for user_id {user_id}")
|
||||
return False
|
||||
|
||||
# Retry mechanism for optimistic locking
|
||||
for attempt in range(max_retries):
|
||||
|
||||
Reference in new issue
Block a user