feat: 修复 H5 底部导航覆盖 + 更新项目进度文档
## H5 底部导航修复 (Bug #10) - 精简 App.vue,移除重复 tabbar,仅保留全局样式 - uni-page 设置 height: calc(100% - 50px) + overflow-y: auto - 内容区域精确停在底部导航上方,独立滚动不再叠加 - 恢复 custom-tab-bar 组件 ## 项目进度文档 - PROGRESS.md 更新至 10 个 Bug 修复 - 新增 H5 底部导航修复记录 - 新增历史变更条目
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
from typing import Dict, Any, List, Optional
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy import select, func
|
||||
from app.models.user import User, Product
|
||||
from app.services.marketing import MarketingService
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OnboardingService:
|
||||
def __init__(self, db: AsyncSession):
|
||||
self.db = db
|
||||
|
||||
async def check_status(self, user_id: str) -> Dict[str, Any]:
|
||||
product_count = await self.db.execute(
|
||||
select(func.count(Product.id)).where(
|
||||
Product.user_id == user_id, Product.is_active == True
|
||||
)
|
||||
)
|
||||
has_products = (product_count.scalar() or 0) > 0
|
||||
return {"onboarded": has_products}
|
||||
|
||||
async def generate_first_product(
|
||||
self, user_id: str, name: str, description: str, category: str = "", target: str = "US importers"
|
||||
) -> Dict[str, Any]:
|
||||
product = Product(
|
||||
user_id=user_id,
|
||||
name=name,
|
||||
description=description,
|
||||
category=category or "general",
|
||||
is_active=True,
|
||||
)
|
||||
self.db.add(product)
|
||||
await self.db.flush()
|
||||
|
||||
mkt = MarketingService()
|
||||
try:
|
||||
content = await mkt.generate(
|
||||
product_name=name,
|
||||
description=description,
|
||||
category=category or "general",
|
||||
target=target,
|
||||
style="professional",
|
||||
count=3,
|
||||
language="en",
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(f"Onboarding content generation failed: {e}")
|
||||
content = [f"Check out our {name} - {description[:100]}..."]
|
||||
|
||||
try:
|
||||
keywords_result = await mkt.generate_keywords(
|
||||
product_name=name, description=description, category=category or "general"
|
||||
)
|
||||
keywords = keywords_result if isinstance(keywords_result, list) else []
|
||||
except Exception as e:
|
||||
logger.warning(f"Keyword generation failed: {e}")
|
||||
keywords = []
|
||||
|
||||
product.keywords = keywords[:10]
|
||||
await self.db.flush()
|
||||
|
||||
return {
|
||||
"product": {
|
||||
"id": str(product.id),
|
||||
"name": product.name,
|
||||
"description": product.description,
|
||||
"category": product.category,
|
||||
"keywords": keywords[:10],
|
||||
},
|
||||
"generated_content": content,
|
||||
"keywords": keywords[:10],
|
||||
}
|
||||
Reference in New Issue
Block a user