# -*- coding: utf-8 -*- from action.RobotBrowser import * from manager.ConfigManager import * config = ConfigManager() all_tasks = config.get_all_tasks() robot = RobotBrowser() def check_is_login(): robot.openUrl(robot.aliexpress_index, "top-lighthouse") robot.set_cookies() robot.openUrl(robot.aliexpress_index, "top-lighthouse") if robot.checkIsLogin(): return True else: return False if __name__ == '__main__': try: username=r"" passwd=r"" while not check_is_login(): robot.sign_in(username,passwd) for task in all_tasks: log_info("start to create discount: "+task.name) robot.createStoreDiscount(task) log_info("create discount: " + task.name+" success.") except Exception, e:
# -*- coding: utf-8 -*- from manager.ConfigManager import * from action.TaskAction import * from manager.TimeManager import * def run_work(all_tasks): for task in all_tasks: task_action = TaskAction(task) task_action.start_action_work() if __name__ == '__main__': config_manager = ConfigManager() all_tasks = config_manager.get_all_tasks() run_work(all_tasks) log_info("#####################") log_info("all tasks run finish.") log_info("#####################") while True: waitSeconds(3000)