|
|
@ -8,7 +8,7 @@ from website import consts
|
|
|
|
from website import db_mysql
|
|
|
|
from website import db_mysql
|
|
|
|
from website import errors
|
|
|
|
from website import errors
|
|
|
|
from website import settings
|
|
|
|
from website import settings
|
|
|
|
from website.handler import APIHandler, authenticated
|
|
|
|
from website.handler import APIHandler, authenticated, operation_log
|
|
|
|
from website.util import md5, shortuuid
|
|
|
|
from website.util import md5, shortuuid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -19,6 +19,7 @@ class ClassificationAddHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_add_str, "添加模型分类", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
|
if not name:
|
|
|
|
if not name:
|
|
|
@ -53,6 +54,7 @@ class ClassificationEditHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_edit_str, "编辑模型分类", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
classification_id = self.get_int_argument("id")
|
|
|
|
classification_id = self.get_int_argument("id")
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
@ -75,6 +77,7 @@ class ClassificationListHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_list_str, "查询模型分类", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
cur = conn.execute(text("""select id, name from model_classification"""))
|
|
|
|
cur = conn.execute(text("""select id, name from model_classification"""))
|
|
|
@ -89,6 +92,7 @@ class ClassificationDeleteHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_delete_str, "删除模型分类", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
classification_id = self.get_int_argument("id")
|
|
|
|
classification_id = self.get_int_argument("id")
|
|
|
|
if not classification_id:
|
|
|
|
if not classification_id:
|
|
|
@ -110,6 +114,7 @@ class ListHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_list_str, "查询模型列表", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
pageNo = self.get_int_argument("pageNo", 1)
|
|
|
|
pageNo = self.get_int_argument("pageNo", 1)
|
|
|
|
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
|
|
|
|
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
|
|
|
@ -124,7 +129,7 @@ class ListHandler(APIHandler):
|
|
|
|
|
|
|
|
|
|
|
|
param = {}
|
|
|
|
param = {}
|
|
|
|
|
|
|
|
|
|
|
|
sql_count = "select count(id) from model where del=0 "
|
|
|
|
sql_count = "select count(id) from model m where m.del=0 "
|
|
|
|
param_count = {}
|
|
|
|
param_count = {}
|
|
|
|
|
|
|
|
|
|
|
|
if name:
|
|
|
|
if name:
|
|
|
@ -161,6 +166,7 @@ class ListHandler(APIHandler):
|
|
|
|
|
|
|
|
|
|
|
|
class ListSimpleHandler(APIHandler):
|
|
|
|
class ListSimpleHandler(APIHandler):
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_list_str, "查询模型列表", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
sql = "select id, name from model where del=0"
|
|
|
|
sql = "select id, name from model where del=0"
|
|
|
@ -176,6 +182,7 @@ class AddHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "添加模型", consts.op_type_add_str, "添加模型", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
|
model_type = self.get_int_argument(
|
|
|
|
model_type = self.get_int_argument(
|
|
|
@ -218,6 +225,7 @@ class EditHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "编辑模型", consts.op_type_edit_str, "编辑模型", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
mid = self.get_int_argument("id")
|
|
|
|
mid = self.get_int_argument("id")
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
@ -258,6 +266,7 @@ class InfoHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型信息", consts.op_type_list_str, "查询模型信息", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
mid = self.get_int_argument("id")
|
|
|
|
mid = self.get_int_argument("id")
|
|
|
|
if not mid:
|
|
|
|
if not mid:
|
|
|
@ -300,6 +309,7 @@ class DeleteHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_delete_str, "删除模型", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
mid = self.get_int_argument("id")
|
|
|
|
mid = self.get_int_argument("id")
|
|
|
|
if not mid:
|
|
|
|
if not mid:
|
|
|
@ -329,6 +339,7 @@ class VersionAddHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型版本", consts.op_type_add_str, "添加模型版本", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
mid = self.get_int_argument("model_id")
|
|
|
|
mid = self.get_int_argument("model_id")
|
|
|
|
version = self.get_escaped_argument("version", "")
|
|
|
|
version = self.get_escaped_argument("version", "")
|
|
|
@ -382,6 +393,7 @@ class VersionEditHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型版本", consts.op_type_edit_str, "编辑模型版本", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
version = self.get_escaped_argument("version", "")
|
|
|
|
version = self.get_escaped_argument("version", "")
|
|
|
@ -445,6 +457,7 @@ class VersionListHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型版本", consts.op_type_list_str, "模型版本列表", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
model_id = self.get_int_argument("model_id")
|
|
|
|
model_id = self.get_int_argument("model_id")
|
|
|
|
pageNo = self.get_int_argument("pageNo", 1)
|
|
|
|
pageNo = self.get_int_argument("pageNo", 1)
|
|
|
@ -524,6 +537,7 @@ class VersionInfoHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型版本", consts.op_type_list_str, "查询模型版本详情", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
response = {
|
|
|
|
response = {
|
|
|
@ -606,6 +620,7 @@ class VersionSetDefaultHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型版本", consts.op_type_edit_str, "设置模型版本为默认版本", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
model_id = self.get_int_argument("model_id")
|
|
|
|
model_id = self.get_int_argument("model_id")
|
|
|
@ -644,6 +659,7 @@ class VersionDeleteHandler(APIHandler):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
@authenticated
|
|
|
|
|
|
|
|
@operation_log("模型管理", "模型版本", consts.op_type_delete_str, "删除模型版本", "")
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
version_id = self.get_int_argument("version_id")
|
|
|
|
if not version_id:
|
|
|
|
if not version_id:
|
|
|
|