예제 #1
0
def main():
    for mapid in range(10000001, 10000040 + 1):
        if map_data.exist_map(mapid):
            map_data.set_map_attr(mapid, "country", "US")

    for mapid in range(10010001, 10010040 + 1):
        if map_data.exist_map(mapid):
            map_data.set_map_attr(mapid, "country", "US")
예제 #2
0
    def post(self, cmsg):
        if not util.check_input(cmsg.name, 32):
            return auth.pack(None, const.ERROR_INPUT)

        smsg = smsg_view_map()
        smsg.page = 0

        import platform
        if platform.system() == "Windows":
            return auth.pack(smsg, 0, cmsg.common.userid)

        map_list = None
        import redis_search.query
        # 纯英文数字组合
        if re.match('^[a-zA-Z0-9]+$', cmsg.name):
            if cmsg.name.isdigit() and len(cmsg.name) == 8:
                if int(cmsg.name) < 10010000:
                    return auth.pack(smsg, 0, cmsg.common.userid)

                if map_data.exist_map(cmsg.name):
                    map_list = [cmsg.name]
                else:
                    return auth.pack(smsg, 0, cmsg.common.userid)
            else:
                map_query = redis_search.query.complete(const.TAG_MAP_SEARCH, cmsg.name)
                map_list =  [s["id"] for s in map_query]

                map_query = redis_search.query.query(const.TAG_MAP_SEARCH, cmsg.name)
                map_list_temp =  [s["id"] for s in map_query]
                for itemyuan in map_list_temp:
                    if itemyuan not in map_list:
                        map_list.append(itemyuan)
        # 其他情况
        else:
            map_query = redis_search.query.query(const.TAG_MAP_SEARCH, cmsg.name)
            map_list =  [s["id"] for s in map_query]

        if len(map_list) == 0:
            return auth.pack(smsg, 0, cmsg.common.userid)

        maps                = map_data.get_map_set(0, map_list, "id", "name", "url", "amount", "pass")
        favorite_and_pass   = user_data.is_favourite_and_pass_map(cmsg.common.userid, map_list)
        i = 0
        for info in maps:
            map = smsg.infos.add()
            map.id         = int(info[0])
            map.name       = info[1]
            map.url        = info[2]
            map.amount     = int(info[3])
            map.pas        = int(info[4])
            map.collect    = favorite_and_pass[i * 2]
            map.finish     = favorite_and_pass[i * 2 + 1]
            i = i + 1
        return auth.pack(smsg, 0, cmsg.common.userid)
        

        
        
        
예제 #3
0
def import_test_map():
    global test_map_path
    files = os.listdir(test_map_path)
    for f in files:
        print f
        mapid, sufix = f.split(".")
        if map_data.exist_map(mapid):
            if sufix == "data":
                with open(test_map_path + f, "rb") as f1:
                    data_content = f1.read()
                    map_data.set_map_attr(mapid, "data", data_content)
            if sufix == "url":
                with open(test_map_path + f, "rb") as f2:
                    url_conent = f2.read()
                    map_data.set_map_attr(mapid, "url", url_conent)
예제 #4
0
def main():
    exp = 200
    date = "2016-01-15~2016-01-25"
    data = dict(exp=200,
                date="2016-01-15~2016-01-25",
                version=9,
                cn_subject="官方",
                en_subject="official")
    data = msgpack.dumps(data)
    cache_data.set_cache(const.TAG_CHALLENGE_INFO, data)

    global_data.remove_challenge_map(const.TAG_CHALLENGE_MAP_LIST)
    for mapid in mapids:
        if map_data.exist_map(mapid):
            mapinfo = map_data.get_map_attrs(mapid, "id", "name", "ownername",
                                             "ownerid", "country", "head",
                                             "data")
            mapinfo = msgpack.dumps(mapinfo)
            global_data.add_challenge_map(const.TAG_CHALLENGE_MAP_LIST,
                                          mapinfo)