feat: add Number Connect game with ABC spatial optimization and auto-pagination
Build and Push Docker Image / build (push) Successful in 3m45s
Build and Push Docker Image / build (push) Successful in 3m45s
This commit is contained in:
@@ -29,9 +29,24 @@ func (t *learnNumberTool) Init() error {
|
||||
|
||||
func (t *learnNumberTool) RegisterRoutes(r *gin.RouterGroup) {
|
||||
r.POST("/counting", t.handleCounting)
|
||||
r.POST("/writing", t.handleWriting)
|
||||
r.GET("/categories", t.handleCategories)
|
||||
}
|
||||
|
||||
func (t *learnNumberTool) handleWriting(c *gin.Context) {
|
||||
var req logic.WritingRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
pdfBytes, err := logic.GenerateWritingPDF(req)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.Data(http.StatusOK, "application/pdf", pdfBytes)
|
||||
}
|
||||
|
||||
func (t *learnNumberTool) handleCategories(c *gin.Context) {
|
||||
// 返回分类信息供前端预览
|
||||
c.JSON(http.StatusOK, data.IconCategories)
|
||||
|
||||
Reference in New Issue
Block a user