Simple Linux Panel
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.
mdserver-web/web/thisdb/domain.py

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 core.mw as mw
__FIELD = 'id,pid,name,port,add_time'
6 months ago
def getDomainCountByName(name):
# .debug(True)
return mw.M('domain').where("name=?", (name,)).count()
6 months ago
def getDomainCountBySiteId(site_id):
# .debug(True)
return mw.M('domain').where("pid=?", (site_id,)).count()
5 months ago
def addDomain(site_id, name, port):
6 months ago
now_time = mw.getDateFromNow()
insert_data = {
5 months ago
'pid': site_id,
6 months ago
'name': name,
'port':port,
'add_time': now_time,
}
return mw.M('domain').insert(insert_data)
5 months ago
def getDomainBySiteId(site_id):
6 months ago
# .debug(True)
5 months ago
return mw.M('domain').field(__FIELD).where("pid=?", (site_id,)).select()
6 months ago
6 months ago
def deleteDomainId(domain_id):
return mw.M('domain').where("id=?", (domain_id,)).delete()
def deleteDomainBySiteId(site_id):
return mw.M('domain').where("pid=?", (site_id,)).delete()