定时任务(部分)

This commit is contained in:
mkg
2021-08-26 15:31:36 +08:00
parent 3c1764e58d
commit 48eebc1c95
3 changed files with 141 additions and 97 deletions
+1 -37
View File
@@ -1,42 +1,6 @@
import datetime
from flask import current_app
from applications.extensions import db
from applications.extensions.init_apscheduler import scheduler
from applications.models import Dept
# @scheduler.task(
# "interval",
# id="job_sync",
# seconds=10,
# max_instances=1,
# start_date="2000-01-01 12:19:00",
# )
# def task1():
# # oh, do you need something from config?
# with scheduler.app.app_context():
# print(scheduler.app.config) # noqa: T001
# address = "ces"
# deptName = "测试"
# email = "123@qq.com"
# leader = "测试的"
# parentId = "1"
# phone = "123456"
# sort = "5"
# status = 1
# dept = Dept(
# parent_id=parentId,
# dept_name=deptName,
# sort=sort,
# leader=leader,
# phone=phone,
# email=email,
# status=status,
# address=address
# )
# r = db.session.add(dept)
# db.session.commit()
task_list = ['task2', 'task3', 'task4']
def task2(a, b):