pull/632/head
Mr Chen 6 months ago
parent 97b23b7148
commit af29e865e8
  1. 20
      web/admin/setup/sql/default.sql
  2. 14
      web/static/app/config.js
  3. 6
      web/thisdb/__init__.py
  4. 60
      web/thisdb/app.py

@ -99,8 +99,8 @@ CREATE TABLE IF NOT EXISTS `users` (
`login_time` TEXT, `login_time` TEXT,
`phone` TEXT, `phone` TEXT,
`email` TEXT, `email` TEXT,
`add_time` INTEGER, `add_time` TEXT,
`update_time` INTEGER `update_time` TEXT
); );
CREATE TABLE IF NOT EXISTS `tasks` ( CREATE TABLE IF NOT EXISTS `tasks` (
@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS `tasks` (
`end` INTEGER, `end` INTEGER,
`cmd` TEXT, `cmd` TEXT,
`status` INTEGER, `status` INTEGER,
`add_time` INTEGER `add_time` TEXT
); );
CREATE TABLE IF NOT EXISTS `temp_login` ( CREATE TABLE IF NOT EXISTS `temp_login` (
@ -123,7 +123,7 @@ CREATE TABLE IF NOT EXISTS `temp_login` (
`login_addr` REAL, `login_addr` REAL,
`logout_time` INTEGER, `logout_time` INTEGER,
`expire` INTEGER, `expire` INTEGER,
`add_time` INTEGER `add_time` TEXT
); );
CREATE TABLE IF NOT EXISTS `panel` ( CREATE TABLE IF NOT EXISTS `panel` (
@ -133,7 +133,17 @@ CREATE TABLE IF NOT EXISTS `panel` (
`username` TEXT, `username` TEXT,
`password` TEXT, `password` TEXT,
`click` INTEGER, `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` ( CREATE TABLE IF NOT EXISTS `option` (

@ -268,13 +268,13 @@ function modifyAuthPath() {
btn:['提交','关闭', '随机生成'], btn:['提交','关闭', '随机生成'],
shadeClose: false, shadeClose: false,
content: '<div class="bt-form bt-form pd20">\ content: '<div class="bt-form bt-form pd20">\
<div class="line ">\ <div class="line ">\
<span class="tname">入口地址</span>\ <span class="tname">入口地址</span>\
<div class="info-r">\ <div class="info-r">\
<input name="auth_path_set" class="bt-input-text mr5" type="text" style="width: 311px" value="' + auth_path + '">\ <input name="auth_path_set" class="bt-input-text mr5" type="text" style="width: 311px" value="' + auth_path + '">\
</div>\ </div>\
</div>\ </div>\
</div>', </div>',
yes:function(index){ yes:function(index){
var auth_path = $("input[name='auth_path_set']").val(); var auth_path = $("input[name='auth_path_set']").val();
if (auth_path == '/' || auth_path == ''){ if (auth_path == '/' || auth_path == ''){

@ -10,9 +10,9 @@
from .init import * from .init import *
from .option import * from .option import *
from .user import *
from .sites import * from .sites import *
from .site_types import *
from .domain import * from .domain import *
from .binding import * from .binding import *
@ -20,5 +20,7 @@ from .tasks import *
from .logs import * from .logs import *
from .crontab import * from .crontab import *
from .firewall import * from .firewall import *
from .temp_login import * from .temp_login import *
from .site_types import * from .user import *
from .app import *

@ -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)
Loading…
Cancel
Save