def post(self): inputdata = tornado.escape.json_decode(self.request.body) user = Mydb.getUserByUsername(inputdata['username']) friend = Mydb.getUserByUsername(inputdata['friendname']) data = Mydb.delFriends(user['id'], friend['id']) if data: self.write(Message.say(Message.ok)) else: self.write(Message.say(Message.error))
def get(self, t, id): if t == 'username': result = Mydb.getUserByUsername(id) elif t == 'clientnumber': result = Mydb.getUserByClientnumber(id) if result: self.write(Message.say(Message.ok, result)) else: self.write(Message.say(Message.error))
def post(self, username): pic = self.request.body data = Mydb.addHeadpic(username, pic) if (data): self.write(Message.say(Message.ok)) else: self.write(Message.say(Message.error))
def post(self, *args, **kwargs): inputdata = tornado.escape.json_decode(self.request.body) data = Mydb.add_history(inputdata['fromuser'], inputdata['touser'], inputdata['htype']) if data: self.write(Message.say(Message.ok)) else: self.write(Message.say(Message.error))
def post(self, *args, **kwargs): inputdata = tornado.escape.json_decode(self.request.body) data = Mydb.addUser( inputdata['username', inputdata['password'], inputdata['nickname'], inputdata['mobile'], inputdata['number'], inputdata['pwd']]) if data: self.write(Message.say(Message.ok, data)) else: self.write(Message.say(Message.error))
def get(self, *args, **kwargs): cmd = self.get_query_argument("cmd", "no") if cmd == 'flushdb': Mydb.flushdb() else: self.write("hello")
def get(self, username): result = Mydb.getFriends(username) if result: self.write(Message.say(Message.ok, result)) else: self.write(Message.say(Message.error))
def get(self, username): result = Mydb.getHeadpic(username) self.set_header("Content-Type", "image/jpeg") self.write(result)
def get(self, username): data = Mydb.get_history(username) if data: self.write(Message.say(Message.ok, data)) else: self.write(Message.say(Message.error))