Update to v2.0

close #11
close #10
close #9
This commit is contained in:
Lost-MSth
2021-01-08 14:51:37 +08:00
parent 29a6cfaac1
commit 08872399cc
13 changed files with 884 additions and 877 deletions

Binary file not shown.

View File

@@ -3,7 +3,7 @@
"items": [{
"type": "pack",
"id": "core",
"_id": "5fdab049a6e343038b0582d4",
"_id": "5ff79fc6a6e343038b058bd3",
"is_available": true
}],
"price": 500,
@@ -15,12 +15,12 @@
"items": [{
"type": "pack",
"id": "shiawase",
"_id": "5fdab049a6e343038b058314",
"_id": "5ff79fc6a6e343038b058c18",
"is_available": true
}, {
"type": "character",
"id": "kou",
"_id": "5fdab049a6e343038b058313",
"_id": "5ff79fc6a6e343038b058c17",
"is_available": true
}],
"price": 500,
@@ -32,12 +32,12 @@
"items": [{
"type": "pack",
"id": "dynamix",
"_id": "5fdab049a6e343038b05831c",
"_id": "5ff79fc6a6e343038b058c1c",
"is_available": true
}, {
"type": "character",
"id": "sapphire",
"_id": "5fdab049a6e343038b05831b",
"_id": "5ff79fc6a6e343038b058c1b",
"is_available": true
}],
"price": 500,
@@ -49,12 +49,12 @@
"items": [{
"type": "pack",
"id": "mirai",
"_id": "5fdab049a6e343038b058318",
"_id": "5ff79fc6a6e343038b058c10",
"is_available": true
}, {
"type": "character",
"id": "lethe",
"_id": "5fdab049a6e343038b058317",
"_id": "5ff79fc6a6e343038b058c0f",
"is_available": true
}],
"price": 500,
@@ -66,7 +66,7 @@
"items": [{
"type": "pack",
"id": "yugamu",
"_id": "5fdab049a6e343038b0582d5",
"_id": "5ff79fc6a6e343038b058bd4",
"is_available": true
}],
"price": 500,
@@ -78,7 +78,7 @@
"items": [{
"type": "pack",
"id": "lanota",
"_id": "5fdab049a6e343038b058305",
"_id": "5ff79fc6a6e343038b058bf9",
"is_available": true
}],
"price": 500,
@@ -90,7 +90,7 @@
"items": [{
"type": "pack",
"id": "nijuusei",
"_id": "5fdab049a6e343038b0582d6",
"_id": "5ff79fc6a6e343038b058bd5",
"is_available": true
}],
"price": 500,
@@ -102,7 +102,7 @@
"items": [{
"type": "pack",
"id": "rei",
"_id": "5fdab049a6e343038b0582fb",
"_id": "5ff79fc6a6e343038b058c06",
"is_available": true
}],
"price": 500,
@@ -114,7 +114,7 @@
"items": [{
"type": "pack",
"id": "tonesphere",
"_id": "5fdab049a6e343038b058307",
"_id": "5ff79fc6a6e343038b058bfb",
"is_available": true
}],
"price": 500,
@@ -126,7 +126,7 @@
"items": [{
"type": "pack",
"id": "groovecoaster",
"_id": "5fdab049a6e343038b0582f1",
"_id": "5ff79fc6a6e343038b058bf0",
"is_available": true
}],
"price": 500,
@@ -138,7 +138,7 @@
"items": [{
"type": "pack",
"id": "zettai",
"_id": "5fdab049a6e343038b0582fd",
"_id": "5ff79fc6a6e343038b058c08",
"is_available": true
}],
"price": 500,
@@ -150,7 +150,7 @@
"items": [{
"type": "pack",
"id": "chunithm",
"_id": "5fdab049a6e343038b0582e5",
"_id": "5ff79fc6a6e343038b058be4",
"is_available": true
}],
"price": 300,
@@ -160,7 +160,7 @@
"items": [{
"type": "pack",
"id": "prelude",
"_id": "5fdab049a6e343038b0582f2",
"_id": "5ff79fc6a6e343038b058bf1",
"is_available": true
}],
"price": 400,
@@ -170,7 +170,7 @@
"items": [{
"type": "pack",
"id": "omatsuri",
"_id": "5fdab049a6e343038b0582fe",
"_id": "5ff79fc6a6e343038b058c09",
"is_available": true
}],
"price": 500,
@@ -180,7 +180,7 @@
"items": [{
"type": "pack",
"id": "vs",
"_id": "5fdab049a6e343038b0582e8",
"_id": "5ff79fc6a6e343038b058be7",
"is_available": true
}],
"price": 500,
@@ -190,7 +190,7 @@
"items": [{
"type": "pack",
"id": "extend",
"_id": "5fdab049a6e343038b0582f5",
"_id": "5ff79fc6a6e343038b058bf4",
"is_available": true
}],
"price": 700,
@@ -200,7 +200,7 @@
"items": [{
"type": "pack",
"id": "alice",
"_id": "5fdab049a6e343038b058303",
"_id": "5ff79fc6a6e343038b058c0e",
"is_available": true
}],
"orig_price": 500,
@@ -210,7 +210,7 @@
"items": [{
"type": "pack",
"id": "alice_append_1",
"_id": "5fdab049a6e343038b0582df",
"_id": "5ff79fc6a6e343038b058bde",
"is_available": true
}],
"orig_price": 300,
@@ -220,7 +220,17 @@
"items": [{
"type": "pack",
"id": "ongeki",
"_id": "5fdab049a6e343038b0582eb",
"_id": "5ff79fc6a6e343038b058bea",
"is_available": true
}],
"orig_price": 400,
"price": 400
}, {
"name": "maimai",
"items": [{
"type": "pack",
"id": "maimai",
"_id": "5ff79fc6a6e343038b058bf7",
"is_available": true
}],
"orig_price": 400,

View File

@@ -12,7 +12,7 @@
"items": [{
"id": "dataerror",
"type": "single",
"_id": "5fdab049a6e343038b0582ec",
"_id": "5ff79fc6a6e343038b058beb",
"is_available": true
}],
"price": 100,
@@ -24,7 +24,7 @@
"items": [{
"id": "yourvoiceso",
"type": "single",
"_id": "5fdab049a6e343038b0582f8",
"_id": "5ff79fc6a6e343038b058bf8",
"is_available": true
}],
"price": 100,
@@ -36,7 +36,7 @@
"items": [{
"id": "crosssoul",
"type": "single",
"_id": "5fdab049a6e343038b058304",
"_id": "5ff79fc6a6e343038b058c03",
"is_available": true
}],
"price": 100,
@@ -48,7 +48,7 @@
"items": [{
"type": "single",
"id": "impurebird",
"_id": "5fdab049a6e343038b0582e0",
"_id": "5ff79fc6a6e343038b058bdf",
"is_available": true
}],
"price": 100,
@@ -60,7 +60,7 @@
"items": [{
"type": "single",
"id": "auxesia",
"_id": "5fdab049a6e343038b0582ed",
"_id": "5ff79fc6a6e343038b058bec",
"is_available": true
}],
"price": 100,
@@ -72,7 +72,7 @@
"items": [{
"type": "single",
"id": "modelista",
"_id": "5fdab049a6e343038b0582f9",
"_id": "5ff79fc6a6e343038b058c04",
"is_available": true
}],
"price": 100,
@@ -84,7 +84,7 @@
"items": [{
"type": "single",
"id": "yozakurafubuki",
"_id": "5fdab049a6e343038b0582e1",
"_id": "5ff79fc6a6e343038b058be0",
"is_available": true
}],
"price": 100,
@@ -96,7 +96,7 @@
"items": [{
"type": "single",
"id": "surrender",
"_id": "5fdab049a6e343038b0582ee",
"_id": "5ff79fc6a6e343038b058bed",
"is_available": true
}],
"price": 100,
@@ -108,7 +108,7 @@
"items": [{
"type": "single",
"id": "metallicpunisher",
"_id": "5fdab049a6e343038b0582fa",
"_id": "5ff79fc6a6e343038b058c05",
"is_available": true
}],
"price": 100,
@@ -118,7 +118,7 @@
"items": [{
"type": "single",
"id": "carminescythe",
"_id": "5fdab049a6e343038b0582e2",
"_id": "5ff79fc6a6e343038b058be1",
"is_available": true
}],
"price": 100,
@@ -128,7 +128,7 @@
"items": [{
"type": "single",
"id": "bethere",
"_id": "5fdab049a6e343038b0582ef",
"_id": "5ff79fc6a6e343038b058bee",
"is_available": true
}],
"price": 100,
@@ -140,7 +140,7 @@
"items": [{
"type": "single",
"id": "callmyname",
"_id": "5fdab049a6e343038b058306",
"_id": "5ff79fc6a6e343038b058bfa",
"is_available": true
}],
"price": 100,
@@ -152,7 +152,7 @@
"items": [{
"type": "single",
"id": "fallensquare",
"_id": "5fdab049a6e343038b0582d7",
"_id": "5ff79fc6a6e343038b058bd6",
"is_available": true
}],
"price": 100,
@@ -164,7 +164,7 @@
"items": [{
"type": "single",
"id": "dropdead",
"_id": "5fdab049a6e343038b0582e3",
"_id": "5ff79fc6a6e343038b058be2",
"is_available": true
}],
"price": 100,
@@ -176,7 +176,7 @@
"items": [{
"type": "single",
"id": "alexandrite",
"_id": "5fdab049a6e343038b0582f0",
"_id": "5ff79fc6a6e343038b058bef",
"is_available": true
}],
"price": 100,
@@ -188,7 +188,7 @@
"items": [{
"type": "single",
"id": "astraltale",
"_id": "5fdab049a6e343038b0582fc",
"_id": "5ff79fc6a6e343038b058c07",
"is_available": true
}],
"price": 100,
@@ -200,7 +200,7 @@
"items": [{
"type": "single",
"id": "phantasia",
"_id": "5fdab049a6e343038b0582d8",
"_id": "5ff79fc6a6e343038b058bd7",
"is_available": true
}],
"price": 100,
@@ -210,7 +210,7 @@
"items": [{
"type": "single",
"id": "empireofwinter",
"_id": "5fdab049a6e343038b0582e4",
"_id": "5ff79fc6a6e343038b058be3",
"is_available": true
}],
"price": 100,
@@ -220,7 +220,7 @@
"items": [{
"type": "single",
"id": "libertas",
"_id": "5fdab049a6e343038b058308",
"_id": "5ff79fc6a6e343038b058bfc",
"is_available": true
}],
"price": 100,
@@ -232,7 +232,7 @@
"items": [{
"type": "single",
"id": "dottodot",
"_id": "5fdab049a6e343038b0582d9",
"_id": "5ff79fc6a6e343038b058bd8",
"is_available": true
}],
"price": 100,
@@ -244,7 +244,7 @@
"items": [{
"type": "single",
"id": "dreadnought",
"_id": "5fdab049a6e343038b058309",
"_id": "5ff79fc6a6e343038b058bfd",
"is_available": true
}],
"price": 100,
@@ -256,7 +256,7 @@
"items": [{
"type": "single",
"id": "mirzam",
"_id": "5fdab049a6e343038b0582da",
"_id": "5ff79fc6a6e343038b058bd9",
"is_available": true
}],
"price": 100,
@@ -268,7 +268,7 @@
"items": [{
"type": "single",
"id": "heavenlycaress",
"_id": "5fdab049a6e343038b0582e6",
"_id": "5ff79fc6a6e343038b058be5",
"is_available": true
}],
"price": 100,
@@ -278,7 +278,7 @@
"items": [{
"type": "single",
"id": "filament",
"_id": "5fdab049a6e343038b0582f3",
"_id": "5ff79fc6a6e343038b058bf2",
"is_available": true
}],
"price": 100,
@@ -288,7 +288,7 @@
"items": [{
"type": "single",
"id": "avantraze",
"_id": "5fdab049a6e343038b05830a",
"_id": "5ff79fc6a6e343038b058bfe",
"is_available": true
}],
"price": 100,
@@ -298,7 +298,7 @@
"items": [{
"type": "single",
"id": "battlenoone",
"_id": "5fdab049a6e343038b0582ff",
"_id": "5ff79fc6a6e343038b058c0a",
"is_available": true
}],
"price": 100,
@@ -308,7 +308,7 @@
"items": [{
"type": "single",
"id": "saikyostronger",
"_id": "5fdab049a6e343038b0582db",
"_id": "5ff79fc6a6e343038b058bda",
"is_available": true
}],
"price": 100,
@@ -318,7 +318,7 @@
"items": [{
"type": "single",
"id": "izana",
"_id": "5fdab049a6e343038b0582e7",
"_id": "5ff79fc6a6e343038b058be6",
"is_available": true
}],
"price": 100,
@@ -328,7 +328,7 @@
"items": [{
"type": "single",
"id": "einherjar",
"_id": "5fdab049a6e343038b0582f4",
"_id": "5ff79fc6a6e343038b058bf3",
"is_available": true
}],
"price": 100,
@@ -338,7 +338,7 @@
"items": [{
"type": "single",
"id": "laqryma",
"_id": "5fdab049a6e343038b05830b",
"_id": "5ff79fc6a6e343038b058bff",
"is_available": true
}],
"price": 100,
@@ -348,7 +348,7 @@
"items": [{
"type": "single",
"id": "amygdata",
"_id": "5fdab049a6e343038b058300",
"_id": "5ff79fc6a6e343038b058c0b",
"is_available": true
}],
"price": 100,
@@ -358,7 +358,7 @@
"items": [{
"type": "single",
"id": "altale",
"_id": "5fdab049a6e343038b0582dc",
"_id": "5ff79fc6a6e343038b058bdb",
"is_available": true
}],
"price": 100,
@@ -368,7 +368,7 @@
"items": [{
"type": "single",
"id": "feelssoright",
"_id": "5fdab049a6e343038b05830c",
"_id": "5ff79fc6a6e343038b058c00",
"is_available": true
}],
"price": 100,
@@ -378,7 +378,7 @@
"items": [{
"type": "single",
"id": "scarletcage",
"_id": "5fdab049a6e343038b058301",
"_id": "5ff79fc6a6e343038b058c0c",
"is_available": true
}],
"price": 100,
@@ -388,7 +388,7 @@
"items": [{
"type": "single",
"id": "teriqma",
"_id": "5fdab049a6e343038b0582dd",
"_id": "5ff79fc6a6e343038b058bdc",
"is_available": true
}],
"price": 100,
@@ -398,7 +398,7 @@
"items": [{
"type": "single",
"id": "mahoroba",
"_id": "5fdab049a6e343038b0582e9",
"_id": "5ff79fc6a6e343038b058be8",
"is_available": true
}],
"price": 100,
@@ -408,7 +408,7 @@
"items": [{
"type": "single",
"id": "badtek",
"_id": "5fdab049a6e343038b05830d",
"_id": "5ff79fc6a6e343038b058c01",
"is_available": true
}],
"price": 100,
@@ -418,7 +418,7 @@
"items": [{
"type": "single",
"id": "maliciousmischance",
"_id": "5fdab049a6e343038b058302",
"_id": "5ff79fc6a6e343038b058c0d",
"is_available": true
}],
"price": 100,
@@ -428,7 +428,7 @@
"items": [{
"type": "single",
"id": "buchigireberserker",
"_id": "5fdab049a6e343038b0582de",
"_id": "5ff79fc6a6e343038b058bdd",
"is_available": true
}],
"price": 100,
@@ -438,7 +438,7 @@
"items": [{
"type": "single",
"id": "galaxyfriends",
"_id": "5fdab049a6e343038b0582ea",
"_id": "5ff79fc6a6e343038b058be9",
"is_available": true
}],
"price": 100,
@@ -448,7 +448,7 @@
"items": [{
"type": "single",
"id": "xeraphinite",
"_id": "5fdab049a6e343038b0582f7",
"_id": "5ff79fc6a6e343038b058bf6",
"is_available": true
}],
"orig_price": 100,
@@ -458,7 +458,7 @@
"items": [{
"type": "single",
"id": "xanatos",
"_id": "5fdab049a6e343038b05830e",
"_id": "5ff79fc6a6e343038b058c02",
"is_available": true
}],
"price": 100,

View File

@@ -81,7 +81,7 @@ def favicon():
return app.send_static_file('favicon.ico')
@app.route('/coffee/12/auth/login', methods=['POST']) # 登录接口
@app.route('/latte/13/auth/login', methods=['POST']) # 登录接口
def login():
headers = request.headers
id_pwd = headers['Authorization']
@@ -89,18 +89,18 @@ def login():
name, password = id_pwd.split(':', 1)
try:
token = server.auth.arc_login(name, password)
if token is not None:
token, error_code = server.auth.arc_login(name, password)
if not error_code:
r = {"success": True, "token_type": "Bearer"}
r['access_token'] = token
return jsonify(r)
else:
return error_return(104) # 用户名或密码错误
return error_return(error_code)
except:
return error_return(108)
@app.route('/coffee/12/user/', methods=['POST']) # 注册接口
@app.route('/latte/13/user/', methods=['POST']) # 注册接口
def register():
name = request.form['name']
password = request.form['password']
@@ -117,7 +117,7 @@ def register():
# 集成式请求,没想到什么好办法处理,就先这样写着
@app.route('/coffee/12/compose/aggregate', methods=['GET'])
@app.route('/latte/13/compose/aggregate', methods=['GET'])
def aggregate():
calls = request.args.get('calls')
headers = request.headers
@@ -137,7 +137,7 @@ def aggregate():
return error_return(108)
@app.route('/coffee/12/user/me/character', methods=['POST']) # 角色切换
@app.route('/latte/13/user/me/character', methods=['POST']) # 角色切换
def character_change():
headers = request.headers
token = headers['Authorization']
@@ -165,7 +165,7 @@ def character_change():
return error_return(108)
@app.route('/coffee/<path:path>/toggle_uncap', methods=['POST']) # 角色觉醒切换
@app.route('/latte/<path:path>/toggle_uncap', methods=['POST']) # 角色觉醒切换
def character_uncap(path):
character_id = int(path[22:])
headers = request.headers
@@ -191,7 +191,7 @@ def character_uncap(path):
return error_return(108)
@app.route('/coffee/12/friend/me/add', methods=['POST']) # 加好友
@app.route('/latte/13/friend/me/add', methods=['POST']) # 加好友
def add_friend():
headers = request.headers
token = headers['Authorization']
@@ -226,7 +226,7 @@ def add_friend():
return error_return(108)
@app.route('/coffee/12/friend/me/delete', methods=['POST']) # 删好友
@app.route('/latte/13/friend/me/delete', methods=['POST']) # 删好友
def delete_friend():
headers = request.headers
token = headers['Authorization']
@@ -257,7 +257,7 @@ def delete_friend():
return error_return(108)
@app.route('/coffee/12/score/song/friend', methods=['GET']) # 好友排名默认最多50
@app.route('/latte/13/score/song/friend', methods=['GET']) # 好友排名默认最多50
def song_score_friend():
song_id = request.args.get('song_id')
difficulty = request.args.get('difficulty')
@@ -281,7 +281,7 @@ def song_score_friend():
return error_return(108)
@app.route('/coffee/12/score/song/me', methods=['GET']) # 我的排名默认最多20
@app.route('/latte/13/score/song/me', methods=['GET']) # 我的排名默认最多20
def song_score_me():
song_id = request.args.get('song_id')
difficulty = request.args.get('difficulty')
@@ -305,7 +305,7 @@ def song_score_me():
return error_return(108)
@app.route('/coffee/12/score/song', methods=['GET']) # TOP20
@app.route('/latte/13/score/song', methods=['GET']) # TOP20
def song_score_top():
song_id = request.args.get('song_id')
difficulty = request.args.get('difficulty')
@@ -329,7 +329,7 @@ def song_score_top():
return error_return(108)
@app.route('/coffee/12/score/song', methods=['POST']) # 成绩上传
@app.route('/latte/13/score/song', methods=['POST']) # 成绩上传
def song_score_post():
headers = request.headers
token = headers['Authorization']
@@ -377,7 +377,7 @@ def song_score_post():
return error_return(108)
@app.route('/coffee/12/score/token', methods=['GET']) # 成绩上传所需的token显然我不想验证
@app.route('/latte/13/score/token', methods=['GET']) # 成绩上传所需的token显然我不想验证
def score_token():
return jsonify({
"success": True,
@@ -388,7 +388,7 @@ def score_token():
# 世界模式成绩上传所需的token无验证
@app.route('/coffee/12/score/token/world', methods=['GET'])
@app.route('/latte/13/score/token/world', methods=['GET'])
def score_token_world():
headers = request.headers
token = headers['Authorization']
@@ -412,7 +412,7 @@ def score_token_world():
return error_return(108)
@app.route('/coffee/12/user/me/save', methods=['GET']) # 从云端同步
@app.route('/latte/13/user/me/save', methods=['GET']) # 从云端同步
def cloud_get():
headers = request.headers
token = headers['Authorization']
@@ -434,7 +434,7 @@ def cloud_get():
return error_return(108)
@app.route('/coffee/12/user/me/save', methods=['POST']) # 向云端同步
@app.route('/latte/13/user/me/save', methods=['POST']) # 向云端同步
def cloud_post():
headers = request.headers
token = headers['Authorization']
@@ -463,7 +463,7 @@ def cloud_post():
return error_return(108)
@app.route('/coffee/12/purchase/me/redeem', methods=['POST']) # 兑换码
@app.route('/latte/13/purchase/me/redeem', methods=['POST']) # 兑换码
def redeem():
headers = request.headers
token = headers['Authorization']
@@ -494,7 +494,7 @@ def redeem():
# 礼物确认
@app.route('/coffee/12/present/me/claim/<present_id>', methods=['POST'])
@app.route('/latte/13/present/me/claim/<present_id>', methods=['POST'])
def claim_present(present_id):
headers = request.headers
token = headers['Authorization']
@@ -516,14 +516,14 @@ def claim_present(present_id):
# 购买为了world模式boost一下
@app.route('/coffee/12/purchase/me/item', methods=['POST'])
@app.route('/latte/13/purchase/me/item', methods=['POST'])
def item():
return jsonify({
"success": True
})
@app.route('/coffee/12/purchase/me/pack', methods=['POST']) # 曲包和单曲购买
@app.route('/latte/13/purchase/me/pack', methods=['POST']) # 曲包和单曲购买
def pack():
headers = request.headers
token = headers['Authorization']
@@ -544,7 +544,7 @@ def pack():
})
@app.route('/coffee/12/purchase/bundle/single', methods=['GET']) # 单曲购买信息获取
@app.route('/latte/13/purchase/bundle/single', methods=['GET']) # 单曲购买信息获取
def single():
return jsonify({
"success": True,
@@ -552,7 +552,7 @@ def single():
})
@app.route('/coffee/12/world/map/me', methods=['GET']) # 获得世界模式信息,所有地图
@app.route('/latte/13/world/map/me', methods=['GET']) # 获得世界模式信息,所有地图
def world_all():
headers = request.headers
token = headers['Authorization']
@@ -575,7 +575,7 @@ def world_all():
return error_return(108)
@app.route('/coffee/12/world/map/me/', methods=['POST']) # 进入地图
@app.route('/latte/13/world/map/me/', methods=['POST']) # 进入地图
def world_in():
headers = request.headers
token = headers['Authorization']
@@ -594,7 +594,7 @@ def world_in():
return error_return(108)
@app.route('/coffee/12/world/map/me/<map_id>', methods=['GET']) # 获得单个地图完整信息
@app.route('/latte/13/world/map/me/<map_id>', methods=['GET']) # 获得单个地图完整信息
def world_one(map_id):
headers = request.headers
token = headers['Authorization']
@@ -617,7 +617,7 @@ def world_one(map_id):
return error_return(108)
@app.route('/coffee/12/serve/download/me/song', methods=['GET']) # 歌曲下载
@app.route('/latte/13/serve/download/me/song', methods=['GET']) # 歌曲下载
def download_song():
headers = request.headers
token = headers['Authorization']
@@ -662,7 +662,7 @@ def download(file_path):
return error_return(108)
@app.route('/coffee/<path:path>', methods=['POST']) # 三个设置,写在最后降低优先级
@app.route('/latte/<path:path>', methods=['POST']) # 三个设置,写在最后降低优先级
def sys_set(path):
set_arg = path[10:]
headers = request.headers

File diff suppressed because it is too large Load Diff

View File

@@ -5,36 +5,46 @@ import server.arcworld
def arc_login(name: str, password: str) -> str: # 登录判断
# 查询数据库中的user表验证账号密码返回并记录token
# 查询数据库中的user表验证账号密码返回并记录token多返回个error code
# token采用user_id和时间戳连接后hash生成真的是瞎想的没用bear
# 密码和token的加密方式为 SHA-256
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
error_code = None
token = None
hash_pwd = hashlib.sha256(password.encode("utf8")).hexdigest()
c.execute('''select user_id from user where name = :name and password = :password''', {
'name': name, 'password': hash_pwd})
c.execute('''select user_id, password from user where name = :name''', {
'name': name})
x = c.fetchone()
if x is not None:
user_id = str(x[0])
now = int(time.time() * 1000)
token = hashlib.sha256((user_id + str(now)).encode("utf8")).hexdigest()
c.execute(
'''select exists(select * from login where user_id = :user_id)''', {"user_id": user_id})
if x[1] == '':
# 账号封禁
error_code = 106
elif x[1] == hash_pwd:
user_id = str(x[0])
now = int(time.time() * 1000)
token = hashlib.sha256(
(user_id + str(now)).encode("utf8")).hexdigest()
c.execute(
'''select exists(select * from login where user_id = :user_id)''', {"user_id": user_id})
if c.fetchone() == (1,): # 删掉多余token
c.execute('''delete from login where user_id = :user_id''',
{'user_id': user_id})
if c.fetchone() == (1,): # 删掉多余token
c.execute('''delete from login where user_id = :user_id''',
{'user_id': user_id})
c.execute('''insert into login(access_token, user_id) values(:access_token, :user_id)''', {
'user_id': user_id, 'access_token': token})
conn.commit()
conn.close()
return token
c.execute('''insert into login(access_token, user_id) values(:access_token, :user_id)''', {
'user_id': user_id, 'access_token': token})
else:
# 密码错误
error_code = 104
else:
# 用户名错误
error_code = 104
conn.commit()
conn.close()
return None
return token, error_code
def arc_register(name: str, password: str): # 注册

View File

@@ -194,7 +194,7 @@ def get_value_0(c, user_id):
"max_stamina_ts": 1586274871917,
"stamina": 12,
"world_unlocks": ["scenery_chap1", "scenery_chap2", "scenery_chap3", "scenery_chap4", "scenery_chap5"],
"world_songs": ["babaroque", "shadesoflight", "kanagawa", "lucifer", "anokumene", "ignotus", "rabbitintheblackroom", "qualia", "redandblue", "bookmaker", "darakunosono", "espebranch", "blacklotus", "givemeanightmare", "vividtheory", "onefr", "gekka", "vexaria3", "infinityheaven3", "fairytale3", "goodtek3", "suomi", "rugie", "faintlight", "harutopia", "goodtek", "dreaminattraction", "syro", "diode", "freefall", "grimheart", "blaster", "cyberneciacatharsis", "monochromeprincess", "revixy", "vector", "supernova", "nhelv", "purgatorium3", "dement3", "crossover", "guardina", "axiumcrisis", "worldvanquisher", "sheriruth", "pragmatism", "gloryroad", "etherstrike", "corpssansorganes", "lostdesire", "blrink", "essenceoftwilight", "lapis", "solitarydream", "lumia3", "purpleverse"],
"world_songs": ["babaroque", "shadesoflight", "kanagawa", "lucifer", "anokumene", "ignotus", "rabbitintheblackroom", "qualia", "redandblue", "bookmaker", "darakunosono", "espebranch", "blacklotus", "givemeanightmare", "vividtheory", "onefr", "gekka", "vexaria3", "infinityheaven3", "fairytale3", "goodtek3", "suomi", "rugie", "faintlight", "harutopia", "goodtek", "dreaminattraction", "syro", "diode", "freefall", "grimheart", "blaster", "cyberneciacatharsis", "monochromeprincess", "revixy", "vector", "supernova", "nhelv", "purgatorium3", "dement3", "crossover", "guardina", "axiumcrisis", "worldvanquisher", "sheriruth", "pragmatism", "gloryroad", "etherstrike", "corpssansorganes", "lostdesire", "blrink", "essenceoftwilight", "lapis", "solitarydream", "lumia3", "purpleverse", "moonheart3"],
"singles": get_user_singles(c, user_id), # ["dataerror", "yourvoiceso", "crosssoul", "impurebird", "auxesia", "modelista", "yozakurafubuki", "surrender", "metallicpunisher", "carminescythe", "bethere", "callmyname", "fallensquare", "dropdead", "alexandrite", "astraltale", "phantasia", "empireofwinter", "libertas", "dottodot", "dreadnought", "mirzam", "heavenlycaress", "filament", "avantraze", "battlenoone", "saikyostronger", "izana", "einherjar", "laqryma", "amygdata", "altale", "feelssoright", "scarletcage", "teriqma", "mahoroba", "badtek", "maliciousmischance", "buchigireberserker", "galaxyfriends", "xeraphinite", "xanatos"]
"packs": get_user_packs(c, user_id),
# ["vs", "extend", "dynamix", "prelude", "core", "yugamu", "omatsuri", "zettai", "mirai", "shiawase", "chunithm", "nijuusei", "groovecoaster", "rei", "tonesphere", "lanota"]

View File

@@ -0,0 +1,37 @@
{% extends 'base.html' %}
{% block header %}
<h1>{% block title %}Ban the user{% endblock %}</h1>
{% endblock %}
{% block content %}
<form action="/web/banuser" method="post">
<div class="title">Ban the user</div>
<label for="name">Arcaea Username</label>
<input name="name" id="name">
or<br />
<label for="user_code">Arcaea User Code</label>
<input name="user_code" id="user_code">
<br />
<div class="content">提示:重设用户密码即可解封账号</div>
<div class="content">Tip: Reset the user password to unseal the account.</div>
<br />
<input type="submit" value="Execute">
</form>
<br />
<hr />
<form action="/web/banuser/deleteuserscore" method="post">
<div class="title">Delete all of the user's scores</div>
<label for="name">Arcaea Username</label>
<input name="name" id="name">
or<br />
<label for="user_code">Arcaea User Code</label>
<input name="user_code" id="user_code">
<br />
<div class="content">警告!这个操作具有破坏性,且不可恢复。</div>
<div class="content">Warning! This operation is destructive and unrecoverable.</div>
<br />
<input type="submit" value="Execute">
</form>
{% endblock %}

View File

@@ -23,6 +23,7 @@
<h1>系统方面 System</h1>
<a href="{{ url_for('index.update_database') }}">数据库更新 Update databases</a></br></br>
<a href="{{ url_for('index.edit_userpwd') }}">用户密码修改 Change user password</a></br></br>
<a href="{{ url_for('index.ban_user') }}">封禁用户 Ban the user</a></br></br>
<a href="{{ url_for('index.update_user_save') }}">用户存档更新 Update user saves</a></br></br>
<a href="{{ url_for('index.change_song') }}">歌曲修改 Change the songs</a></br></br>
<a href="{{ url_for('index.change_character') }}">角色修改 Change the characters</a></br></br>

View File

@@ -1139,7 +1139,7 @@ def edit_userpwd():
return render_template('web/changeuserpwd.html')
error = None
name = request.form['name']
user_code = request.form['user_code']
pwd = request.form['pwd']
@@ -1182,3 +1182,86 @@ def edit_userpwd():
flash(error)
return redirect(url_for('index.edit_userpwd'))
@bp.route('/banuser', methods=['POST', 'GET'])
@login_required
def ban_user():
# 封禁用户
if request.method == 'GET':
return render_template('web/banuser.html')
error = None
name = request.form['name']
user_code = request.form['user_code']
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
if name or user_code:
if user_code:
c.execute('''select user_id from user where user_code=:a''', {
'a': user_code})
else:
c.execute(
'''select user_id from user where name=:a''', {'a': name})
user_id = c.fetchone()
if user_id:
user_id = user_id[0]
web.system.ban_one_user(c, user_id)
flash('用户封禁成功 Successfully ban the user.')
else:
error = '玩家不存在 The player does not exist.'
else:
error = '输入为空 Null Input.'
conn.commit()
conn.close()
if error:
flash(error)
return redirect(url_for('index.ban_user'))
@bp.route('/banuser/deleteuserscore', methods=['POST'])
@login_required
def delete_user_score():
# 删除用户所有成绩
error = None
name = request.form['name']
user_code = request.form['user_code']
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()
if name or user_code:
if user_code:
c.execute('''select user_id from user where user_code=:a''', {
'a': user_code})
else:
c.execute(
'''select user_id from user where name=:a''', {'a': name})
user_id = c.fetchone()
if user_id:
user_id = user_id[0]
web.system.clear_user_score(c, user_id)
flash("用户成绩删除成功 Successfully delete the user's scores.")
else:
error = '玩家不存在 The player does not exist.'
else:
error = '输入为空 Null Input.'
conn.commit()
conn.close()
if error:
flash(error)
return redirect(url_for('index.ban_user'))

View File

@@ -307,6 +307,8 @@ def update_one_save(c, user_id):
for i in scores:
rating = server.arcscore.get_one_ptt(
i['song_id'], i['difficulty'], i['score'])
if rating < 0:
rating = 0
try:
index = clear_song_id_difficulty.index(
i['song_id'] + str(i['difficulty']))
@@ -485,3 +487,20 @@ def change_userpwd(c, user_id, password):
c.execute('''update user set password =:a where user_id=:b''',
{'a': hash_pwd, 'b': user_id})
return
def ban_one_user(c, user_id):
# 封禁用户
c.execute('''update user set password = '' where user_id=:a''',
{'a': user_id})
c.execute('''delete from login where user_id=:a''', {'a': user_id})
return
def clear_user_score(c, user_id):
# 清除用户所有成绩包括best_score和recent30以及recent数据但不包括云端存档
c.execute('''update user set rating_ptt=0, song_id='', difficulty=0, score=0, shiny_perfect_count=0, perfect_count=0, near_count=0, miss_count=0, health=0, time_played=0, rating=0 where user_id=:a''',
{'a': user_id})
c.execute('''delete from best_score where user_id=:a''', {'a': user_id})
c.execute('''delete from recent30 where user_id=:a''', {'a': user_id})
return