feat: 植物识别百科ai助手迁移
This commit is contained in:
@@ -26,10 +26,12 @@ func (l *GetAiChatQuotaLogic) GetAiChatQuota(in *plant.GetProfileReq) (*plant.Ai
|
||||
l.svcCtx.DB.Model(&plantModel.AiChatHistory{}).
|
||||
Where("user_id = ? AND created_at >= ?", in.UserId, todayStart).
|
||||
Count(&used)
|
||||
limit := l.svcCtx.Config.Ai.DailyQuota
|
||||
if limit <= 0 {
|
||||
limit = 20
|
||||
|
||||
limit := int64(20)
|
||||
if dbCfg, err := getActiveAiConfig(l.svcCtx.DB); err == nil && dbCfg.DailyQueryLimit > 0 {
|
||||
limit = int64(dbCfg.DailyQueryLimit)
|
||||
}
|
||||
|
||||
remaining := limit - used
|
||||
if remaining < 0 {
|
||||
remaining = 0
|
||||
|
||||
Reference in New Issue
Block a user