From 00d9386c5194a57a43e292d39b2f0d9a0db6e700 Mon Sep 17 00:00:00 2001 From: shenshuo <191715030@qq.com> Date: Thu, 18 Jul 2024 14:57:23 +0800 Subject: [PATCH] =?UTF-8?q?2024=E5=B9=B47=E6=9C=8818=E6=97=A5=20=20feat(Ap?= =?UTF-8?q?psModel)=20=E6=B7=BB=E5=8A=A0=E5=BA=94=E7=94=A8=E5=88=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mg/handlers/apps_v4_handler.py | 6 +++++- models/paas_model.py | 11 +++++------ services/app_service.py | 5 +++-- 3 files changed, 13 insertions(+), 9 deletions(-) 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)