Python项目之文化和旅游数据可视化


关键词

  • Python后端开发
  • Python网络爬虫
  • Echarts可视化
  • 面向对象(见源码)

一、做什么

国家5A级旅游景区数据可视化
国家级旅游休闲街区数据可视化

在这里插入图片描述

在这里插入图片描述

二、怎么做

1.爬取数据和处理

F12抓包分析
1、数据是否在网页代码中 √ ----->通过静态方式获取即可
2、是否通过接口传输 X
3、是否加密X

在这里插入图片描述

我这里是通过Pyquery直接定位到元素
div .n 获取到城市和数量
div .span 获取的具体的地区


# -*- encoding:utf-8 -*-
__author__ = "Nick"
__created_date__ = "2022/12/10"


import requests
from pyquery import PyQuery as pq


HEADERS = {
    'Accept': 'application/json, text/javascript, */*; q=0.01',
    'Cookie': '_trs_uv=lb3j060h_4419_f53p; yfx_c_g_u_id_10001331=_ck22113018554519555678636775235; yfx_f_l_v_t_10001331=f_t_1669805745954__r_t_1669805745954__v_t_1669805745954__r_c_0',
    'Pragma': 'no-cache',
    'Referer': 'https://sjfw.mct.gov.cn/site/dataservice/rural?type=10',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest',
}


def get_index_code(url):
    # 获取网页源代码
    res = requests.request("GET", url=url, headers=HEADERS)
    res.encoding = "utf-8"
    return res.text


def deal_method(code):
    # 静态数据处理方式,这里通过Pyquery方法
    doc = pq(code)
    return doc


def get_city_and_count(code):
    # 获取城市和数量
    doc = deal_method(code)
    city_list = []
    city = doc.find("div .n")
    for _city in city.items():
        city_list.append(_city.text())
    return city_list[1:]



if __name__ == '__main__':
    # 获取网页源代码
    code = get_index_code(url="https://sjfw.mct.gov.cn/site/dataservice/rural?type=138")
    # 获取城市和数量
    print(get_city_and_count(code))


将下面数据进行处理
[‘北京(2个)’, ‘天津(1个)’, ‘河北(2个)’, ‘山西(1个)’, ‘内蒙古(1个)’, ‘辽宁(1个)’, ‘吉林(1个)’, ‘黑龙江(1个)’, ‘上海(2个)’, ‘江苏(3个)’, ‘浙江(3个)’, ‘安徽(2个)’, ‘福建(3个)’, ‘江西(1个)’, ‘山东(2个)’, ‘河南(2个)’, ‘湖北(1个)’, ‘湖南(2个)’, ‘广东(2个)’, ‘广西(2个)’, ‘海南(1个)’, ‘重庆(3个)’, ‘四川(3个)’, ‘贵州(1个)’, ‘云南(2个)’, ‘西藏(2个)’, ‘陕西(1个)’, ‘甘肃(1个)’, ‘青海(1个)’, ‘宁夏(1个)’, ‘新疆(3个)’]

def deal_count(city_list):
    # 数据二次处理,返回 城市:数量
    city_dict = {}
    for name in city_list:
        # 剔除)
        name = name.strip("个)")
        deal_ = name.split("(")
        city_name = deal_[0]
        count = deal_[1]
        city_dict[city_name] = count
    return city_dict

获取具体地区并进行数据处理

def get_area(code):
    # 实例化处理方法
    doc = deal_method(code)
    area_name = []
    name = doc.find("div .span")
    for _name in name.items():
        area_name.append(_name.text())

    return area_name


def deal_city_area(area_name,city_dict):
    # 处理数据,具体地区分类
    result_list = []
    # 获取具体地区数据
    info_list = area_name
    # 具体数量
    count_list = []
    for count in city_dict.values():
        count_list.append(count)
    # print(count_list)
    # 具体二次数量处理
    count_list_two = [0, ]
    _count = 0
    for i in count_list:
        _count = _count + int(i)
        count_list_two.append(_count)
    # print(count_list_two)
    index_count = len(count_list_two) - 1
    for i in range(index_count):
        first = count_list_two[i]
        end = count_list_two[i + 1]
        result = info_list[first:end]
        result_list.append(result)
        # result_dict[name] = result
        continue
    return result_list

def city_and_area(result_list, city_dict):
    # 获取城市+具体地区数量
    result_dict = {}
    name_list = []
    for name in city_dict.keys():
        name_list.append(name)
    for i in range(len(name_list)):
        name = name_list[i]
        city_area = result_list[i]
        result_dict[name] = city_area
    return result_dict

if __name__ == '__main__':
    # 获取网页源代码
    code = get_index_code(url="https://sjfw.mct.gov.cn/site/dataservice/rural?type=138")
    # 获取城市和数量
    city_list = get_city_and_count(code)
    # 数据进行处理
    city_dict = deal_count(city_list)
    # 获取具体地区
    area_name = get_area(code)
    # 处理数据-把具体地区按城市进行分类
    result_list = deal_city_area(area_name, city_dict)
    # 处理数据,城市:具体地区
    print(city_and_area(result_list,city_dict))

最后的处理的数据如下
{‘北京’: [‘北京市东城区前门大街’, ‘北京市朝阳区三里屯太古里’], ‘天津’: [‘天津市西青区杨柳青古镇街区’], ‘河北’: [‘河北省唐山市路北区培仁历史文化街’, ‘河北省承德市双桥区金龙旅游休闲街区’], ‘山西’: [‘山西省忻州市忻府区古城文旅休闲生活街区’], ‘内蒙古’: [‘内蒙古自治区呼和浩特市玉泉区塞上老街旅游休闲街区’], ‘辽宁’: [‘辽宁省沈阳市沈河区中街旅游休闲街区’], ‘吉林’: [‘吉林省长白山管委会白桦旅游休闲街区’], ‘黑龙江’: [‘黑龙江省哈尔滨市道里区中央大街步行街’], ‘上海’: [‘上海市黄浦区思南公馆街区’, ‘上海市徐汇区武康路-安福路街区’], ‘江苏’: [‘江苏省无锡市梁溪区清名桥历史文化街区’, ‘江苏省南京市秦淮区夫子庙步行街’, ‘江苏省苏州市姑苏区平江历史街区’], ‘浙江’: [‘浙江省杭州市上城区清河坊历史文化街区’, ‘浙江省宁波市江北区老外滩街区’, ‘浙江省温州市鹿城区五马历史文化街区’], ‘安徽’: [‘安徽省合肥市包河区罍街’, ‘安徽省黄山市屯溪区黎阳映像街区’], ‘福建’: [‘福建省福州市鼓楼区三坊七巷历史文化街区’, ‘福建省福州市台江区上下杭历史文化街区’, ‘福建省泉州市晋江市五店市传统文化旅游区’], ‘江西’: [‘江西省上饶市鄱阳县饶州古镇旅游休闲街区’], ‘山东’: [‘山东省济南市历下区百花洲历史文化街区’, ‘山东省淄博市周村区古商城历史文化街区’], ‘河南’: [‘河南省郑州市二七区德化步行街’, ‘河南省洛阳市老城区洛阳古城历史文化街区’], ‘湖北’: [‘湖北省襄阳市襄城区襄阳北街’], ‘湖南’: [‘湖南省长沙市天心区太平街’, ‘湖南省常德市柳叶湖区河街’], ‘广东’: [‘广东省广州市荔湾区永庆坊’, ‘广东省潮州市湘桥区牌坊街’], ‘广西’: [‘广西壮族自治区南宁市兴宁区老南宁·三街两巷历史文化街区’, ‘广西壮族自治区桂林市秀峰区东西巷历史文化街区’], ‘海南’: [‘海南省海口市龙华区骑楼建筑历史文化街区’], ‘重庆’: [‘重庆市江北区大九街旅游休闲街区’, ‘重庆市沙坪坝区磁器口街区’, ‘重庆市南岸区弹子石老街’], ‘四川’: [‘四川省成都市武侯区武侯祠·锦里’, ‘四川省成都市锦江区春熙路’, ‘四川省成都市青羊区宽窄巷子’], ‘贵州’: [‘贵州省黔东南苗族侗族自治州镇远县镇远古城文化步行街’], ‘云南’: [‘云南省丽江市古城区大研花巷旅游休闲街区’, ‘云南省红河哈尼族彝族自治州建水县临安古城主题特色街区’], ‘西藏’: [‘西藏自治区拉萨市城关区慈觉林藏院风情街’, ‘西藏自治区昌都市卡若区茶马城街区’], ‘陕西’: [‘陕西省安康市石泉县秦巴老街’], ‘甘肃’: [‘甘肃省临夏回族自治州临夏市八坊十三巷’], ‘青海’: [‘青海省西宁市城西区唐道·637休闲文旅步行街’], ‘宁夏’: [‘宁夏回族自治区银川市西夏区怀远旅游休闲街区’], ‘新疆’: [‘新疆维吾尔自治区乌鲁木齐市天山区大巴扎旅游休闲街区’, ‘新疆维吾尔自治区伊犁哈萨克自治州伊宁市六星街历史文化街区’, ‘新疆生产建设兵团第八师石河子市幸福路步行街’]}

2.数据库设计,并将数据写入数据库

省份表province

CREATE TABLE `province` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `province_name` varchar(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;


INSERT INTO `province` VALUES (1, '北京');
INSERT INTO `province` VALUES (2, '天津');
INSERT INTO `province` VALUES (3, '河北');
INSERT INTO `province` VALUES (4, '山西');
INSERT INTO `province` VALUES (5, '内蒙古');
INSERT INTO `province` VALUES (6, '辽宁');
INSERT INTO `province` VALUES (7, '吉林');
INSERT INTO `province` VALUES (8, '黑龙江');
INSERT INTO `province` VALUES (9, '上海');
INSERT INTO `province` VALUES (10, '江苏');
INSERT INTO `province` VALUES (11, '浙江');
INSERT INTO `province` VALUES (12, '安徽');
INSERT INTO `province` VALUES (13, '福建');
INSERT INTO `province` VALUES (14, '江西');
INSERT INTO `province` VALUES (15, '山东');
INSERT INTO `province` VALUES (16, '河南');
INSERT INTO `province` VALUES (17, '湖北');
INSERT INTO `province` VALUES (18, '湖南');
INSERT INTO `province` VALUES (19, '广东');
INSERT INTO `province` VALUES (20, '广西');
INSERT INTO `province` VALUES (21, '海南');
INSERT INTO `province` VALUES (22, '重庆');
INSERT INTO `province` VALUES (23, '四川');
INSERT INTO `province` VALUES (24, '贵州');
INSERT INTO `province` VALUES (25, '云南');
INSERT INTO `province` VALUES (26, '西藏');
INSERT INTO `province` VALUES (27, '陕西');
INSERT INTO `province` VALUES (28, '甘肃');
INSERT INTO `province` VALUES (29, '青海');
INSERT INTO `province` VALUES (30, '宁夏');
INSERT INTO `province` VALUES (31, '新疆');

category_travel表

CREATE TABLE `category_travel` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `category_name` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

INSERT INTO `category_travel` VALUES (1, '国家级旅游休闲街区');
INSERT INTO `category_travel` VALUES (2, '国家5A级旅游景区');

detail 表

CREATE TABLE `detail` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `area_name` varchar(100) NOT NULL,
  `category_name_id` bigint(20) NOT NULL,
  `province_name_id` bigint(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `detail_category_name_id_c2480191_fk_category_travel_id` (`category_name_id`),
  KEY `detail_province_name_id_8eae059e_fk_province_id` (`province_name_id`),
  CONSTRAINT `detail_category_name_id_c2480191_fk_category_travel_id` FOREIGN KEY (`category_name_id`) REFERENCES `category_travel` (`id`),
  CONSTRAINT `detail_province_name_id_8eae059e_fk_province_id` FOREIGN KEY (`province_name_id`) REFERENCES `province` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=378 DEFAULT CHARSET=utf8;

将数据写入数据库,这里就提供SQL语句,详细最后源码或下方有提供数据SQL语句


# 查询语句
def select(name):
    # 先查询id
    select_sql = f"""
       select id from province where province_name = '{name}'
       """
    return select_sql

# 插入语句
def add(name, category_id, province_id):
    insert_sql = f"""
    insert into detail(area_name, category_name_id, province_name_id) values ('{name}', {category_id}, {province_id})
    """
    return insert_sql

INSERT INTO `detail` VALUES (5, '北京市东城区前门大街', 1, 1);
INSERT INTO `detail` VALUES (6, '北京市朝阳区三里屯太古里', 1, 1);
INSERT INTO `detail` VALUES (7, '天津市西青区杨柳青古镇街区', 1, 2);
INSERT INTO `detail` VALUES (8, '河北省唐山市路北区培仁历史文化街', 1, 3);
INSERT INTO `detail` VALUES (9, '河北省承德市双桥区金龙旅游休闲街区', 1, 3);
INSERT INTO `detail` VALUES (10, '山西省忻州市忻府区古城文旅休闲生活街区', 1, 4);
INSERT INTO `detail` VALUES (11, '内蒙古自治区呼和浩特市玉泉区塞上老街旅游休闲街区', 1, 5);
INSERT INTO `detail` VALUES (12, '辽宁省沈阳市沈河区中街旅游休闲街区', 1, 6);
INSERT INTO `detail` VALUES (13, '吉林省长白山管委会白桦旅游休闲街区', 1, 7);
INSERT INTO `detail` VALUES (14, '黑龙江省哈尔滨市道里区中央大街步行街', 1, 8);
INSERT INTO `detail` VALUES (15, '上海市黄浦区思南公馆街区', 1, 9);
INSERT INTO `detail` VALUES (16, '上海市徐汇区武康路-安福路街区', 1, 9);
INSERT INTO `detail` VALUES (17, '江苏省无锡市梁溪区清名桥历史文化街区', 1, 10);
INSERT INTO `detail` VALUES (18, '江苏省南京市秦淮区夫子庙步行街', 1, 10);
INSERT INTO `detail` VALUES (19, '江苏省苏州市姑苏区平江历史街区', 1, 10);
INSERT INTO `detail` VALUES (20, '浙江省杭州市上城区清河坊历史文化街区', 1, 11);
INSERT INTO `detail` VALUES (21, '浙江省宁波市江北区老外滩街区', 1, 11);
INSERT INTO `detail` VALUES (22, '浙江省温州市鹿城区五马历史文化街区', 1, 11);
INSERT INTO `detail` VALUES (23, '安徽省合肥市包河区罍街', 1, 12);
INSERT INTO `detail` VALUES (24, '安徽省黄山市屯溪区黎阳映像街区', 1, 12);
INSERT INTO `detail` VALUES (25, '福建省福州市鼓楼区三坊七巷历史文化街区', 1, 13);
INSERT INTO `detail` VALUES (26, '福建省福州市台江区上下杭历史文化街区', 1, 13);
INSERT INTO `detail` VALUES (27, '福建省泉州市晋江市五店市传统文化旅游区', 1, 13);
INSERT INTO `detail` VALUES (28, '江西省上饶市鄱阳县饶州古镇旅游休闲街区', 1, 14);
INSERT INTO `detail` VALUES (29, '山东省济南市历下区百花洲历史文化街区', 1, 15);
INSERT INTO `detail` VALUES (30, '山东省淄博市周村区古商城历史文化街区', 1, 15);
INSERT INTO `detail` VALUES (31, '河南省郑州市二七区德化步行街', 1, 16);
INSERT INTO `detail` VALUES (32, '河南省洛阳市老城区洛阳古城历史文化街区', 1, 16);
INSERT INTO `detail` VALUES (33, '湖北省襄阳市襄城区襄阳北街', 1, 17);
INSERT INTO `detail` VALUES (34, '湖南省长沙市天心区太平街', 1, 18);
INSERT INTO `detail` VALUES (35, '湖南省常德市柳叶湖区河街', 1, 18);
INSERT INTO `detail` VALUES (36, '广东省广州市荔湾区永庆坊', 1, 19);
INSERT INTO `detail` VALUES (37, '广东省潮州市湘桥区牌坊街', 1, 19);
INSERT INTO `detail` VALUES (38, '广西壮族自治区南宁市兴宁区老南宁·三街两巷历史文化街区', 1, 20);
INSERT INTO `detail` VALUES (39, '广西壮族自治区桂林市秀峰区东西巷历史文化街区', 1, 20);
INSERT INTO `detail` VALUES (40, '海南省海口市龙华区骑楼建筑历史文化街区', 1, 21);
INSERT INTO `detail` VALUES (41, '重庆市江北区大九街旅游休闲街区', 1, 22);
INSERT INTO `detail` VALUES (42, '重庆市沙坪坝区磁器口街区', 1, 22);
INSERT INTO `detail` VALUES (43, '重庆市南岸区弹子石老街', 1, 22);
INSERT INTO `detail` VALUES (44, '四川省成都市武侯区武侯祠·锦里', 1, 23);
INSERT INTO `detail` VALUES (45, '四川省成都市锦江区春熙路', 1, 23);
INSERT INTO `detail` VALUES (46, '四川省成都市青羊区宽窄巷子', 1, 23);
INSERT INTO `detail` VALUES (47, '贵州省黔东南苗族侗族自治州镇远县镇远古城文化步行街', 1, 24);
INSERT INTO `detail` VALUES (48, '云南省丽江市古城区大研花巷旅游休闲街区', 1, 25);
INSERT INTO `detail` VALUES (49, '云南省红河哈尼族彝族自治州建水县临安古城主题特色街区', 1, 25);
INSERT INTO `detail` VALUES (50, '西藏自治区拉萨市城关区慈觉林藏院风情街', 1, 26);
INSERT INTO `detail` VALUES (51, '西藏自治区昌都市卡若区茶马城街区', 1, 26);
INSERT INTO `detail` VALUES (52, '陕西省安康市石泉县秦巴老街', 1, 27);
INSERT INTO `detail` VALUES (53, '甘肃省临夏回族自治州临夏市八坊十三巷', 1, 28);
INSERT INTO `detail` VALUES (54, '青海省西宁市城西区唐道·637休闲文旅步行街', 1, 29);
INSERT INTO `detail` VALUES (55, '宁夏回族自治区银川市西夏区怀远旅游休闲街区', 1, 30);
INSERT INTO `detail` VALUES (56, '新疆维吾尔自治区乌鲁木齐市天山区大巴扎旅游休闲街区', 1, 31);
INSERT INTO `detail` VALUES (57, '新疆维吾尔自治区伊犁哈萨克自治州伊宁市六星街历史文化街区', 1, 31);
INSERT INTO `detail` VALUES (58, '新疆生产建设兵团第八师石河子市幸福路步行街', 1, 31);
INSERT INTO `detail` VALUES (59, '北京市海淀区圆明园景区', 2, 1);
INSERT INTO `detail` VALUES (60, '北京市奥林匹克公园', 2, 1);
INSERT INTO `detail` VALUES (61, '恭王府景区', 2, 1);
INSERT INTO `detail` VALUES (62, '北京市明十三陵景区', 2, 1);
INSERT INTO `detail` VALUES (63, '北京八达岭-慕田峪长城旅游区', 2, 1);
INSERT INTO `detail` VALUES (64, '颐和园', 2, 1);
INSERT INTO `detail` VALUES (65, '天坛公园', 2, 1);
INSERT INTO `detail` VALUES (66, '故宫博物院', 2, 1);
INSERT INTO `detail` VALUES (67, '天津盘山风景名胜区', 2, 2);
INSERT INTO `detail` VALUES (68, '天津古文化街旅游区(津门故里)', 2, 2);
INSERT INTO `detail` VALUES (69, '河北省承德市金山岭长城景区', 2, 3);
INSERT INTO `detail` VALUES (70, '河北省保定市清西陵景区', 2, 3);
INSERT INTO `detail` VALUES (71, '秦皇岛市山海关景区', 2, 3);
INSERT INTO `detail` VALUES (72, '河北省保定市白石山景区', 2, 3);
INSERT INTO `detail` VALUES (73, '河北省邯郸市广府古城景区', 2, 3);
INSERT INTO `detail` VALUES (74, '邯郸市娲皇宫景区', 2, 3);
INSERT INTO `detail` VALUES (75, '唐山市清东陵景区', 2, 3);
INSERT INTO `detail` VALUES (76, '河北省石家庄市西柏坡景区', 2, 3);
INSERT INTO `detail` VALUES (77, '河北保定野三坡景区', 2, 3);
INSERT INTO `detail` VALUES (78, '保定市安新白洋淀景区', 2, 3);
INSERT INTO `detail` VALUES (79, '承德避暑山庄及周围寺庙景区', 2, 3);
INSERT INTO `detail` VALUES (80, '黄河壶口瀑布旅游区(陕西省延安市·山西省临汾市)', 2, 4);
INSERT INTO `detail` VALUES (81, '山西省临汾市云丘山景区', 2, 4);
INSERT INTO `detail` VALUES (82, '山西省长治市壶关太行山大峡谷八泉峡景区', 2, 4);
INSERT INTO `detail` VALUES (83, '山西省临汾市洪洞大槐树寻根祭祖园景区', 2, 4);
INSERT INTO `detail` VALUES (84, '山西省忻州市雁门关景区', 2, 4);
INSERT INTO `detail` VALUES (85, '晋中市平遥古城景区', 2, 4);
INSERT INTO `detail` VALUES (86, '晋中市介休绵山景区', 2, 4);
INSERT INTO `detail` VALUES (87, '山西晋城皇城相府生态文化旅游区', 2, 4);
INSERT INTO `detail` VALUES (88, '忻州市五台山风景名胜区', 2, 4);
INSERT INTO `detail` VALUES (89, '大同市云冈石窟', 2, 4);
INSERT INTO `detail` VALUES (90, '内蒙古自治区阿拉善盟胡杨林旅游区', 2, 5);
INSERT INTO `detail` VALUES (91, '内蒙古自治区赤峰市阿斯哈图石阵旅游区', 2, 5);
INSERT INTO `detail` VALUES (92, '内蒙古自治区阿尔山·柴河旅游景区', 2, 5);
INSERT INTO `detail` VALUES (93, '内蒙古自治区满洲里市中俄边境旅游区', 2, 5);
INSERT INTO `detail` VALUES (94, '内蒙古鄂尔多斯成吉思汗陵旅游区', 2, 5);
INSERT INTO `detail` VALUES (95, '内蒙古鄂尔多斯响沙湾旅游景区', 2, 5);
INSERT INTO `detail` VALUES (96, '辽宁省盘锦市红海滩风景廊道景区', 2, 6);
INSERT INTO `detail` VALUES (97, '辽宁省鞍山市千山景区', 2, 6);
INSERT INTO `detail` VALUES (98, '本溪市本溪水洞景区', 2, 6);
INSERT INTO `detail` VALUES (99, '辽宁大连金石滩景区', 2, 6);
INSERT INTO `detail` VALUES (100, '大连老虎滩海洋公园.老虎滩极地馆', 2, 6);
INSERT INTO `detail` VALUES (101, '沈阳市植物园', 2, 6);
INSERT INTO `detail` VALUES (102, '吉林省通化市高句丽文物古迹旅游景区', 2, 7);
INSERT INTO `detail` VALUES (103, '吉林省长春市世界雕塑公园旅游景区', 2, 7);
INSERT INTO `detail` VALUES (104, '敦化市六鼎山文化旅游区', 2, 7);
INSERT INTO `detail` VALUES (105, '长春市长影世纪城旅游区', 2, 7);
INSERT INTO `detail` VALUES (106, '吉林长春净月潭景区', 2, 7);
INSERT INTO `detail` VALUES (107, '长春市伪满皇宫博物院', 2, 7);
INSERT INTO `detail` VALUES (108, '长白山景区', 2, 7);
INSERT INTO `detail` VALUES (109, '黑龙江省虎林市虎头旅游景区', 2, 8);
INSERT INTO `detail` VALUES (110, '漠河北极村旅游区', 2, 8);
INSERT INTO `detail` VALUES (111, '伊春市汤旺河林海奇石景区', 2, 8);
INSERT INTO `detail` VALUES (112, '黑龙江牡丹江镜泊湖景区', 2, 8);
INSERT INTO `detail` VALUES (113, '黑龙江黑河五大连池景区', 2, 8);
INSERT INTO `detail` VALUES (114, '哈尔滨市太阳岛景区', 2, 8);
INSERT INTO `detail` VALUES (115, '上海市中国共产党一大·二大·四大纪念馆景区', 2, 9);
INSERT INTO `detail` VALUES (116, '上海科技馆', 2, 9);
INSERT INTO `detail` VALUES (117, '上海野生动物园', 2, 9);
INSERT INTO `detail` VALUES (118, '上海东方明珠广播电视塔', 2, 9);
INSERT INTO `detail` VALUES (119, '江苏省宿迁市洪泽湖湿地景区', 2, 10);
INSERT INTO `detail` VALUES (120, '江苏省无锡市惠山古镇景区', 2, 10);
INSERT INTO `detail` VALUES (121, '江苏省常州市中国春秋淹城旅游区', 2, 10);
INSERT INTO `detail` VALUES (122, '江苏省连云港花果山景区', 2, 10);
INSERT INTO `detail` VALUES (123, '江苏省徐州市云龙湖景区', 2, 10);
INSERT INTO `detail` VALUES (124, '大丰中华麋鹿园景区', 2, 10);
INSERT INTO `detail` VALUES (125, '周恩来故里旅游景区', 2, 10);
INSERT INTO `detail` VALUES (126, '镇江市句容茅山景区', 2, 10);
INSERT INTO `detail` VALUES (127, '常州市天目湖景区', 2, 10);
INSERT INTO `detail` VALUES (128, '苏州市沙家浜·虞山尚湖旅游区', 2, 10);
INSERT INTO `detail` VALUES (129, '苏州市吴中太湖旅游区', 2, 10);
INSERT INTO `detail` VALUES (130, '无锡市鼋头渚景区', 2, 10);
INSERT INTO `detail` VALUES (131, '镇江市金山·焦山·北固山旅游景区', 2, 10);
INSERT INTO `detail` VALUES (132, '苏州市金鸡湖景区', 2, 10);
INSERT INTO `detail` VALUES (133, '江苏省姜堰市溱湖旅游景区', 2, 10);
INSERT INTO `detail` VALUES (134, '南通市濠河景区', 2, 10);
INSERT INTO `detail` VALUES (135, '扬州市瘦西湖风景区', 2, 10);
INSERT INTO `detail` VALUES (136, '常州市环球恐龙城休闲旅游区', 2, 10);
INSERT INTO `detail` VALUES (137, '南京市夫子庙-秦淮风光带景区', 2, 10);
INSERT INTO `detail` VALUES (138, '苏州市同里古镇景区', 2, 10);
INSERT INTO `detail` VALUES (139, '无锡市灵山景区', 2, 10);
INSERT INTO `detail` VALUES (140, '中央电视台无锡影视基地三国水浒景区', 2, 10);
INSERT INTO `detail` VALUES (141, '南京市钟山风景名胜区-中山陵园风景区', 2, 10);
INSERT INTO `detail` VALUES (142, '苏州市周庄古镇景区', 2, 10);
INSERT INTO `detail` VALUES (143, '苏州园林(拙政园、虎丘山、留园)', 2, 10);
INSERT INTO `detail` VALUES (144, '浙江省台州市台州府城文化旅游区', 2, 11);
INSERT INTO `detail` VALUES (145, '浙江省温州市刘伯温故里景区', 2, 11);
INSERT INTO `detail` VALUES (146, '浙江省丽水市缙云仙都景区', 2, 11);
INSERT INTO `detail` VALUES (147, '浙江省宁波市天一阁·月湖景区', 2, 11);
INSERT INTO `detail` VALUES (148, '浙江省衢州市江郎山·廿八都景区', 2, 11);
INSERT INTO `detail` VALUES (149, '浙江省嘉兴市西塘古镇旅游景区', 2, 11);
INSERT INTO `detail` VALUES (150, '台州市神仙居景区', 2, 11);
INSERT INTO `detail` VALUES (151, '台州市天台山景区', 2, 11);
INSERT INTO `detail` VALUES (152, '湖州市南浔古镇景区', 2, 11);
INSERT INTO `detail` VALUES (153, '衢州市开化根宫佛国文化旅游景区', 2, 11);
INSERT INTO `detail` VALUES (154, '浙江省绍兴市鲁迅故里沈园景区', 2, 11);
INSERT INTO `detail` VALUES (155, '浙江省杭州西溪湿地旅游区', 2, 11);
INSERT INTO `detail` VALUES (156, '浙江省嘉兴市南湖旅游区', 2, 11);
INSERT INTO `detail` VALUES (157, '金华市东阳横店影视城景区', 2, 11);
INSERT INTO `detail` VALUES (158, '宁波市奉化溪口-滕头旅游景区', 2, 11);
INSERT INTO `detail` VALUES (159, '嘉兴市桐乡乌镇古镇旅游区', 2, 11);
INSERT INTO `detail` VALUES (160, '杭州市千岛湖风景名胜区', 2, 11);
INSERT INTO `detail` VALUES (161, '舟山市普陀山风景名胜区', 2, 11);
INSERT INTO `detail` VALUES (162, '温州市雁荡山风景名胜区', 2, 11);
INSERT INTO `detail` VALUES (163, '杭州市西湖风景名胜区', 2, 11);
INSERT INTO `detail` VALUES (164, '安徽省马鞍山市长江采石矶文化生态旅游区', 2, 12);
INSERT INTO `detail` VALUES (165, '安徽省六安市万佛湖景区', 2, 12);
INSERT INTO `detail` VALUES (166, '安徽省芜湖市方特旅游区', 2, 12);
INSERT INTO `detail` VALUES (167, '合肥市三河古镇景区', 2, 12);
INSERT INTO `detail` VALUES (168, '黄山市古徽州文化旅游区', 2, 12);
INSERT INTO `detail` VALUES (169, '阜阳市颍上八里河景区', 2, 12);
INSERT INTO `detail` VALUES (170, '安徽省宣城市绩溪龙川景区', 2, 12);
INSERT INTO `detail` VALUES (171, '六安市天堂寨旅游景区', 2, 12);
INSERT INTO `detail` VALUES (172, '安徽省黄山市皖南古村落—西递宏村', 2, 12);
INSERT INTO `detail` VALUES (173, '安徽省安庆市天柱山风景区', 2, 12);
INSERT INTO `detail` VALUES (174, '池州市九华山风景区', 2, 12);
INSERT INTO `detail` VALUES (175, '黄山市黄山风景区', 2, 12);
INSERT INTO `detail` VALUES (176, '福建省莆田市湄洲岛妈祖文化旅游区', 2, 13);
INSERT INTO `detail` VALUES (177, '龙岩市古田旅游区', 2, 13);
INSERT INTO `detail` VALUES (178, '福州市三坊七巷景区', 2, 13);
INSERT INTO `detail` VALUES (179, '宁德市福鼎太姥山旅游区', 2, 13);
INSERT INTO `detail` VALUES (180, '泉州市清源山景区', 2, 13);
INSERT INTO `detail` VALUES (181, '宁德市白水洋-鸳鸯溪旅游区', 2, 13);
INSERT INTO `detail` VALUES (182, '福建省土楼(永定·南靖)旅游', 2, 13);
INSERT INTO `detail` VALUES (183, '福建省三明市泰宁风景旅游区', 2, 13);
INSERT INTO `detail` VALUES (184, '南平市武夷山风景名胜区', 2, 13);
INSERT INTO `detail` VALUES (185, '厦门市鼓浪屿风景名胜区', 2, 13);
INSERT INTO `detail` VALUES (186, '江西省赣州市三百山景区', 2, 14);
INSERT INTO `detail` VALUES (187, '江西省九江市庐山西海景区', 2, 14);
INSERT INTO `detail` VALUES (188, '江西省萍乡市武功山景区', 2, 14);
INSERT INTO `detail` VALUES (189, '江西省南昌市滕王阁旅游区', 2, 14);
INSERT INTO `detail` VALUES (190, '江西省上饶市龟峰景区', 2, 14);
INSERT INTO `detail` VALUES (191, '江西省抚州市大觉山景区', 2, 14);
INSERT INTO `detail` VALUES (192, '宜春市明月山旅游区', 2, 14);
INSERT INTO `detail` VALUES (193, '瑞金市共和国摇篮旅游区', 2, 14);
INSERT INTO `detail` VALUES (194, '景德镇古窑民俗博览区', 2, 14);
INSERT INTO `detail` VALUES (195, '上饶市婺源江湾景区', 2, 14);
INSERT INTO `detail` VALUES (196, '江西省鹰潭市龙虎山旅游景区', 2, 14);
INSERT INTO `detail` VALUES (197, '江西省上饶市三清山旅游景区', 2, 14);
INSERT INTO `detail` VALUES (198, '吉安市井冈山风景旅游区', 2, 14);
INSERT INTO `detail` VALUES (199, '江西省庐山风景名胜区', 2, 14);
INSERT INTO `detail` VALUES (200, '山东省济宁市微山湖旅游区', 2, 15);
INSERT INTO `detail` VALUES (201, '山东省临沂市萤火虫水洞·地下大峡谷旅游区', 2, 15);
INSERT INTO `detail` VALUES (202, '山东省东营市黄河口生态旅游区', 2, 15);
INSERT INTO `detail` VALUES (203, '山东省威海市华夏城旅游景区', 2, 15);
INSERT INTO `detail` VALUES (204, '山东省潍坊市青州古城旅游区', 2, 15);
INSERT INTO `detail` VALUES (205, '山东省沂蒙山旅游区', 2, 15);
INSERT INTO `detail` VALUES (206, '济南市天下第一泉景区', 2, 15);
INSERT INTO `detail` VALUES (207, '枣庄市台儿庄古城景区', 2, 15);
INSERT INTO `detail` VALUES (208, '山东烟台龙口南山景区', 2, 15);
INSERT INTO `detail` VALUES (209, '山东威海刘公岛景区', 2, 15);
INSERT INTO `detail` VALUES (210, '山东青岛崂山景区', 2, 15);
INSERT INTO `detail` VALUES (211, '济宁市曲阜明故城(三孔)旅游区', 2, 15);
INSERT INTO `detail` VALUES (212, '烟台市蓬莱阁旅游区(三仙山-八仙过海)', 2, 15);
INSERT INTO `detail` VALUES (213, '泰安市泰山景区', 2, 15);
INSERT INTO `detail` VALUES (214, '河南省信阳市鸡公山景区', 2, 16);
INSERT INTO `detail` VALUES (215, '河南省新乡市八里沟景区', 2, 16);
INSERT INTO `detail` VALUES (216, '河南省永城市芒砀山旅游景区', 2, 16);
INSERT INTO `detail` VALUES (217, '河南省红旗渠·太行大峡谷', 2, 16);
INSERT INTO `detail` VALUES (218, '驻马店市嵖岈山旅游景区', 2, 16);
INSERT INTO `detail` VALUES (219, '南阳市西峡伏牛山老界岭·恐龙遗址园旅游区', 2, 16);
INSERT INTO `detail` VALUES (220, '洛阳市龙潭大峡谷景区', 2, 16);
INSERT INTO `detail` VALUES (221, '河南省洛阳栾川老君山·鸡冠洞旅游区', 2, 16);
INSERT INTO `detail` VALUES (222, '河南省平顶山市尧山-中原大佛景区', 2, 16);
INSERT INTO `detail` VALUES (223, '河南开封清明上河园', 2, 16);
INSERT INTO `detail` VALUES (224, '河南洛阳白云山景区', 2, 16);
INSERT INTO `detail` VALUES (225, '河南安阳殷墟景区', 2, 16);
INSERT INTO `detail` VALUES (226, '焦作市云台山-神农山·青天河景区', 2, 16);
INSERT INTO `detail` VALUES (227, '洛阳市龙门石窟景区', 2, 16);
INSERT INTO `detail` VALUES (228, '登封市嵩山少林景区', 2, 16);
INSERT INTO `detail` VALUES (229, '湖北省宜昌市三峡大瀑布景区', 2, 17);
INSERT INTO `detail` VALUES (230, '湖北省恩施州腾龙洞景区', 2, 17);
INSERT INTO `detail` VALUES (231, '湖北省襄阳市古隆中景区', 2, 17);
INSERT INTO `detail` VALUES (232, '湖北省咸宁市三国赤壁古战场景区', 2, 17);
INSERT INTO `detail` VALUES (233, '恩施州恩施大峡谷景区', 2, 17);
INSERT INTO `detail` VALUES (234, '武汉市黄陂木兰文化生态旅游区', 2, 17);
INSERT INTO `detail` VALUES (235, '武汉市东湖景区', 2, 17);
INSERT INTO `detail` VALUES (236, '宜昌市长阳清江画廊景区', 2, 17);
INSERT INTO `detail` VALUES (237, '湖北省神农架旅游区', 2, 17);
INSERT INTO `detail` VALUES (238, '湖北省恩施州神农溪纤夫文化旅游区', 2, 17);
INSERT INTO `detail` VALUES (239, '湖北省十堰市武当山风景区', 2, 17);
INSERT INTO `detail` VALUES (240, '湖北省宜昌市三峡人家风景区', 2, 17);
INSERT INTO `detail` VALUES (241, '宜昌市三峡大坝-屈原故里旅游区', 2, 17);
INSERT INTO `detail` VALUES (242, '武汉市黄鹤楼公园', 2, 17);
INSERT INTO `detail` VALUES (243, '湖南省湘西土家族苗族自治州矮寨·十八洞·德夯大峡谷景区', 2, 18);
INSERT INTO `detail` VALUES (244, '湖南省常德市桃花源旅游区', 2, 18);
INSERT INTO `detail` VALUES (245, '湖南省株洲市炎帝陵景区', 2, 18);
INSERT INTO `detail` VALUES (246, '湖南省邵阳市崀山景区', 2, 18);
INSERT INTO `detail` VALUES (247, '郴州市东江湖旅游区', 2, 18);
INSERT INTO `detail` VALUES (248, '长沙市花明楼景区', 2, 18);
INSERT INTO `detail` VALUES (249, '湖南省长沙市岳麓山·橘子洲旅游区', 2, 18);
INSERT INTO `detail` VALUES (250, '湖南省岳阳市岳阳楼—君山岛景区', 2, 18);
INSERT INTO `detail` VALUES (251, '湖南省湘潭市韶山旅游区', 2, 18);
INSERT INTO `detail` VALUES (252, '衡阳市南岳衡山旅游区', 2, 18);
INSERT INTO `detail` VALUES (253, '张家界武陵源—天门山旅游区', 2, 18);
INSERT INTO `detail` VALUES (254, '广东省江门市开平碉楼文化旅游区', 2, 19);
INSERT INTO `detail` VALUES (255, '广东省肇庆市星湖旅游景区', 2, 19);
INSERT INTO `detail` VALUES (256, '广东省惠州市惠州西湖旅游景区', 2, 19);
INSERT INTO `detail` VALUES (257, '广东省中山市孙中山故里旅游区', 2, 19);
INSERT INTO `detail` VALUES (258, '阳江市海陵岛大角湾海上丝路旅游区', 2, 19);
INSERT INTO `detail` VALUES (259, '佛山市长鹿旅游休博园', 2, 19);
INSERT INTO `detail` VALUES (260, '惠州市罗浮山景区', 2, 19);
INSERT INTO `detail` VALUES (261, '佛山市西樵山景区', 2, 19);
INSERT INTO `detail` VALUES (262, '广东省韶关市丹霞山景区', 2, 19);
INSERT INTO `detail` VALUES (263, '广东省清远市连州地下河旅游景区', 2, 19);
INSERT INTO `detail` VALUES (264, '深圳市观澜湖休闲旅游区', 2, 19);
INSERT INTO `detail` VALUES (265, '梅州市雁南飞茶田景区', 2, 19);
INSERT INTO `detail` VALUES (266, '广东省广州市白云山风景区', 2, 19);
INSERT INTO `detail` VALUES (267, '深圳华侨城旅游度假区', 2, 19);
INSERT INTO `detail` VALUES (268, '广州市长隆旅游度假区', 2, 19);
INSERT INTO `detail` VALUES (269, '广西壮族自治区贺州市黄姚古镇景区', 2, 20);
INSERT INTO `detail` VALUES (270, '广西壮族自治区北海市涠洲岛南湾鳄鱼山景区', 2, 20);
INSERT INTO `detail` VALUES (271, '广西壮族自治区百色市百色起义纪念园景区', 2, 20);
INSERT INTO `detail` VALUES (272, '广西壮族自治区崇左市德天跨国瀑布景区', 2, 20);
INSERT INTO `detail` VALUES (273, '广西自治区桂林市两江四湖·象山景区', 2, 20);
INSERT INTO `detail` VALUES (274, '南宁市青秀山旅游区', 2, 20);
INSERT INTO `detail` VALUES (275, '桂林市独秀峰-王城景区', 2, 20);
INSERT INTO `detail` VALUES (276, '桂林市乐满地度假世界', 2, 20);
INSERT INTO `detail` VALUES (277, '桂林市漓江景区', 2, 20);
INSERT INTO `detail` VALUES (278, '海南省三亚市蜈支洲岛旅游区', 2, 21);
INSERT INTO `detail` VALUES (279, '海南槟榔谷黎苗文化旅游区', 2, 21);
INSERT INTO `detail` VALUES (280, '分界洲岛旅游区', 2, 21);
INSERT INTO `detail` VALUES (281, '海南呀诺达雨林文化旅游区', 2, 21);
INSERT INTO `detail` VALUES (282, '三亚市南山大小洞天旅游区', 2, 21);
INSERT INTO `detail` VALUES (283, '三亚市南山文化旅游区', 2, 21);
INSERT INTO `detail` VALUES (284, '重庆市奉节县白帝城·瞿塘峡景区', 2, 22);
INSERT INTO `detail` VALUES (285, '重庆市黔江区濯水景区', 2, 22);
INSERT INTO `detail` VALUES (286, '重庆市彭水县阿依河景区', 2, 22);
INSERT INTO `detail` VALUES (287, '重庆市云阳龙缸景区', 2, 22);
INSERT INTO `detail` VALUES (288, '江津四面山景区', 2, 22);
INSERT INTO `detail` VALUES (289, '重庆市南川金佛山', 2, 22);
INSERT INTO `detail` VALUES (290, '重庆市万盛经开区黑山谷景区', 2, 22);
INSERT INTO `detail` VALUES (291, '酉阳桃花源旅游景区', 2, 22);
INSERT INTO `detail` VALUES (292, '武隆喀斯特旅游区(天生三桥·仙女山·芙蓉洞)', 2, 22);
INSERT INTO `detail` VALUES (293, '重庆巫山小三峡-小小三峡', 2, 22);
INSERT INTO `detail` VALUES (294, '重庆大足石刻景区', 2, 22);
INSERT INTO `detail` VALUES (295, '四川省成都市安仁古镇景区', 2, 23);
INSERT INTO `detail` VALUES (296, '四川省甘孜州稻城亚丁旅游景区', 2, 23);
INSERT INTO `detail` VALUES (297, '四川省巴中市光雾山旅游景区', 2, 23);
INSERT INTO `detail` VALUES (298, '四川省雅安市碧峰峡旅游景区', 2, 23);
INSERT INTO `detail` VALUES (299, '四川省甘孜州海螺沟景区', 2, 23);
INSERT INTO `detail` VALUES (300, '四川省南充市仪陇朱德故里景区', 2, 23);
INSERT INTO `detail` VALUES (301, '广元市剑门蜀道剑门关旅游区', 2, 23);
INSERT INTO `detail` VALUES (302, '广安市邓小平故里旅游区', 2, 23);
INSERT INTO `detail` VALUES (303, '南充市阆中古城旅游区', 2, 23);
INSERT INTO `detail` VALUES (304, '阿坝州汶川特别旅游区', 2, 23);
INSERT INTO `detail` VALUES (305, '绵阳市北川羌城旅游区', 2, 23);
INSERT INTO `detail` VALUES (306, '四川省阿坝州黄龙景区', 2, 23);
INSERT INTO `detail` VALUES (307, '乐山市乐山大佛景区', 2, 23);
INSERT INTO `detail` VALUES (308, '阿坝藏族羌族自治州九寨沟旅游景区', 2, 23);
INSERT INTO `detail` VALUES (309, '乐山市峨眉山景区', 2, 23);
INSERT INTO `detail` VALUES (310, '成都市青城山--都江堰旅游景区', 2, 23);
INSERT INTO `detail` VALUES (311, '贵州省毕节市织金洞景区', 2, 24);
INSERT INTO `detail` VALUES (312, '贵州省遵义市赤水丹霞旅游区', 2, 24);
INSERT INTO `detail` VALUES (313, '贵州省黔东南州镇远古城旅游景区', 2, 24);
INSERT INTO `detail` VALUES (314, '贵州省铜仁市梵净山旅游区', 2, 24);
INSERT INTO `detail` VALUES (315, '贵州省贵阳市花溪青岩古镇景区', 2, 24);
INSERT INTO `detail` VALUES (316, '黔南州荔波樟江景区', 2, 24);
INSERT INTO `detail` VALUES (317, '毕节市百里杜鹃景区', 2, 24);
INSERT INTO `detail` VALUES (318, '安顺市龙宫景区', 2, 24);
INSERT INTO `detail` VALUES (319, '安顺市黄果树大瀑布景区', 2, 24);
INSERT INTO `detail` VALUES (320, '云南省文山州普者黑旅游景区', 2, 25);
INSERT INTO `detail` VALUES (321, '云南省保山市腾冲火山热海旅游区', 2, 25);
INSERT INTO `detail` VALUES (322, '云南省昆明市昆明世博园景区', 2, 25);
INSERT INTO `detail` VALUES (323, '迪庆州香格里拉普达措景区', 2, 25);
INSERT INTO `detail` VALUES (324, '中国科学院西双版纳热带植物园', 2, 25);
INSERT INTO `detail` VALUES (325, '大理市崇圣寺三塔文化旅游区', 2, 25);
INSERT INTO `detail` VALUES (326, '丽江市丽江古城景区', 2, 25);
INSERT INTO `detail` VALUES (327, '丽江市玉龙雪山景区', 2, 25);
INSERT INTO `detail` VALUES (328, '昆明市石林风景区', 2, 25);
INSERT INTO `detail` VALUES (329, '林芝市雅鲁藏布大峡谷旅游景区', 2, 26);
INSERT INTO `detail` VALUES (330, '日喀则扎什伦布寺景区', 2, 26);
INSERT INTO `detail` VALUES (331, '林芝巴松措景区', 2, 26);
INSERT INTO `detail` VALUES (332, '拉萨市大昭寺', 2, 26);
INSERT INTO `detail` VALUES (333, '拉萨布达拉宫景区', 2, 26);
INSERT INTO `detail` VALUES (334, '黄河壶口瀑布旅游区(陕西省延安市·山西省临汾市)', 2, 27);
INSERT INTO `detail` VALUES (335, '陕西省西安市大明宫旅游景区', 2, 27);
INSERT INTO `detail` VALUES (336, '陕西省延安市延安革命纪念地景区', 2, 27);
INSERT INTO `detail` VALUES (337, '陕西省西安市城墙·碑林历史文化景区', 2, 27);
INSERT INTO `detail` VALUES (338, '陕西省宝鸡市太白山旅游景区', 2, 27);
INSERT INTO `detail` VALUES (339, '商洛市金丝峡景区', 2, 27);
INSERT INTO `detail` VALUES (340, '宝鸡市法门寺佛文化景区', 2, 27);
INSERT INTO `detail` VALUES (341, '陕西渭南华山景区', 2, 27);
INSERT INTO `detail` VALUES (342, '陕西西安大雁塔·大唐芙蓉园景区', 2, 27);
INSERT INTO `detail` VALUES (343, '延安市黄帝陵景区', 2, 27);
INSERT INTO `detail` VALUES (344, '西安市华清池景区', 2, 27);
INSERT INTO `detail` VALUES (345, '西安市秦始皇兵马俑博物馆', 2, 27);
INSERT INTO `detail` VALUES (346, '甘肃省陇南市官鹅沟景区', 2, 28);
INSERT INTO `detail` VALUES (347, '甘肃省临夏州炳灵寺世界文化遗产旅游区', 2, 28);
INSERT INTO `detail` VALUES (348, '甘肃省张掖市七彩丹霞景区', 2, 28);
INSERT INTO `detail` VALUES (349, '敦煌鸣沙山月牙泉景区', 2, 28);
INSERT INTO `detail` VALUES (350, '甘肃天水麦积山景区', 2, 28);
INSERT INTO `detail` VALUES (351, '平凉市崆峒山风景名胜区', 2, 28);
INSERT INTO `detail` VALUES (352, '嘉峪关市嘉峪关文物景区', 2, 28);
INSERT INTO `detail` VALUES (353, '青海省海北州阿咪东索景区', 2, 29);
INSERT INTO `detail` VALUES (354, '青海省海东市互助土族故土园景区', 2, 29);
INSERT INTO `detail` VALUES (355, '西宁市塔尔寺景区', 2, 29);
INSERT INTO `detail` VALUES (356, '青海省青海湖景区', 2, 29);
INSERT INTO `detail` VALUES (357, '银川市灵武水洞沟旅游区', 2, 30);
INSERT INTO `detail` VALUES (358, '宁夏银川镇北堡西部影视城', 2, 30);
INSERT INTO `detail` VALUES (359, '中卫市沙坡头旅游景区', 2, 30);
INSERT INTO `detail` VALUES (360, '石嘴山市沙湖旅游景区', 2, 30);
INSERT INTO `detail` VALUES (361, '新疆维吾尔自治区昌吉回族自治州江布拉克景区', 2, 31);
INSERT INTO `detail` VALUES (362, '新疆生产建设兵团阿拉尔市塔克拉玛干·三五九旅文化旅游区', 2, 31);
INSERT INTO `detail` VALUES (363, '新疆生产建设兵团第十师白沙湖景区', 2, 31);
INSERT INTO `detail` VALUES (364, '新疆维吾尔自治区博尔塔拉蒙古自治州赛里木湖景区', 2, 31);
INSERT INTO `detail` VALUES (365, '新疆维吾尔自治区克拉玛依市世界魔鬼城景区', 2, 31);
INSERT INTO `detail` VALUES (366, '新疆维吾尔自治区喀什地区帕米尔旅游区', 2, 31);
INSERT INTO `detail` VALUES (367, '新疆自治区巴音州和静巴音布鲁克景区', 2, 31);
INSERT INTO `detail` VALUES (368, '新疆自治区伊犁州喀拉峻景区', 2, 31);
INSERT INTO `detail` VALUES (369, '喀什地区喀什噶尔老城景区', 2, 31);
INSERT INTO `detail` VALUES (370, '巴音郭楞蒙古自治州博斯腾湖景区', 2, 31);
INSERT INTO `detail` VALUES (371, '乌鲁木齐天山大峡谷景区', 2, 31);
INSERT INTO `detail` VALUES (372, '喀什地区泽普金湖杨景区', 2, 31);
INSERT INTO `detail` VALUES (373, '阿勒泰地区富蕴可可托海景区', 2, 31);
INSERT INTO `detail` VALUES (374, '新疆伊犁那拉提旅游风景区', 2, 31);
INSERT INTO `detail` VALUES (375, '阿勒泰地区喀纳斯景区', 2, 31);
INSERT INTO `detail` VALUES (376, '吐鲁番市葡萄沟风景区', 2, 31);
INSERT INTO `detail` VALUES (377, '新疆天山天池风景名胜区', 2, 31);

3.开发后端接口

FastAPI快速开发接口
1、安装第三方依赖
pip install fastapi
pip install uvicorn
2、提供解决跨域问题
3、进行了分组查询,利用了临时表
提供了两种方式访问主页
~http://127.0.0.1:8000/index 服务器已经启动,且index.html在项目同目录下
~其他开发工具打开index页面 服务器已经启动

# -*- encoding:utf-8 -*-
__author__ = "Nick"
__created_date__ = "2022/12/10"

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
import pymysql
from fastapi.responses import JSONResponse
from fastapi.responses import HTMLResponse
app = FastAPI()

# 解决跨域
origins = [
    "http://localhost",
    "http://127.0.0.1:8848",
]

app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)



def connect_db():
    # 连接数据库
    connect = pymysql.connect(
        host="localhost",
        port=3306,
        user='root',
        password='rootroot',
        database='test1'
    )
    return connect

# 查询创建临时表
def create_tmp(category_id):
    tmp_sql = f""" CREATE TABLE tmp as (select * from detail where category_name_id ={category_id});
"""
    return tmp_sql


# 根据分类进行查询
def main(category_id):
    try:
        # 查询数据库
        connect = connect_db()
        # 创建游标
        cursor = connect.cursor()
        # 删除表
        cursor.execute("DROP TABLE IF EXISTS tmp;")
        # 查询创建临时表sql
        sql = create_tmp(category_id=category_id)
        cursor.execute(sql)
        # 执行查询语句
        cursor.execute("select count(province_name_id) from tmp GROUP BY province_name_id ORDER BY id ")
        result_list = []
        result = cursor.fetchall()
        for i in result:
            result_list.append(i[0])
        print(result_list)
        # 提交事务
        connect.commit()
        # 关闭连接
        connect.close()
    except Exception as e:
        print(e)

    return result_list


@app.get("/index",response_class=HTMLResponse)
def show():
    html_file = open("index.html", 'r', encoding="utf-8", errors="ignore").read()
    return html_file
  
@app.get("/index/1")
def index():
    # 定义接口返回的数据
    name_list = ['国家级旅游休闲街区', '国家5A级旅游景区']
    series_list = []

    for index in range(len(name_list)):
        series_dict = {
            "type": "bar"
        }
        series_dict["name"] = name_list[index]
        data_list = main(category_id=index+1)
        series_dict["data"] = data_list
        series_list.append(series_dict)
    result = {
        "status": True,
        "data":{
        "series_list": series_list,
    }
    }

    return JSONResponse(result)

if __name__ == '__main__':
    uvicorn.run(app)

4.使用Echarts官方模板

https://echarts.apache.org/examples/zh/index.html
这里就使用二维柱状图进行数据可视化
数据是写在前端的,可以直接渲染数据。

<!--
	此示例下载自 https://echarts.apache.org/examples/zh/editor.html?c=bar-y-category
-->
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
  <meta charset="utf-8">
  <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts@5.4.0/dist/echarts.min.js"></script>
</head>
<body style="height: 100%; margin: 0">
  <div id="container" style="height: 100%"></div>

  


  <script type="text/javascript">
    var dom = document.getElementById('container');
    var myChart = echarts.init(dom, null, {
      renderer: 'canvas',
      useDirtyRect: false
    });
    var app = {};
    
    var option;

    option = {
  title: {
    text: '中国文化旅游可视化'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {},
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: {
    type: 'value',
    boundaryGap: [0, 0.01]
  },
  yAxis: {
    type: 'category',
    data: ['北京', '天津', '河北', '山西', '内蒙古', '辽宁', '吉林', '黑龙江', '上海', '江苏', '浙江', '安徽', '福建', '江西', '山东', '河南', '湖北', '湖南', '广东', '广西', '海南', '重庆', '四川', '贵州', '云南', '西藏', '陕西', '甘肃', '青海', '宁夏', '新疆']
  },
  series: [
    {
      name: '国家级旅游休闲街区',
      type: 'bar',
      data: ['2', '1', '2', '1', '1', '1', '1', '1', '2', '3', '3', '2', '3', '1', '2', '2', '1', '2', '2', '2', '1', '3', '3', '1', '2', '2', '1', '1', '1', '1', '3']
    },
    {
      name: '国家5A级旅游景区',
      type: 'bar',
      data: ['8', '2', '11', '10', '6', '6', '7', '6', '4', '25', '20', '12', '10', '14', '14', '15', '14', '11', '15', '9', '6', '11', '16', '9', '9', '5', '12', '7', '4', '4', '17']
    }
  ]
};

    if (option && typeof option === 'object') {
      myChart.setOption(option);
    }

    window.addEventListener('resize', myChart.resize);
  </script>
</body>
</html>

编写Ajax,通过接口传输

<!--
	此示例下载自 https://echarts.apache.org/examples/zh/editor.html?c=bar-y-category
-->
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
  <meta charset="utf-8">
  <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts@5.4.0/dist/echarts.min.js"></script>
</head>
<body style="height: 100%; margin: 0">
  <div id="container" style="height: 100%"></div>

  


  <script type="text/javascript">
    var dom = document.getElementById('container');
    var myChart = echarts.init(dom, null, {
      renderer: 'canvas',
      useDirtyRect: false
    });
    var app = {};
    
    var option;

    option = {
  title: {
    text: '中国文化旅游可视化'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {},
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: {
    type: 'value',
    boundaryGap: [0, 0.01]
  },
  yAxis: {
    type: 'category',
    data: ['北京', '天津', '河北', '山西', '内蒙古', '辽宁', '吉林', '黑龙江', '上海', '江苏', '浙江', '安徽', '福建', '江西', '山东', '河南', '湖北', '湖南', '广东', '广西', '海南', '重庆', '四川', '贵州', '云南', '西藏', '陕西', '甘肃', '青海', '宁夏', '新疆']
  },
  series: [

  ]
};

    if (option && typeof option === 'object') {
      myChart.setOption(option);
    }

    window.addEventListener('resize', myChart.resize);
	$.ajax({
		url: "http://127.0.0.1:8000/index/1",
		type: "get",
		dataType: "json",
		success:function(res){
			
			if (res.status){
				// 数据	
				option.series = res.data.series_list;
				console.log(option.series);
				//使用刚指定的配置项和数据显示图表。
				if (option && typeof option === 'object') {
				  myChart.setOption(option);
				}
							 
				window.addEventListener('resize', myChart.resize);
				}
							},
							});
  </script>
</body>
</html>

三、效果展示

请添加图片描述

源码下载方式1:
https://gitee.com/nickwang666/travel
源码下载方式2:
知识星球Python web开发模块
我正在「Print(“Hello Python”)」和朋友们讨论有趣的话题,你⼀起来吧?
https://t.zsxq.com/086uG3kOn

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值