mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-04 21:47:28 +08:00
[Enhance] Link Play Rooms info & API for that
- Add an HTTP API endpoint for getting the information of rooms and players in Link Play
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
from flask import Blueprint
|
||||
|
||||
from . import (users, songs, token, system, items,
|
||||
purchases, presents, redeems, characters)
|
||||
purchases, presents, redeems, characters, multiplay)
|
||||
|
||||
bp = Blueprint('api', __name__, url_prefix='/api/v1')
|
||||
bp.register_blueprint(users.bp)
|
||||
bp.register_blueprint(songs.bp)
|
||||
bp.register_blueprint(token.bp)
|
||||
bp.register_blueprint(system.bp)
|
||||
bp.register_blueprint(items.bp)
|
||||
bp.register_blueprint(purchases.bp)
|
||||
bp.register_blueprint(presents.bp)
|
||||
bp.register_blueprint(redeems.bp)
|
||||
bp.register_blueprint(characters.bp)
|
||||
l = [users, songs, token, system, items, purchases,
|
||||
presents, redeems, characters, multiplay]
|
||||
for i in l:
|
||||
bp.register_blueprint(i.bp)
|
||||
|
||||
21
latest version/api/multiplay.py
Normal file
21
latest version/api/multiplay.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from flask import Blueprint, request
|
||||
|
||||
from core.linkplay import RemoteMultiPlayer
|
||||
|
||||
from .api_auth import api_try, request_json_handle, role_required
|
||||
from .api_code import success_return
|
||||
|
||||
|
||||
bp = Blueprint('multiplay', __name__, url_prefix='/multiplay')
|
||||
|
||||
|
||||
@bp.route('/rooms', methods=['GET'])
|
||||
@role_required(request, ['select'])
|
||||
@request_json_handle(request, optional_keys=['offset', 'limit'])
|
||||
@api_try
|
||||
def rooms_get(data, user):
|
||||
'''获取房间列表'''
|
||||
|
||||
r = RemoteMultiPlayer().get_rooms(offset=data.get(
|
||||
'offset', 0), limit=data.get('limit', 100))
|
||||
return success_return(r)
|
||||
Reference in New Issue
Block a user