def _get(self, _app_uuid):
        _redis = self.application.redis
        _key = AppUserData.__tablename__ + \
                   ".app_uuid." + _app_uuid + \
                   ".is_service_user.True"
        _user_list = _redis.smembers(_key)
        _users = []
        for _user_uuid in _user_list:
            _user = redis_hash_to_dict(_redis, DeviceUser, _user_uuid)
            if _user == None:
                continue
            _user = single_user(_redis, _user)

            _key = AppUserData.__tablename__ + \
                   ".app_uuid." + _app_uuid + \
                   ".user_uuid." + _user_uuid
            _data_string = _redis.get(_key)
            if _data_string == None:
                continue
            _data_json = json.loads(_data_string)
            _user.update(_data_json)
            _users.append(_user)
            
        _r = self.getReturnData()
        _r["list"] = _users
        return
 def _sort_users(self, _users):
     _redis = self.application.redis
     for _user in _users:
         _updatetime = datetime.datetime.strptime(_user["updatetime"], DATETIME_FORMAT["extra"])
         _user["updatetime"] = int(time.mktime(_updatetime.timetuple()))
     _sorted = sorted(_users, key=itemgetter("updatetime"), reverse=True)
     _return = []
     for _user in _sorted:
         _return.append(single_user(_redis, _user))        
     return _return
    def _get(self, _app_uuid, _conversation_uuid):
        _redis = self.application.redis
        _key = ConversationUserData.__tablename__ + \
               ".conversation_uuid." + _conversation_uuid
        _uuids = _redis.smembers(_key)

        _users = []
        for _user_uuid in _uuids:
            _user = redis_hash_to_dict(_redis, DeviceUser, _user_uuid)
            if _user == None:
                continue
            _single = single_user(_redis, _user)
            _users.append(_single)
            
        _r = self.getReturnData()
        _r["list"] = _users
        return