提交
This commit is contained in:
1 parent
a903fcf6d4
commit
259c55cc23
80 files changed
+6090
-123
No files matched your search
+1
-1
@@ -1 +1 @@
|
||||
27977
|
||||
31370
|
||||
@@ -53,6 +53,7 @@ from app.crud.crm.product import (
|
||||
from app.schemas.crm.product import (
|
||||
CategoryDeleteBody,
|
||||
ProductCategoryCreateBody,
|
||||
ProductCategoryTreeBody,
|
||||
ProductCategoryUpdateBody,
|
||||
ProductCreateBody,
|
||||
ProductDeleteBody,
|
||||
@@ -325,23 +326,20 @@ router = APIRouter(prefix="/web/crm", tags=["CRM管理"])
|
||||
|
||||
@router.post("/product-categories/tree")
|
||||
def category_tree(
|
||||
body: dict = None,
|
||||
body: ProductCategoryTreeBody = None,
|
||||
_user: dict = Depends(require_admin_or_super_admin),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""获取产品分类树"""
|
||||
"""获取产品分类树(名称/状态由服务端过滤)"""
|
||||
try:
|
||||
tenant_no = get_tenant_no(db, _user)
|
||||
user_info = crm_user_info(_user)
|
||||
user_info = crm_user_info(_user)
|
||||
payload = body or {}
|
||||
category_name = payload.get("categoryName") or payload.get("category_name")
|
||||
status = payload.get("status")
|
||||
q = body or ProductCategoryTreeBody()
|
||||
rows = list_category_tree(
|
||||
db,
|
||||
tenant_no,
|
||||
category_name=category_name,
|
||||
status=status,
|
||||
category_name=q.category_name,
|
||||
status=q.status,
|
||||
user_info=user_info,
|
||||
)
|
||||
return success_response(rows)
|
||||
|
||||
@@ -44,6 +44,15 @@ class CategoryDeleteBody(BaseModel):
|
||||
id: str = Field(..., description="分类ID")
|
||||
|
||||
|
||||
class ProductCategoryTreeBody(BaseModel):
|
||||
"""产品分类树查询(密文解密后须用 Pydantic 绑定,裸 dict=None 在部分链路下会丢 body)"""
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
category_name: Optional[str] = Field(default=None, alias="categoryName", description="分类名称(模糊)")
|
||||
status: Optional[str] = Field(default=None, description="状态")
|
||||
|
||||
|
||||
class ProductUpdateStatusBody(BaseModel):
|
||||
"""产品批量上下架请求体"""
|
||||
|
||||
|
||||
Reference in new issue
Block a user