This commit is contained in:
Mr Chen
2024-11-10 22:43:08 +08:00
parent 97b23b7148
commit af29e865e8
4 changed files with 86 additions and 14 deletions
+4 -2
View File
@@ -10,9 +10,9 @@
from .init import *
from .option import *
from .user import *
from .sites import *
from .site_types import *
from .domain import *
from .binding import *
@@ -20,5 +20,7 @@ from .tasks import *
from .logs import *
from .crontab import *
from .firewall import *
from .temp_login import *
from .site_types import *
from .user import *
from .app import *
+60
View File
@@ -0,0 +1,60 @@
# coding:utf-8
# ---------------------------------------------------------------------------------
# MW-Linux面板
# ---------------------------------------------------------------------------------
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
# ---------------------------------------------------------------------------------
# Author: midoks <midoks@163.com>
# ---------------------------------------------------------------------------------
import core.mw as mw
__FIELD = 'id,app_id,app_secret,status,add_time,update_time'
def addApp(app_id,app_secret):
now_time = mw.getDateFromNow()
add_data = {
'app_id': app_id,
'app_secret': app_secret,
'status': 1,
'add_time': now_time,
'update_time': now_time
}
return mw.M('app').insert(add_data)
def getAppList(
page:int | None = 1,
size:int | None = 10,
):
m = mw.M('app').field(__FIELD)
start = (int(page) - 1) * (int(size))
limit = str(start) + ',' +str(size)
app_list = m.limit(limit).order('id desc').select()
count = m.count()
data = {}
data['list'] = app_list
data['count'] = count
return data
def getAppById(aid):
return mw.M('app').field(__FIELD).where("id=?", (aid,)).find()
def deleteAppById(aid):
return mw.M('app').where("id=?", (aid,)).delete()
def setAppData(aid,
status: str | None = None,
app_id: str | None = None,
app_secret: str | None = None,
):
up_data = {}
if status is not None:
up_data['status'] = status
if app_id is not None:
up_data['app_id'] = app_id
if app_secret is not None:
up_data['app_secret'] = app_secret
return mw.M('app').where('id=?',(aid,)).update(up_data)