Esempio n. 1
0
def unescokind():
    json_data = request.get_json()
    operation = operationmysql()
    sql = 'select UNESCOname from UNESCOkind where UNESOkind = %s'
    values = (json_data["kind"], )
    data = operation.search(sql=sql, values=values)
    data = {"code": 4, "data": data}
    return jsonify(data)
Esempio n. 2
0
def search():
    json_data = request.get_json()
    opration = operationmysql()
    sql = 'select UNESCOname, detail, img_src from UNESCOlist where UNESCOname = %s'
    values = (json_data["UNESCOname"], )
    result = opration.search(sql=sql, values=values)
    data = {"code": 2, "data": result}
    return jsonify(data)
Esempio n. 3
0
def list():
    sql = 'select name,time, img_src,sdetail from UNESCOnews where year = 2020;'
    opration = operationmysql()
    result = opration.search(sql=sql)
    data = {
        "code": 1,
        "data": result
    }
    return jsonify(data)
Esempio n. 4
0
def datail():
    json_data = request.form.to_dict()
    result = []
    if json_data != {}:
        operation = operationmysql()
        sql = 'select UNESCOname, detail, img_src, utime,country_name from UNESCOlist,countrylist where UNESCOname = %s and UNESCOlist.country_number = countrylist.country_number'
        values = (json_data["name"], )
        result = operation.search(sql=sql, values=values)
    data = {"data": result}
    return jsonify(data)
Esempio n. 5
0
def search():
    json_data = request.get_json()
    operation = operationmysql()
    sql = 'select name,detail,img,aera from UNESCOpreminary where name = %s'
    values = (json_data['name'],)
    result = operation.search(sql=sql, values=values)
    data = {
        "code": 3,
        "data": result
    }
    return jsonify(data)
Esempio n. 6
0
def detail():
    json_data = request.form.to_dict()
    sql = 'select name,time, Detail,dsrc,year from UNESCOnews where name = %s'
    operation = operationmysql()
    values = (json_data["name"],)
    result = operation.search(sql=sql, values=values)
    data = {
        "code": 3,
        "data": result
    }
    return jsonify(data)
Esempio n. 7
0
def year():
    json_data = request.get_json()
    sql = 'select name,time, img_src,sdetail from UNESCOnews where year = %s'
    opration = operationmysql()
    values = (json_data['year'],)
    result = opration.search(sql=sql, values=values)
    data = {
        "code": 2,
        "data": result
    }
    return jsonify(data)
Esempio n. 8
0
def contrylist():
    json_data = request.form.to_dict()
    result = []
    if json_data != None:
        operation = operationmysql()
        sql = 'select UNESCOnumber,UNESCOname, country_name,utime from UNESCOlist, countrylist where UNESCOlist.country_number = countrylist.country_number and countrylist.country_name= %s;'
        values = (json_data["countryname"], )
        result = operation.search(sql=sql, values=values)
        print(result)
    data = {"code": 3, "data": result}
    return jsonify(data)
Esempio n. 9
0
def landing():
    json_data = request.get_json()
    opration = operationmysql()
    sql = 'select pwd from user where username = %s'
    values = (json_data["username"], )
    result = opration.search(sql=sql, values=values)
    data = {
        "code": 0,
    }
    if result != None:
        if result[0]["pwd"] == json_data['pwd']:
            data["code"] = 1
    return jsonify(data)
Esempio n. 10
0
def get_UNESCO_list():
    json_data = request.form.to_dict()
    print(json_data)
    opration = operationmysql()
    if json_data["countryname"] != 'undefined':
        sql = 'select UNESCOnumber,UNESCOname, country_name,utime from UNESCOlist, countrylist where UNESCOlist.country_number = countrylist.country_number and countrylist.country_name= %s;'
        values = (json_data["countryname"], )
        result = opration.search(sql=sql, values=values)
    else:
        sql = 'select UNESCOnumber,UNESCOname, country_name,utime from UNESCOlist, countrylist where UNESCOlist.country_number = countrylist.country_number;'
        result = opration.search(sql=sql)
    data = {"code": 1, "data": result}
    return jsonify(data)
Esempio n. 11
0
def List():
    operation = operationmysql()
    sql = 'select kind, name, time, province from successUNESCO'
    result = operation.search(sql=sql)
    List = []
    for j in result:
        i = list(j)
        if i[0] == 1:
            i[0] = '文化遗产'
        elif i[0] == 2:
            i[0] = '文化景观遗产'
        elif i[0] == 3:
            i[0] = '自然遗产'
        elif i[0] == 4:
            i[0] = '文化与自然双重遗产'
        List.append(i)
    data = {
        "code": 1,
        "data": List
    }
    return jsonify(data)
Esempio n. 12
0
def pre_list():
    operation = operationmysql()
    sql = 'select number, kind, name, aera from UNESCOpreminary'
    result = operation.search(sql=sql)
    List = []
    for i in result:
        if i['kind'] == 1:
            i['kind'] = '中国世界遗产预备名录确定申请世界遗产项目'
        elif i['kind'] == 2:
            i['kind'] = '中国文化遗产预备名录'
        elif i['kind'] == 3:
            i['kind'] = '中国文化景观遗产预备名录'
        elif i['kind'] == 4:
            i['kind'] = '中国自然遗产预备名录'
        elif i['kind'] == 5:
            i['kind'] = '中国文化与自然双重遗产预备名录'
        List.append(i)
    data = {
        "code": 2,
        "data": List
    }
    return jsonify(data)