python生成模拟数据,亚马逊

user = "user001"

def make_dp_test_data():
    arr = webhook.get_arr_by_sql("select * from table_id where link_state='yes' limit 100 ", table_id_dp)
    for x in arr:
        x["id"] = webhook.get_uuid()
        x["yunying"] = "运营01"
        x["asin"] = "B0" + str(webhook.get_uuid()[0:8]).upper()
        x["parent_asin"] = "B0" + str(webhook.get_uuid()[0:8]).upper()
        x["lianjie"] = "https://www.amazon.com/dp/" + str(x["asin"])
        x["di_comment_link"] = "https://www.amazon.com/gp/customer-reviews/R4" + str(webhook.get_uuid()[0:10]).upper()
        x["create_by"] = user
        x["update_by"] = user
        print(x)
    webhook.post_data_to_db(arr, table_id_dp)
    print("done")

def make_dp_video():
    arr = webhook.get_arr_by_sql("select * from table_id where state='ok' limit 30 ", "c1e08a6730d34971bb4c9f2381c7eb46")
    for x in arr:
        x["id"] = webhook.get_uuid()
        x["asin"] = "B0" + str(webhook.get_uuid()[0:8]).upper()
        x["yunying"] = "运营01"
        x["zhuwenjianjia"] = "qiuxl"
        x["video_name"] = "video_name" + str(webhook.get_uuid())
        x["video_url"] = "https://m.media-amazon.com/images/S/vse-vms-transcoding-artifact-us-east-1-prod/" + str(webhook.get_uuid()) + "/videopreview.jobtemplate.mp4.default.mp4"
        x["check_time"] = webhook.get_time_calc_use_seconds(webhook.get_random_int(-92000, -10))
        x["check_status"] = "ok"
        x["create_by"] = user
        x["update_by"] = user
        print(x)
    webhook.post_data_to_db(arr, "c1e08a6730d34971bb4c9f2381c7eb46")
    print("done")

def make_msg():
    arr = webhook.get_arr_by_sql("select * from table_id where zhuangtai='yes'", "c69822a8685245c58aecf8270c64e71e")
    for x in arr:
        x["id"] = webhook.get_uuid()
        x["dianpu"] = "产品" + str(webhook.get_random_int(1, 10000))
        x["dianpulianjie"] = "https://www.amazon.com/sp?seller=" + str(webhook.get_uuid()[0:14]).upper()
        x["create_by"] = user
        x["update_by"] = user
        print(x)
    webhook.post_data_to_db(arr, "c69822a8685245c58aecf8270c64e71e")
    print("done")

def generate_qa(num=100):
    arr = ["Does it work on rough surfaces like concrete?",
           "Are replacement brush heads readily available?",
           "Is extension handle removable for hard to reach areas?",
           "Are batteries included or do they need separate purchase?",
           "Is it suitable for cleaning cars or just bathrooms?"]
    return arr[webhook.get_random_int(0, len(arr) - 1)]

def make_qa():
    arr = webhook.get_arr_by_sql("select * from table_id where state='yes' ", "1ea981f3879b41cbabfabe297f0f98d5")
    for x in arr:
        x["id"] = webhook.get_uuid()
        x["asin"] = "B0" + str(webhook.get_uuid()[0:8]).upper()
        x["operation"] = "运营01"
        x["problem_text"] = str(generate_qa(1))
        x["create_by"] = user
        x["update_by"] = user
        print(x)
    webhook.post_data_to_db(arr, "1ea981f3879b41cbabfabe297f0f98d5")
    print("done")

  

 

done

 

posted @ 2025-04-21 11:52  liskov_design  阅读(19)  评论(0)    收藏  举报