54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
# 引入文件夹中的文件
|
||
import sys
|
||
sys.path.append('./lib')
|
||
from allFunction import manageLogin, managePhoto, manageAdd, manageDel, manageGet, manageDetail, manageComment
|
||
|
||
from flask import Flask, request, session
|
||
|
||
app = Flask(__name__)
|
||
|
||
# 登录接口,前端提供cid和pwd,包装在data里边然后md5校验也就是data:{cid,pwd,sign}
|
||
@app.route('/api/login',methods=['POST'])
|
||
def login():
|
||
res = manageLogin(request)
|
||
return res
|
||
|
||
# 上传图片
|
||
@app.route('/api/photo/upload', methods=['PUT'], strict_slashes=False)
|
||
def upload_photo():
|
||
res = managePhoto(request)
|
||
return res
|
||
|
||
# 新增失物招领信息
|
||
@app.route('/api/laf/add',methods=['POST'])
|
||
def laf_add():
|
||
res = manageAdd(request)
|
||
return res
|
||
|
||
# 删除失物招领信息
|
||
@app.route('/api/laf/del',methods=['POST'])
|
||
def laf_del():
|
||
res = manageDel(request)
|
||
return res
|
||
|
||
# 获取全部失物招领信息
|
||
@app.route('/api/laf/get',methods=['POST'])
|
||
def laf_get():
|
||
res = manageGet()
|
||
return res
|
||
|
||
# 获取指定失物招领信息
|
||
@app.route('/api/laf/detail',methods=['POST'])
|
||
def laf_detail():
|
||
res = manageDetail(request)
|
||
return res
|
||
|
||
# 新增评论
|
||
@app.route('/api/laf/comment',methods=['POST'])
|
||
def laf_comment():
|
||
res = manageComment(request)
|
||
return res
|
||
|
||
if __name__ == '__main__':
|
||
app.debug = True
|
||
app.run() |