search tag fix

This commit is contained in:
mubai
2024-05-22 13:50:05 +08:00
parent 625cd9e931
commit b89dcb165a
19 changed files with 146 additions and 384 deletions

View File

@@ -87,7 +87,7 @@ const (
//mysql服务配置信息 root:root 设置mysql账户的用户名和密码
MysqlDsn = "root:root@(192.168.20.10:3307)/FilmSite?charset=utf8mb4&parseTime=True&loc=Local"
MysqlDsn = "root:root@(192.168.20.7:3306)/FilmSite?charset=utf8mb4&parseTime=True&loc=Local"
// MysqlDsn docker compose 环境下的链接信息 mysql:3306 为 docker compose 中 mysql服务对应的网络名称和端口
//MysqlDsn = "root:root@(mysql:3306)/FilmSite?charset=utf8mb4&parseTime=True&loc=Local"
@@ -98,7 +98,7 @@ const (
RedisPassword redis访问密码
RedisDBNo 使用第几号库
*/
RedisAddr = `192.168.20.10:6379`
RedisAddr = `192.168.20.7:6379`
RedisPassword = `root`
RedisDBNo = 0

View File

@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin"
"server/logic"
"server/model/system"
"server/plugin/spider"
"strconv"
"time"
)
@@ -135,6 +136,7 @@ func FindFilmClass(c *gin.Context) {
system.Success(class, "分类信息查找成功", c)
}
// UpdateFilmClass 更新指定分类的影片数据
func UpdateFilmClass(c *gin.Context) {
// 获取修改后的分类信息
var class = system.CategoryTree{}
@@ -151,6 +153,8 @@ func UpdateFilmClass(c *gin.Context) {
system.Failed(err.Error(), c)
return
}
// 更新成功后删除首页缓存
spider.ClearCache()
system.SuccessOnlyMsg("影片分类信息更新成功", c)
}

View File

@@ -561,7 +561,13 @@ func GetTagsByTitle(pid int64, t string) []string {
// 过滤分类tag
switch t {
case "Category":
tags = db.Rdb.ZRevRange(db.Cxt, fmt.Sprintf(config.SearchTag, pid, t), 0, -1).Val()
//tags = db.Rdb.ZRevRange(db.Cxt, fmt.Sprintf(config.SearchTag, pid, t), 0, -1).Val()
// 获取所有展示的子分类
for _, c := range GetChildrenTree(pid) {
if c.Show {
tags = append(tags, fmt.Sprintf("%s:%d", c.Name, c.Id))
}
}
case "Plot":
tags = db.Rdb.ZRevRange(db.Cxt, fmt.Sprintf(config.SearchTag, pid, t), 0, 10).Val()
case "Area":

View File

@@ -100,7 +100,7 @@ func HandleCollect(id string, h int) error {
system.SyncFilmPicture()
}
// 每次成功执行完都清理redis中的相关API接口数据缓存
clearCache()
ClearCache()
}
case system.CollectArticle, system.CollectActor, system.CollectRole, system.CollectWebSite:

View File

@@ -85,7 +85,7 @@ func ValidSpec(spec string) error {
return err
}
// 清理API接口数据缓存
func clearCache() {
// ClearCache 清理API接口数据缓存
func ClearCache() {
system.RemoveCache(config.IndexCacheKey)
}