package main import ( "data_ai/extract" "data_ai/udp" "data_ai/ul" log "github.com/donnie4w/go-logger/logger" qu "jygit.jydev.jianyu360.cn/data_processing/common_utils" "sync" "unicode/utf8" ) func init() { ul.IsTool = false //是否工具 ul.IsLocal = true //是否本地 ul.IsFull = false //是否全量 if ul.IsTool { ul.InitToolVar() } else { ul.InitGlobalVar() if !ul.IsFull { udp.InitProcessVar() } } ul.InitOss(ul.IsLocal) } func main() { if ul.IsTool { //tool.StartToolUpdateInfo() return } extract.TestSingleFieldInfo("bidding", "664a2a4066cf0db42a39fb02") lock := make(chan bool) <-lock } func test() { log.Debug("开始大模型验证内存数据···") q := map[string]interface{}{} pool_mgo := make(chan bool, 500) wg_mgo := &sync.WaitGroup{} sess := ul.SourceMgo.GetMgoConn() defer ul.SourceMgo.DestoryMongoConn(sess) total, isok := 0, 0 it := sess.DB(ul.SourceMgo.DbName).C(ul.Bid_Name).Find(&q).Sort("-_id").Iter() for tmp := make(map[string]interface{}); it.Next(&tmp); total++ { if total%1000 == 0 { log.Debug("cur index ", total) } isok++ pool_mgo <- true wg_mgo.Add(1) go func(tmp map[string]interface{}) { defer func() { <-pool_mgo wg_mgo.Done() }() detail := qu.ObjToString(tmp["detail"]) if utf8.RuneCountInString(detail) < 100 { data := extract.ResolveInfo(tmp) if len(data) > 0 { tmp["ai_zhipu"] = data ul.SourceMgo.Save("zktest_1031", tmp) } } }(tmp) tmp = make(map[string]interface{}) } wg_mgo.Wait() log.Debug("ai is over ...") }