fix(smoke): 修复首页 AI 建议降级与节点索引
This commit is contained in:
@@ -3,6 +3,7 @@ package handler
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -140,8 +141,8 @@ func (h *SmokeHandler) Home(c *gin.Context) {
|
||||
case errors.Is(err, smokeservice.ErrNoSmokeLogs):
|
||||
adviceCard.Status = "no_data"
|
||||
default:
|
||||
c.JSON(http.StatusInternalServerError, model.Error(http.StatusInternalServerError, "获取 AI 建议失败,请稍后重试"))
|
||||
return
|
||||
log.Printf("[smoke_home] ai advice degraded uid=%d date=%s err=%v", user.ID, adviceDate.Format(dateLayout), err)
|
||||
adviceCard.Status = "unavailable"
|
||||
}
|
||||
} else if record != nil {
|
||||
adviceCard.Message = record.Advice
|
||||
|
||||
@@ -12,7 +12,7 @@ type SmokeAINextSmoke struct {
|
||||
UID int `gorm:"column:uid;index:idx_smoke_ai_next_uid_date,priority:1;comment:用户ID" json:"-"`
|
||||
|
||||
PlanDate time.Time `gorm:"column:plan_date;type:date;index:idx_smoke_ai_next_uid_date,priority:2;comment:计划日期(当天)" json:"plan_date"`
|
||||
AIAdviceID uint `gorm:"column:ai_advice_id;index:idx_smoke_ai_next_advice,priority:1;comment:关联AI建议ID(fa_smoke_ai_advice.id)" json:"ai_advice_id"`
|
||||
AIAdviceID uint `gorm:"column:ai_advice_id;index:idx_smoke_ai_next_advice,priority:1;uniqueIndex:uniq_smoke_ai_next_node,priority:1;comment:关联AI建议ID(fa_smoke_ai_advice.id)" json:"ai_advice_id"`
|
||||
|
||||
// NodeType: not_before / suggested / node
|
||||
NodeType string `gorm:"column:node_type;size:20;index:idx_smoke_ai_next_advice,priority:2;uniqueIndex:uniq_smoke_ai_next_node,priority:2;comment:节点类型" json:"node_type"`
|
||||
|
||||
Reference in New Issue
Block a user