Exemple #1
0
 def post(self):
     user = self.get_argument("user",None)
     actto = self.get_argument("actto",None)
     acttype = self.get_argument("acttype",None)
     user_id = get_id_by_name(self.db, self.rd, user)
     if len(actto) < 8 or not user_id or int(user_id) != self.current_user.id:
         raise tornado.web.HTTPError(405)
     acttype = int(acttype)
     actto = decode(actto)
     # don't remove in db now because data is not got wholy in redis,just mark it
     if acttype == 1:
         self.db.execute("update fd_Status set status_ = 1 where id = %s", actto)
     elif acttype == 2:
         self.db.execute("update fd_Note set status_ = 2 where id = %s", actto)
     elif acttype == 3:
         self.db.execute("update fd_Link set status_ = 2 where id = %s", actto)
     elif acttype == 4:
         doc_id = self.db.get("select doc_id,name,user_id from fd_Doc where id = %s", actto)
         if not doc_id:
             raise tornado.web.HTTPError(500)
         tld = doc_id.name.split(".").pop()
         prepath = "/data/static/usrdoc/%s/%s.%s" % (doc_id.user_id, doc_id.doc_id, tld)
         jpgpath = "/work/Dormforge/static/usrdoc/%s/%s.jpg" % (doc_id.user_id, doc_id.doc_id)
         swfpath = "/work/Dormforge/static/usrdoc/%s/%s.swf" % (doc_id.user_id, doc_id.doc_id)
         if os.path.exists(prepath) and os.path.exists(jpgpath) and os.path.exists(swfpath):
             os.remove(prepath)
             os.remove(jpgpath)
             os.remove(swfpath)
             self.db.execute("update fd_Doc set status_ = 2 where id = %s", actto)
     del_activity(self.rd, user_id, acttype, actto)
Exemple #2
0
 def post(self):
     from_user = self.get_argument("from_user",None)
     to_user = self.get_argument("to_user",None)
     if from_user == to_user or from_user == 0 or to_user == 0: raise tornado.web.HTTPError(405)
     if self.ufg.unfollow(from_user, to_user):
         #actto = self.db.get("select name from fd_People where id = %s", to_user).name
         del_activity(self.rd, from_user, 0, to_user)
     else:
         self.write('already')