modify get method
This commit is contained in:
parent
ce9ba5a48c
commit
7f4aa9e7d3
@ -73,24 +73,22 @@ kill (pid)
|
|||||||
* total_addr
|
* total_addr
|
||||||
* detail_addr
|
* detail_addr
|
||||||
* contact_way > type + content
|
* contact_way > type + content
|
||||||
* comment [ {msg, user_name, time, user_cid, reply } ]
|
* comment [ {msg, user_name, time, user_id, reply } ]
|
||||||
* user_info > user_cid + user_name + user_id
|
* user_info > user_cid + user_name + user_id
|
||||||
* type
|
* type
|
||||||
* /api/laf/del
|
* /api/laf/del
|
||||||
* data
|
* data
|
||||||
* id
|
* id
|
||||||
* type
|
* type
|
||||||
* user_info > user_cid + user_name
|
* user_info > user_id + user_name
|
||||||
* /api/laf/get
|
* /api/laf/get
|
||||||
* data
|
|
||||||
* user_info > user_cid + user_name
|
|
||||||
* /api/laf/detail
|
* /api/laf/detail
|
||||||
* data
|
* data
|
||||||
* id
|
* id
|
||||||
* type
|
* type
|
||||||
* /api/laf/comment
|
* /api/laf/comment
|
||||||
* data
|
* data
|
||||||
* user_info > user_cid + user_name
|
* user_info > user_id + user_name
|
||||||
* msg
|
* msg
|
||||||
* time
|
* time
|
||||||
* position
|
* position
|
||||||
|
2
coc.py
2
coc.py
@ -34,7 +34,7 @@ def laf_del():
|
|||||||
# 获取全部失物招领信息
|
# 获取全部失物招领信息
|
||||||
@app.route('/api/laf/get',methods=['POST'])
|
@app.route('/api/laf/get',methods=['POST'])
|
||||||
def laf_get():
|
def laf_get():
|
||||||
res = manageGet(request)
|
res = manageGet()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
# 获取指定失物招领信息
|
# 获取指定失物招领信息
|
||||||
|
@ -61,16 +61,9 @@ def manageDel(request):
|
|||||||
return {'errcode': 340, 'errmsg': '数据校验失败'}
|
return {'errcode': 340, 'errmsg': '数据校验失败'}
|
||||||
|
|
||||||
# 获取全部失物招领信息
|
# 获取全部失物招领信息
|
||||||
def manageGet(request):
|
def manageGet():
|
||||||
# json化,应该能当dict用
|
return {'errcode': 200, 'lost': getLost(), 'found': getFound()}
|
||||||
data_cache = json.loads(request.form['data'])
|
|
||||||
# MD5校验
|
|
||||||
checked = checkData(data_cache)
|
|
||||||
data_cache.pop('sign')
|
|
||||||
if checked:
|
|
||||||
return {'errcode': 200, 'lost': getLost(), 'found': getFound()}
|
|
||||||
else:
|
|
||||||
return {'errcode': 350, 'errmsg': '数据校验失败'}
|
|
||||||
|
|
||||||
# 获取指定失物招领信息
|
# 获取指定失物招领信息
|
||||||
def manageDetail(request):
|
def manageDetail(request):
|
||||||
@ -87,7 +80,7 @@ def manageDetail(request):
|
|||||||
# 处理新增评论
|
# 处理新增评论
|
||||||
def manageComment(request):
|
def manageComment(request):
|
||||||
# json化,应该能当dict用
|
# json化,应该能当dict用
|
||||||
data_cache = json.loads(request.form['data'])
|
data_cache = json.loads(request.form['comment_msg'])
|
||||||
# MD5校验
|
# MD5校验
|
||||||
checked = checkData(data_cache)
|
checked = checkData(data_cache)
|
||||||
data_cache.pop('sign')
|
data_cache.pop('sign')
|
||||||
|
@ -33,7 +33,7 @@ def addLAF(data, add_type):
|
|||||||
def getLost():
|
def getLost():
|
||||||
arr = []
|
arr = []
|
||||||
try:
|
try:
|
||||||
for i in col('lost').find():
|
for i in col('lost').find({'close':'false'},{'title': 1, 'create_time':1, 'img_url':1, 'total_addr':1,'type':1}):
|
||||||
arr.append(i)
|
arr.append(i)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {'errcode': 351, 'errmsg': 'lost表获取失败', 'errdetail': e}
|
return {'errcode': 351, 'errmsg': 'lost表获取失败', 'errdetail': e}
|
||||||
@ -43,7 +43,7 @@ def getLost():
|
|||||||
def getFound():
|
def getFound():
|
||||||
arr = []
|
arr = []
|
||||||
try:
|
try:
|
||||||
for i in col('found').find():
|
for i in col('found').find({'close':'false'},{'title': 1, 'create_time':1, 'img_url':1, 'total_addr':1,'type':1}):
|
||||||
arr.append(i)
|
arr.append(i)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {'errcode': 352, 'errmsg': 'found表获取失败', 'errdetail': e}
|
return {'errcode': 352, 'errmsg': 'found表获取失败', 'errdetail': e}
|
||||||
@ -52,7 +52,7 @@ def getFound():
|
|||||||
# 获取指定失物信息
|
# 获取指定失物信息
|
||||||
def getDetail(id, get_type, errcode):
|
def getDetail(id, get_type, errcode):
|
||||||
try:
|
try:
|
||||||
info = col(get_type).find_one({"_id": ObjectId(id)})
|
info = col(get_type).find_one({"_id": ObjectId(id)},{'user_info':0})
|
||||||
if info:
|
if info:
|
||||||
return {'errcode': 200, 'detail': json_util.dumps(info), 'errmsg': 'ok'}
|
return {'errcode': 200, 'detail': json_util.dumps(info), 'errmsg': 'ok'}
|
||||||
else:
|
else:
|
||||||
@ -64,10 +64,11 @@ def getDetail(id, get_type, errcode):
|
|||||||
# 删除某个失物
|
# 删除某个失物
|
||||||
def delLAF(id, del_type, del_user_info):
|
def delLAF(id, del_type, del_user_info):
|
||||||
try:
|
try:
|
||||||
col(laf_type).update({"_id": ObjectId(id)},
|
col(del_type).update({"_id": ObjectId(id)},
|
||||||
{'$set': {'close': 'true','del_user_info': del_user_info}})
|
{'$set': {'close': 'true','del_user_info': del_user_info}})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# id不合法
|
# id不合法
|
||||||
|
print(e)
|
||||||
return {'errcode': 341, 'errmsg': 'id不合法'}
|
return {'errcode': 341, 'errmsg': 'id不合法'}
|
||||||
return {'errcode': 200, 'errmsg': 'ok'}
|
return {'errcode': 200, 'errmsg': 'ok'}
|
||||||
|
|
||||||
|
BIN
upload/no_img.png
Normal file
BIN
upload/no_img.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 33 KiB |
Loading…
x
Reference in New Issue
Block a user