pzx-web-api/app/api/v1/auth.py
BryantHe d4a5735d57
All checks were successful
continuous-integration/drone/push Build is passing
fix: bug
2023-08-11 16:55:29 +08:00

25 lines
656 B
Python

from apiflask import APIBlueprint
from app import rpc
from app.api.v1.schema.auth import WechatLoginIn, WechatLoginOut, RefreshTokenIn, RefreshTokenOut
auth = APIBlueprint('auth', __name__)
@auth.post('/wechat_login')
@auth.input(WechatLoginIn)
@auth.output(WechatLoginOut)
def wechat_login(json_data):
try:
result = rpc.admin.wechat_login(json_data['code'])
except Exception as e:
raise e
return result
@auth.get('/refresh_token')
@auth.input(RefreshTokenIn, location='query')
@auth.output(RefreshTokenOut)
def refresh_token(query_data):
result = rpc.admin.refresh_token(query_data['refresh_token'])
return result