# -*- coding: utf-8 -*-
import pandas as pd
import datetime
from config import Config
from api import API
import pymysql  # 使用 pymysql 替代 mysql.connector
from back_ground_module import CommonModule
from tqdm import tqdm

start_time = datetime.datetime.now()
api_instance = API()
common_module = CommonModule()


payload = {
    "api_key": Config.SaaS_Tasks_APP_ID,
    "entry_id": "675b9c63925cd404038a6b86",
}
saas_data = api_instance.entry_data_list(payload)
saas_data_list = saas_data.get("data")

for item in tqdm(saas_data_list):
    store_type = item.get("_widget_1744596110482")
    data_id = item.get("_id")
    new_payload ={
        "api_key": Config.SaaS_Tasks_APP_ID,
        "entry_id": "675bb02bd2d53c2034c665e4",
        "data_id": data_id,
        "data":{
            "_widget_1752027386523":{"value":store_type},
        }
    }
    api_instance.entry_data_update(new_payload)
