feat(chat、pay): 增加pay沙盒、移除杂项
This commit is contained in:
26
core/app.py
26
core/app.py
@@ -41,10 +41,6 @@ def create_app() -> FastAPI:
|
||||
for router in routers:
|
||||
app.include_router(router)
|
||||
|
||||
if settings.ENVIRONMENT != 'prod':
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
app.mount("/uploads", StaticFiles(directory="uploads"), name="uploads")
|
||||
|
||||
@app.on_event('startup')
|
||||
async def startup_event():
|
||||
redis_conn = await get_cache()
|
||||
@@ -80,16 +76,16 @@ def create_app() -> FastAPI:
|
||||
}
|
||||
)
|
||||
|
||||
# @app.exception_handler(Exception)
|
||||
# async def http_exception_handler(request: Request, exc: Exception):
|
||||
# await exception_log(request, exc)
|
||||
# return UJSONResponse(
|
||||
# status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
# content={
|
||||
# 'status': status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
# 'data': None,
|
||||
# 'message': 'Internal server error'
|
||||
# }
|
||||
# )
|
||||
@app.exception_handler(Exception)
|
||||
async def http_exception_handler(request: Request, exc: Exception):
|
||||
await exception_log(request, exc)
|
||||
return UJSONResponse(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
content={
|
||||
'status': status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
'data': None,
|
||||
'message': 'Internal server error'
|
||||
}
|
||||
)
|
||||
|
||||
return app
|
||||
|
||||
@@ -6,11 +6,7 @@
|
||||
# @Desc :
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import List, Dict
|
||||
|
||||
import redis.asyncio as aioredis
|
||||
from fastapi import WebSocket
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from core.db.crud import CRUD
|
||||
@@ -86,7 +82,7 @@ async def send_new_message(
|
||||
)
|
||||
|
||||
await socket_manager.broadcast_to_chat(chat_guid, send_message_schema.model_dump_json())
|
||||
await websocket.send_json(send_status_replay.model_dump_json())
|
||||
await websocket.send_text(send_status_replay.model_dump_json())
|
||||
|
||||
|
||||
@socket_manager.handler('chat.message_read')
|
||||
|
||||
@@ -144,6 +144,8 @@ class WechatPayApi(BaseClient):
|
||||
self.appi_key = app_key
|
||||
self.notify_url = notify_url
|
||||
self.base_url = 'https://api.mch.weixin.qq.com'
|
||||
if debug:
|
||||
self.base_url = f'{self.base_url}/sandboxnew'
|
||||
super().__init__()
|
||||
|
||||
@staticmethod
|
||||
@@ -209,14 +211,6 @@ class WechatPayApi(BaseClient):
|
||||
|
||||
|
||||
wechat_pay_api = WechatPayApi(
|
||||
appid=settings.APPID, mch_id=settings.PAY_MCH_ID, app_key=settings.PAY_API_KEY, notify_url=settings.PAY_NOTIFY_URL
|
||||
appid=settings.APPID, mch_id=settings.PAY_MCH_ID, app_key=settings.PAY_API_KEY,
|
||||
notify_url=settings.PAY_NOTIFY_URL, debug=settings.DEBUG
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import asyncio
|
||||
|
||||
print(asyncio.run(decrypt_sensitive_data(
|
||||
session_key='uuLloEnWUpnOWkpB4Oyopw==',
|
||||
encrypted_data='Bzdx4BOZEJ10xf4fN2643OJaxHF/Wcj/Qv1q6M6L4MB0BBvKJRG3rlrGUYQd2nimCvDbDVPu+S3zUQidaOgyvBhDG4W0Oy8hgfeLALhqrzUo1AhTQvvxwQrntMHMRvqtdk1AzsiviaOEVGALYmuXneLD/XnGH8VzXaD2eiauzDQNCMtXVUUgB3QzIeqczr9xXSg2t6JB91m0kLs8a7FSsJAXhHIBk+58jKZjgxMUpzuJeJ/fu1Gez7q9o0iXYSVBO//KGpEVgWO0EPe4pINnwduZ3bbXF21UdRTzQ+GG2eYslXA2lespMlQWomwk5RbpVh+GWx/D29Tkprq17gkzeiiCHk9hIEHuY0+ausTbT+gOk/RG11qzYJL0nRT3uJr4GtAMKcqDV4Kmo9SThglwIg==',
|
||||
iv='Nr7pQgCBMextSzroXPNsIw=='
|
||||
)))
|
||||
|
||||
Reference in New Issue
Block a user