mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-11 02:17:28 +08:00
Update a midway version (waiting for offical update)
Add some things and fix some bugs. It will not have a description.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from flask import Flask, request, jsonify, make_response, send_from_directory
|
||||
from logging.config import dictConfig
|
||||
import configparser
|
||||
import base64
|
||||
import server.auth
|
||||
@@ -462,9 +463,34 @@ def cloud_post():
|
||||
return error_return(108)
|
||||
|
||||
|
||||
@app.route('/coffee/12/purchase/me/redeem', methods=['POST']) # 兑换码,依然没有用
|
||||
@app.route('/coffee/12/purchase/me/redeem', methods=['POST']) # 兑换码
|
||||
def redeem():
|
||||
return error_return(504)
|
||||
headers = request.headers
|
||||
token = headers['Authorization']
|
||||
token = token[7:]
|
||||
code = request.form['code']
|
||||
try:
|
||||
user_id = server.auth.token_get_id(token)
|
||||
if user_id is not None:
|
||||
fragment, error_code = server.arcpurchase.claim_user_redeem(
|
||||
user_id, code)
|
||||
if not error_code:
|
||||
if fragment > 0:
|
||||
return jsonify({
|
||||
"success": True,
|
||||
"value": {"coupon": "fragment"+str(fragment)}
|
||||
})
|
||||
else:
|
||||
return jsonify({
|
||||
"success": True,
|
||||
"value": {"coupon": ""}
|
||||
})
|
||||
else:
|
||||
return error_return(error_code)
|
||||
else:
|
||||
return error_return(108)
|
||||
except:
|
||||
return error_return(108)
|
||||
|
||||
|
||||
# 礼物确认
|
||||
@@ -667,6 +693,26 @@ def main():
|
||||
app.register_blueprint(web.login.bp)
|
||||
app.register_blueprint(web.index.bp)
|
||||
|
||||
dictConfig({
|
||||
'version': 1,
|
||||
'formatters': {'default': {
|
||||
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
|
||||
}},
|
||||
'root': {
|
||||
'level': 'INFO'
|
||||
}
|
||||
})
|
||||
|
||||
app.logger.info("Start to initialize data in 'songfile' table...")
|
||||
try:
|
||||
error = server.arcdownload.initialize_songfile()
|
||||
except:
|
||||
error = 'Something wrong.'
|
||||
if error:
|
||||
app.logger.warning(error)
|
||||
else:
|
||||
app.logger.info('Complete!')
|
||||
|
||||
app.run(HOST, PORT)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user