mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
6 months ago
|
# coding:utf-8
|
||
|
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
# MW-Linux面板
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
# Author: midoks <midoks@163.com>
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
|
||
|
import os
|
||
|
|
||
|
import core.mw as mw
|
||
|
|
||
|
__field = 'id,name,type,where1,where_hour,where_minute,echo,status,save,backup_to,stype,sname,sbody,url_address,add_time,update_time'
|
||
|
|
||
|
def addCrontab(data):
|
||
|
now_time = mw.formatDate()
|
||
|
data['add_time'] = now_time
|
||
|
data['update_time'] = now_time
|
||
|
return mw.M('crontab').insert(data)
|
||
|
|
||
|
def getCrond(id):
|
||
|
return mw.M('crontab').where('id=?', (id,)).field(__field).find()
|
||
|
|
||
|
def deleteCronById(id):
|
||
|
mw.M('crontab').where("id=?", (id,)).delete()
|
||
|
return True
|
||
|
|
||
|
def getCrontabList(
|
||
|
page:int | None = 1,
|
||
|
size:int | None = 10,
|
||
|
):
|
||
|
start = (int(page) - 1) * size
|
||
|
limit = str(start) + ',' + str(size)
|
||
|
|
||
|
cron_list = mw.M('crontab').field(__field).limit(limit).order('id desc').select()
|
||
|
count = mw.M('crontab').count()
|
||
|
|
||
|
data = {}
|
||
|
data['count'] = count
|
||
|
data['list'] = cron_list
|
||
|
return data
|