Ejemplo n.º 1
0
def scenic_update():
    print("更新表数据")
    for i in range(len(scenic_name_Array)):
        param = str(natapp_url + scenic_url + scenic_name_Array[i])

        sql = 'update t_scenic set scenic_img ="{0}"'.format(param)

        dbcursor.execute(sql)

        conn.commit()

        print(param)
Ejemplo n.º 2
0
def shopping_insert(goods_img_id,goods_text2_title,goods_text4_price,index):
    print("插入购物车数据")

    sql = "insert into t_shopping_car (shopping_car_img,shopping_car_title," \
          "         shopping_car_price,shopping_car_count,shopping_car_index) values(%s,%s,%s,%s,%s)"

    param = (goods_img_id,goods_text2_title,goods_text4_price,1,index)

    dbcursor.execute(sql,param)

    print(param)

    conn.commit()
Ejemplo n.º 3
0
def advertise_insert():
    print("插入广告位数据")

    for i in range(len(adv_img_Array)):
        print(i)

        sql = 'insert into t_advertise (adv_img,adv_name,adv_price) values(%s,%s,%s)'

        param = (natapp_url + advertise_url + adv_img_Array[i],
                 adv_name_Array[i], adv_price_Array[i])

        dbcursor.execute(sql, param)

    conn.commit()
Ejemplo n.º 4
0
def videos_insert():
    print("向商品表插入数据")
    for i in range(len(videos_address_Array)):
        print(i)

        # 定义sql语句
        sql = 'INSERT INTO t_videos ' \
              '(videos_title,videos_price,videos_address)VALUE(%s,%s,%s)'

        # 定义参数
        param = (videos_title_Array[i], videos_price_Array[i],
                 server_url + videos_address_Array[i])

        # 执行sql
        dbcursor.execute(sql, param)

        # 提交
    conn.commit()
Ejemplo n.º 5
0
def news_three_insert():
    print("向新闻模板3表插入数据")

    for i in range(len(news_three_title_Array)):
        print(i)

        #     定义sql语句
        sql = 'INSERT INTO t_news_three ' \
              '(news_three_title,news_three_img,news_three_source)VALUE(%s,%s,%s)'

        # 组装参数
        param = (natapp_url + scenic_url + news_three_title_Array[i],
                 news_three_img_Array[i], news_three_source_Array[i])

        # 执行sql语句
        dbcursor.execute(sql, param)

    # 提交sql
    conn.commit()
Ejemplo n.º 6
0
def goods_insert():
    print("向商品表插入数据")
    for i in range(len(goods_img_Array)):
        print(i)

        # 定义sql语句
        sql = 'INSERT INTO t_goods ' \
              '(goods_img,goods_cart_img,goods_address,goods_name,goods_price,goods_introduce)VALUE(%s,%s,%s,%s,%s,%s)'

        # 定义参数
        param = (natapp_url + goods_url + goods_img_Array[i],
                 natapp_url + goods_url + goods_cart_img_Array[i],
                 goods_address_Array[i], goods_name_Array[i],
                 goods_price_Array[i], goods_introduce_Array[i])

        # 执行sql
        dbcursor.execute(sql, param)

        # 提交
    conn.commit()


# goods_insert()
Ejemplo n.º 7
0
    # print(i)

    #     定义sql语句
    sql = 'INSERT INTO t_scenic ' \
          '(scenic_img,scenic_title,scenic_startdata,scenic_boarder,scenic_price)VALUE(%s,%s,%s,%s,%s)'

    # 组装参数
    param = (natapp_url + scenic_url + scenic_name_Array[i],
             scenic_title_Array[i], scenic_startdata_Array[i],
             scenic_boarder_Array[i], scenic_price_Array[i])

    # 执行sql语句
    dbcursor.execute(sql, param)

# 提交sql
conn.commit()


# 景点表查询全部数据
def scenic_selectall():
    print("查询景点全部数据")
    sql = 'select * from t_scenic'

    #执行sql
    dbcursor.execute(sql)

    #获取数据
    scenic_data = dbcursor.fetchall()

    print(scenic_data)