上海大学图书馆手机版后端
docker run -p 5000:5000 -e REDIS_IP=REDIS_IP zhoudian64/shu-library
需要Python3:
pip3 install -r requirements.txt
- redis
运行前请确保redis-server正在工作,可通过app.py中的app.config['REDIS_KWARGS']
参数调整host和port(默认为127.0.0.1:6379)
export REDIS_IP=localhost
export FLASK_APP=app
flask run
gunicorn -b 0.0.0.0:5000 app:app
- method:
POST
- URL:
/login
- Format:
json
- Body:
{ "username": "学生证号", "password": "学生密码" }
{
"token": "$JWT_TOKEN"
}
- method:
GET
- URL:
/loans
- Authorization:
Bearer $JWT_TOKEN
{
"loans": [
{
"author": "著者",
"description": "题名",
"due_date": "应还日期(YYYYMMDD)",
"fine": "罚金",
"id": "ID",
"sub_library": "分馆",
"year": "出版年(YYYY)"
},
"..."
]
}
- method:
GET
- URL:
/histories
- Authorization:
Bearer $JWT_TOKEN
{
"histories": [
{
"author": "著者",
"description": "题名",
"due_date": "应还日期(YYYYMMDD)",
"fine": "罚金",
"returned_date": "归还日期(YYYYMMDD)",
"returned_hour": "归还时间(HH:MM)",
"sub_library": "分馆",
"year": "出版年(YYYY)"
},
"..."
]
}