diff --git a/mg/handlers/apps_v4_handler.py b/mg/handlers/apps_v4_handler.py index 4e7cb83..4fe65a1 100644 --- a/mg/handlers/apps_v4_handler.py +++ b/mg/handlers/apps_v4_handler.py @@ -9,8 +9,10 @@ import json from abc import ABC -from libs.base_handler import BaseHandler + from websdk2.db_context import DBContextV2 as DBContext + +from libs.base_handler import BaseHandler from models.authority import RoleApps from services.app_service import get_apps_list_for_main, get_apps_list_for_api, opt_obj, get_apps_list_for_role @@ -71,12 +73,14 @@ def get(self, *args, **kwargs): def post(self, *args, **kwargs): data = json.loads(self.request.body.decode("utf-8")) + data.setdefault("classify", "SaaS") res = opt_obj.handle_add(data) self.write(res) def put(self, *args, **kwargs): data = json.loads(self.request.body.decode("utf-8")) + data.setdefault("classify", "SaaS") res = opt_obj.handle_update(data) self.write(res) diff --git a/models/paas_model.py b/models/paas_model.py index bcd3b3c..d6482f2 100644 --- a/models/paas_model.py +++ b/models/paas_model.py @@ -5,16 +5,14 @@ date : 2023年06月05日 desc : 平台管理 """ -# import json -# import base64 -from sqlalchemy import Column, DateTime from datetime import datetime -# from sqlalchemy.orm import relationship, backref -# from sqlalchemy import TypeDecorator -from sqlalchemy import Column, String, Integer, JSON, ForeignKey, UniqueConstraint, Text + +from sqlalchemy import Column, String, Integer, JSON, UniqueConstraint, Text +from sqlalchemy import DateTime from sqlalchemy.dialects.mysql import LONGTEXT, MEDIUMTEXT from sqlalchemy.ext.declarative import declarative_base from websdk2.utils.cc_crypto import AESCryptoV3 + from models import TimeBaseModel Base = declarative_base() @@ -32,6 +30,7 @@ class AppsModel(TimeBaseModel, Base): # path = Column('path', String(255), default='') # 文件加载地址 img = Column('img', String(255), default='') # 图片地址 icon = Column('icon', String(255), default='') # 图标 + classify = Column('classify', String(50), default='SaaS', index=True) # 分类 description = Column('description', String(250), default='') # 描述、备注 diff --git a/services/app_service.py b/services/app_service.py index 6eef368..82dc0e3 100644 --- a/services/app_service.py +++ b/services/app_service.py @@ -11,10 +11,11 @@ from sqlalchemy import or_ from websdk2.db_context import DBContextV2 as DBContext from websdk2.sqlalchemy_pagination import paginate + +# from websdk2.model_utils import CommonOptView, queryset_to_list +from libs.feature_model_utils import CommonOptView, queryset_to_list from models.authority import RoleApps from models.paas_model import AppsModel -# from websdk2.model_utils import CommonOptView, queryset_to_list -from libs.feature_model_utils import CommonOptView,queryset_to_list opt_obj = CommonOptView(AppsModel)