mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user