def post(self): self.set_header("Content-Type", "application/json") data = json.loads(self.request.body) count = pg.delete('follow_who', where="user_id=%s and god_id=%s" % (self.current_user, data['god_id'])) if count == 0: raise Exception('没有正确的Unfollow, Unfollow %s 人' % count) self.write(json.dumps({'error': '0'}))
def delete(self, id): self.set_header("Content-Type", "application/json") where = " id=%s " % id count = pg.delete("available_card_numbers", where=where) print where if count != 1: raise Exception("删除失败,删除记录 %s 条" % count) self.write(json.dumps({"error": "0"}, cls=public_bz.ExtEncoder))