Integrate ai.card Rust API with ai.gpt MCP and implement daily limit system
### Major Changes: - **Rust Migration**: Move api-rs to root directory, rename binary to 'aicard' - **MCP Integration**: Add card tools to ai.gpt MCP server (get_user_cards, draw_card, get_draw_status) - **Daily Limit System**: Implement 2-day interval card drawing limits in API and iOS - **iOS Enhancements**: Add DrawStatusView, backup functionality, and limit integration ### Technical Details: - ai.gpt MCP now has 20 tools including 3 card-related tools - ServiceClient enhanced with missing card API methods - iOS app includes daily limit UI and atproto OAuth backup features - Database migration for last_draw_date field - Complete feature parity between web and iOS implementations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -56,11 +56,38 @@ async def draw_card(
|
||||
await db.commit()
|
||||
return result
|
||||
|
||||
except ValueError as e:
|
||||
# Handle daily limit error
|
||||
await db.rollback()
|
||||
raise HTTPException(status_code=429, detail=str(e))
|
||||
except Exception as e:
|
||||
await db.rollback()
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@router.get("/draw-status/{user_did}")
|
||||
async def get_draw_status(
|
||||
user_did: str,
|
||||
db: AsyncSession = Depends(get_session)
|
||||
):
|
||||
"""
|
||||
ユーザーのガチャ実行状況を取得
|
||||
|
||||
- **user_did**: ユーザーのatproto DID
|
||||
"""
|
||||
from app.core.config import settings
|
||||
|
||||
user_repo = UserRepository(db)
|
||||
can_draw = await user_repo.can_draw_card(user_did, settings.draw_limit_days)
|
||||
next_draw_time = await user_repo.get_next_draw_time(user_did, settings.draw_limit_days)
|
||||
|
||||
return {
|
||||
"can_draw": can_draw,
|
||||
"next_draw_time": next_draw_time.isoformat() if next_draw_time else None,
|
||||
"draw_limit_days": settings.draw_limit_days
|
||||
}
|
||||
|
||||
|
||||
@router.get("/user/{user_did}", response_model=List[Card])
|
||||
async def get_user_cards(
|
||||
user_did: str,
|
||||
|
Reference in New Issue
Block a user