Add configurable CC cost for banner vehicle PDF/description view
- Add cc_per_banner_view setting to system_settings (default 0.1 CC) - Update car detail page to use dynamic CC value from settings - Add CC per Banner View field in admin settings page - Replace hardcoded 0.1 CC with configurable value 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -146,7 +146,12 @@ def check_car_view(
|
||||
}
|
||||
|
||||
|
||||
PERFORMANCE_CHECK_COST = 0.1 # 0.1 CC for performance check view
|
||||
def get_performance_check_cost(db: Session) -> float:
|
||||
"""Get performance check cost from system settings"""
|
||||
system_settings = db.query(SystemSettings).first()
|
||||
if system_settings and system_settings.cc_per_banner_view is not None:
|
||||
return system_settings.cc_per_banner_view
|
||||
return 0.1 # Default fallback
|
||||
|
||||
|
||||
@router.post("/purchase-performance-check")
|
||||
@@ -155,8 +160,9 @@ async def purchase_performance_check_view(
|
||||
current_user: User = Depends(get_current_user),
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""Purchase access to view performance check (costs 0.1 CC)"""
|
||||
"""Purchase access to view performance check (costs CC based on system settings)"""
|
||||
car_id = request.car_id
|
||||
PERFORMANCE_CHECK_COST = get_performance_check_cost(db)
|
||||
|
||||
# Check if car exists
|
||||
car = db.query(Car).filter(Car.id == car_id).first()
|
||||
|
||||
@@ -26,6 +26,7 @@ def get_or_create_settings(db: Session) -> SystemSettings:
|
||||
cc_per_usdc=1, # 1 USD = 1 CC
|
||||
cc_per_view=1, # 차량 상세 조회 시 1 CC
|
||||
cars_per_cc=3, # 1 CC = 3 recommended vehicles per request
|
||||
cc_per_banner_view=0.1, # 배너 차량 PDF/상세 보기 비용
|
||||
cc_signup_bonus=3, # 3 CC free on signup
|
||||
cache_ttl_hours=2,
|
||||
container_logistics_usd=3600,
|
||||
|
||||
@@ -21,6 +21,7 @@ class SystemSettings(Base):
|
||||
cc_per_view = Column(Integer, default=1) # 차량 상세 조회 시 1 CC
|
||||
cc_signup_bonus = Column(Integer, default=3) # 신규 가입 시 3 CC
|
||||
cars_per_cc = Column(Integer, default=3) # 1 CC당 추천 차량 수 (기본 3대)
|
||||
cc_per_banner_view = Column(Float, default=0.1) # 배너 차량 PDF/상세 보기 비용 (기본 0.1 CC)
|
||||
|
||||
# 캐시 TTL (시간)
|
||||
cache_ttl_hours = Column(Integer, default=2)
|
||||
|
||||
@@ -12,6 +12,7 @@ class SystemSettingsUpdate(BaseModel):
|
||||
cc_per_view: Optional[int] = None
|
||||
cc_signup_bonus: Optional[int] = None
|
||||
cars_per_cc: Optional[int] = None
|
||||
cc_per_banner_view: Optional[float] = None
|
||||
cache_ttl_hours: Optional[int] = None
|
||||
container_logistics_usd: Optional[int] = None
|
||||
shoring_cost_usd: Optional[int] = None
|
||||
@@ -32,6 +33,7 @@ class SystemSettingsResponse(BaseModel):
|
||||
cc_per_view: int
|
||||
cc_signup_bonus: int
|
||||
cars_per_cc: int
|
||||
cc_per_banner_view: float = 0.1
|
||||
cache_ttl_hours: int
|
||||
container_logistics_usd: int
|
||||
shoring_cost_usd: int
|
||||
|
||||
Reference in New Issue
Block a user