cherry_be/README.md
2020-02-14 15:55:08 +08:00

98 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 挂柯南
## 服务器配置
```js
// 安装venv
python3 -m venv venv
// 启动venv
. venv/bin/activate
// 升级pip
pip install --upgrade pip
// 安装flask...
pip install Flask
pip install requests
pip install bs4
pip install gunicorn
pip install pymongo
// 设置全局变量
export FLASK_APP=coc.py
export FLASK_ENV=development
// 启动临时服务
flask run --host=0.0.0.0 -p 8001
// 启动永久服务
gunicorn coc:app -c gunicorn.conf
// 查看已启动服务
pstree -ap|grep gunicorn
// 关闭某服务
kill (pid)
```
## 错误代码一览
/api/login
100数据校验失败
101账户错误
102教务挂了
200ok
/api/laf/add
330数据校验失败
331插入数据库失败
/api/laf/del
340数据校验失败
341id不合法
/api/laf/get
350数据校验失败
351lost表获取失败
352found表获取失败
/api/laf/detail
360数据校验失败
361数据不存在
362id不合法
/api/laf/comment
370数据校验失败
371评论数据库修改失败
372回复数据库修改失败
373数据不存在
374id不合法
/api/photo/upload
380图片格式不符
# lost and found
* /api/laf/add
* data
* title
* content
* create_time
* img_url
* total_addr
* detail_addr
* contact_way > type + content
* comment [ {msg, user_name, time, user_id, reply } ]
* user_info > user_cid + user_name + user_id
* type
* /api/laf/del
* data
* id
* type
* user_info > user_id + user_name
* /api/laf/get
* /api/laf/detail
* data
* id
* type
* /api/laf/comment
* data
* user_info > user_id + user_name
* msg
* time
* position
* id
* type
* comment_type
* comment_index