41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
from flask import Blueprint, jsonify, request
|
|
from sdk_server.models.login.token_login_data import TokenLoginReq
|
|
from sdk_server.models.login.login_data import LoginRsp,Account
|
|
|
|
from database.account.account_data import find_account_by_uid
|
|
|
|
token_login_blueprint = Blueprint('token_login', __name__)
|
|
|
|
@token_login_blueprint.route('/hkrpg_cn/mdk/shield/api/verify', methods=['POST'])
|
|
@token_login_blueprint.route('/hkrpg_global/mdk/shield/api/verify', methods=['POST'])
|
|
@token_login_blueprint.route('/account/ma-cn-session/app/verify', methods=['POST'])
|
|
def token_login():
|
|
res=LoginRsp()
|
|
body=request.json
|
|
req=TokenLoginReq(**body)
|
|
account_data=find_account_by_uid(int(req.uid))
|
|
if not account_data or account_data.token != req.token:
|
|
res.retcode=0
|
|
res.message="Game account cache information error"
|
|
else:
|
|
res.retcode=0
|
|
res.message="OK"
|
|
res.data=LoginRsp.Data(
|
|
account=Account(
|
|
uid=str(account_data.id),
|
|
name=account_data.username + "@MikuMiku",
|
|
token=account_data.token,
|
|
is_email_verify=0,
|
|
realname="Miku",
|
|
identity_card="114514",
|
|
country="OS",
|
|
area_code="OS",
|
|
),
|
|
device_grant_required=False,
|
|
realname_operation="NONE",
|
|
realperson_required=False,
|
|
safe_mobile_required=False
|
|
)
|
|
return jsonify(res.model_dump())
|
|
|