diff --git a/web/admin/setup/sql/default.sql b/web/admin/setup/sql/default.sql index 794ede180..074484838 100755 --- a/web/admin/setup/sql/default.sql +++ b/web/admin/setup/sql/default.sql @@ -99,8 +99,8 @@ CREATE TABLE IF NOT EXISTS `users` ( `login_time` TEXT, `phone` TEXT, `email` TEXT, - `add_time` INTEGER, - `update_time` INTEGER + `add_time` TEXT, + `update_time` TEXT ); CREATE TABLE IF NOT EXISTS `tasks` ( @@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS `tasks` ( `end` INTEGER, `cmd` TEXT, `status` INTEGER, - `add_time` INTEGER + `add_time` TEXT ); CREATE TABLE IF NOT EXISTS `temp_login` ( @@ -123,7 +123,7 @@ CREATE TABLE IF NOT EXISTS `temp_login` ( `login_addr` REAL, `logout_time` INTEGER, `expire` INTEGER, - `add_time` INTEGER + `add_time` TEXT ); CREATE TABLE IF NOT EXISTS `panel` ( @@ -133,7 +133,17 @@ CREATE TABLE IF NOT EXISTS `panel` ( `username` TEXT, `password` TEXT, `click` INTEGER, - `add_time` INTEGER + `add_time` TEXT +); + +CREATE TABLE IF NOT EXISTS `app` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT, + `app_id` TEXT, + `app_secret` TEXT, + `white_list` TEXT, + `status` INTEGER, + `add_time` TEXT, + `update_time` TEXT ); CREATE TABLE IF NOT EXISTS `option` ( diff --git a/web/static/app/config.js b/web/static/app/config.js index ac64e1822..30850558e 100755 --- a/web/static/app/config.js +++ b/web/static/app/config.js @@ -268,13 +268,13 @@ function modifyAuthPath() { btn:['提交','关闭', '随机生成'], shadeClose: false, content: '
\ -
\ - 入口地址\ -
\ - \ -
\ -
\ -
', +
\ + 入口地址\ +
\ + \ +
\ +
\ + ', yes:function(index){ var auth_path = $("input[name='auth_path_set']").val(); if (auth_path == '/' || auth_path == ''){ diff --git a/web/thisdb/__init__.py b/web/thisdb/__init__.py index 31924c2de..33f664b8b 100644 --- a/web/thisdb/__init__.py +++ b/web/thisdb/__init__.py @@ -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 * diff --git a/web/thisdb/app.py b/web/thisdb/app.py new file mode 100644 index 000000000..8f34d7ed3 --- /dev/null +++ b/web/thisdb/app.py @@ -0,0 +1,60 @@ +# coding:utf-8 + +# --------------------------------------------------------------------------------- +# MW-Linux面板 +# --------------------------------------------------------------------------------- +# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved. +# --------------------------------------------------------------------------------- +# Author: midoks +# --------------------------------------------------------------------------------- + +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)