import datetime
from db_helper import RedisHelper
from my_config import set_config
from log import Log

config_, _ = set_config()
log_ = Log()


def update_ad_roi_param(param):
    redis_helper = RedisHelper()
    redis_helper.set_data_to_redis(key_name=config_.KEY_NAME_AD_ROI_PARAM, value=param)
    redis_helper.persist_key(key_name=config_.KEY_NAME_AD_ROI_PARAM)


if __name__ == '__main__':
    now_date = datetime.datetime.today()
    log_.info(f"now_date: {datetime.datetime.strftime(now_date, '%Y%m%d %H:%M:%S')}")
    param = 1.859871151 * 700
    log_.info(f"param = {param}")
    update_ad_roi_param(param=param)
    log_.info(f"ad roi param update finished!")
