Преглед изворни кода

feat: 在添加和更新渠道时重置代理客户端缓存

RedwindA пре 3 месеци
родитељ
комит
486c828df0
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      controller/channel.go

+ 3 - 0
controller/channel.go

@@ -8,6 +8,7 @@ import (
 	"one-api/constant"
 	"one-api/constant"
 	"one-api/dto"
 	"one-api/dto"
 	"one-api/model"
 	"one-api/model"
+	"one-api/service"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 
 
@@ -633,6 +634,7 @@ func AddChannel(c *gin.Context) {
 		common.ApiError(c, err)
 		common.ApiError(c, err)
 		return
 		return
 	}
 	}
+	service.ResetProxyClientCache()
 	c.JSON(http.StatusOK, gin.H{
 	c.JSON(http.StatusOK, gin.H{
 		"success": true,
 		"success": true,
 		"message": "",
 		"message": "",
@@ -894,6 +896,7 @@ func UpdateChannel(c *gin.Context) {
 		return
 		return
 	}
 	}
 	model.InitChannelCache()
 	model.InitChannelCache()
+	service.ResetProxyClientCache()
 	channel.Key = ""
 	channel.Key = ""
 	clearChannelInfo(&channel.Channel)
 	clearChannelInfo(&channel.Channel)
 	c.JSON(http.StatusOK, gin.H{
 	c.JSON(http.StatusOK, gin.H{