package services import ( "context" "eta/eta_task/utils" "fmt" ) type WechatArticleOp struct { Source string WechatPlatformId int } // AddWechatArticleOpToCache // @Description: 将公众号文章操作加入缓存 // @param wechatPlatformId // @param source // @return bool func AddWechatArticleOpToCache(wechatPlatformId int, source string) bool { record := new(WechatArticleOp) record.Source = source record.WechatPlatformId = wechatPlatformId if utils.Re == nil { err := utils.Rc.LPush(utils.CACHE_WECHAT_PLATFORM_ARTICLE, record) utils.FileLog.Info(fmt.Sprintf("将公众号文章操作 加入缓存 AddWechatArticleOpToCache LPush: 操作类型:%s,公众号id:%d", source, wechatPlatformId)) if err != nil { fmt.Println("AddWechatArticleOpToCache LPush Err:" + err.Error()) } return true } return false } // RefreshWechatPlatform // @Description: 刷新公众号 // @author: Roc // @datetime 2025-03-14 18:46:05 // @param cont context.Context // @return err error func RefreshWechatPlatform(cont context.Context) (err error) { //utils.FileLog.Debug("RefreshWechatPlatform:", time.Now().Format(utils.FormatDateTime)) //obj := new(rag.WechatPlatform) //platformList, tmpErr := obj.GetListByCondition(` AND enabled = 1 `, []interface{}{}, 0, 100000) //if tmpErr != nil { // err = tmpErr // return //} // //for _, v := range platformList { // AddWechatArticleOpToCache(v.WechatPlatformId, "refresh") // time.Sleep(1 * time.Minute) //} return }