def post(self): img_id = self.get_argument("imgurl_id", "") if img_id: from optsql.searchMySQL import search_one_imgurl img_url = search_one_imgurl(img_id=img_id) #查询该id对应的图片存储地址 if img_url: result = {"status": 0, "img_url": img_url} else: result = {"status": 1, "img_url": "出错了~"} else: result = {"status": 2, "img_url": "没有查到该图片~"} self.write(base.get_json(result))
def post(self): img_id = self.get_argument("img_id", "") if img_id: from optsql.searchMySQL import search_one_imgurl img_url = search_one_imgurl(img_id=img_id) #先查询图片id对应的url if img_url: import os os.remove(img_url) #删除存储在文件中的图 from optsql.deleteMySQL import delete_one_imgurl delete_one_imgurl(img_id=img_id) #删除数据库的url result = {"status": 0, "rt_info": "删除成功!"} else: result = {"status": 1, "rt_info": "不存在改图~"} else: result = {"status": 2, "rt_info": "网络连接错误~"} self.write(base.get_json(result))