|
@@ -73,14 +73,14 @@ func (m runManager) RunColumnCron() {
|
|
}
|
|
}
|
|
|
|
|
|
func (m *runManager) RunDataSign(ctx context.Context) {
|
|
func (m *runManager) RunDataSign(ctx context.Context) {
|
|
- st, et := eTime()
|
|
|
|
|
|
+ st, et := SignTime()
|
|
GetProjectSign(ctx, st, et) //前一天拟建标签
|
|
GetProjectSign(ctx, st, et) //前一天拟建标签
|
|
GetBidSign(ctx, st, et) //前一天标讯标签
|
|
GetBidSign(ctx, st, et) //前一天标讯标签
|
|
- GetHotSign(ctx) //热门标签
|
|
|
|
|
|
+ //GetHotSign(ctx) //热门标签
|
|
}
|
|
}
|
|
|
|
|
|
// 热门标签统计
|
|
// 热门标签统计
|
|
-func GetHotSign(ctx context.Context) {
|
|
|
|
|
|
+func (m *runManager) RunHotSign(ctx context.Context) {
|
|
var (
|
|
var (
|
|
total, count int
|
|
total, count int
|
|
)
|
|
)
|
|
@@ -112,16 +112,19 @@ func GetProjectSign(ctx context.Context, st, et int64) {
|
|
defer db.ProposedMgo.DestoryMongoConn(sess)
|
|
defer db.ProposedMgo.DestoryMongoConn(sess)
|
|
query := bson.M{
|
|
query := bson.M{
|
|
"nav_column": bson.M{"$exists": true},
|
|
"nav_column": bson.M{"$exists": true},
|
|
- "pici": bson.M{"$gte": st, "$lte": et},
|
|
|
|
|
|
+ "pici": bson.M{"$gte": st, "$lt": et},
|
|
}
|
|
}
|
|
|
|
+
|
|
it := sess.DB(db.ProposedMgoConf.DbName).C(db.ProposedMgoConf.Collection).Find(query).Select(map[string]interface{}{
|
|
it := sess.DB(db.ProposedMgoConf.DbName).C(db.ProposedMgoConf.Collection).Find(query).Select(map[string]interface{}{
|
|
- "_id": 1,
|
|
|
|
- "nature_code": 1,
|
|
|
|
- "ownerclass_code": 1,
|
|
|
|
- "category_code": 1,
|
|
|
|
- "projectname": 1,
|
|
|
|
- "nav_column": 1,
|
|
|
|
- "firsttime": 1,
|
|
|
|
|
|
+ "_id": 1,
|
|
|
|
+ "nature_code": 1,
|
|
|
|
+ "area": 1,
|
|
|
|
+ "project_stage_code": 1,
|
|
|
|
+ "ownerclass_code": 1,
|
|
|
|
+ "category_code": 1,
|
|
|
|
+ "projectname": 1,
|
|
|
|
+ "nav_column": 1,
|
|
|
|
+ "lasttime": 1,
|
|
}).Iter()
|
|
}).Iter()
|
|
var (
|
|
var (
|
|
projectSignArr []*ProjectSign
|
|
projectSignArr []*ProjectSign
|
|
@@ -138,14 +141,16 @@ func GetProjectSign(ctx context.Context, st, et int64) {
|
|
bs := &ProjectSign{
|
|
bs := &ProjectSign{
|
|
Bid_id: mongodb.BsonIdToSId(cMap["_id"]),
|
|
Bid_id: mongodb.BsonIdToSId(cMap["_id"]),
|
|
Title: gconv.String(cMap["projectname"]),
|
|
Title: gconv.String(cMap["projectname"]),
|
|
|
|
+ Stage: gconv.String(cMap["project_stage_code"]),
|
|
|
|
+ Area: gconv.String(cMap["area"]),
|
|
Nature: gconv.String(cMap["nature_code"]),
|
|
Nature: gconv.String(cMap["nature_code"]),
|
|
Ownerclass: gconv.String(cMap["ownerclass_code"]),
|
|
Ownerclass: gconv.String(cMap["ownerclass_code"]),
|
|
Category: gconv.String(cMap["category_code"]),
|
|
Category: gconv.String(cMap["category_code"]),
|
|
Sign: convertToBitmap(gconv.Int(cMap["nav_column"])),
|
|
Sign: convertToBitmap(gconv.Int(cMap["nav_column"])),
|
|
- Publish_time: time.Unix(gconv.Int64(cMap["firsttime"]), 0),
|
|
|
|
|
|
+ Publish_time: time.Unix(gconv.Int64(cMap["lasttime"]), 0),
|
|
}
|
|
}
|
|
projectSignArr = append(projectSignArr, bs)
|
|
projectSignArr = append(projectSignArr, bs)
|
|
- if len(projectSignArr) > 100 {
|
|
|
|
|
|
+ if len(projectSignArr) == 100 {
|
|
SaveProjectSign(ctx, projectSignArr)
|
|
SaveProjectSign(ctx, projectSignArr)
|
|
projectSignArr = []*ProjectSign{}
|
|
projectSignArr = []*ProjectSign{}
|
|
}
|
|
}
|
|
@@ -154,23 +159,23 @@ func GetProjectSign(ctx context.Context, st, et int64) {
|
|
if len(projectSignArr) > 0 {
|
|
if len(projectSignArr) > 0 {
|
|
SaveProjectSign(ctx, projectSignArr)
|
|
SaveProjectSign(ctx, projectSignArr)
|
|
}
|
|
}
|
|
- g.Log().Infof(ctx, "GetProjectSign date :%s 总加载%d条数据", time.Now().String(), total)
|
|
|
|
|
|
+ g.Log().Infof(ctx, "GetProjectSign query :%v 总加载%d条数据", query, total)
|
|
}
|
|
}
|
|
|
|
|
|
// 标讯标签统计
|
|
// 标讯标签统计
|
|
func GetBidSign(ctx context.Context, st, et int64) {
|
|
func GetBidSign(ctx context.Context, st, et int64) {
|
|
- sOfDay, eOfDay := eTime()
|
|
|
|
- queryStr := fmt.Sprintf(`SELECT bid_id FROM new_bidList WHERE pici >= %d and pici <= %d `, sOfDay, eOfDay)
|
|
|
|
|
|
+ //_, eOfDay := eTime()
|
|
|
|
+ queryStr := fmt.Sprintf(`SELECT bid_id FROM new_bidList WHERE pici >= %d and pici <= %d `, st, time.Now().Unix())
|
|
bidListId := getNewBidList(ctx, queryStr)
|
|
bidListId := getNewBidList(ctx, queryStr)
|
|
if bidListId == nil || len(*bidListId) == 0 {
|
|
if bidListId == nil || len(*bidListId) == 0 {
|
|
- g.Log().Infof(ctx, "new_bidList 信息获取失败", time.Now())
|
|
|
|
|
|
+ g.Log().Infof(ctx, "new_bidList 信息获取失败stime:%d,etime:%v", st, time.Now())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
sess := db.Mgo.GetMgoConn()
|
|
sess := db.Mgo.GetMgoConn()
|
|
defer db.Mgo.DestoryMongoConn(sess)
|
|
defer db.Mgo.DestoryMongoConn(sess)
|
|
query := bson.M{
|
|
query := bson.M{
|
|
"nav_column": bson.M{"$exists": true},
|
|
"nav_column": bson.M{"$exists": true},
|
|
- "pici": bson.M{"$gte": st, "$lte": et},
|
|
|
|
|
|
+ "pici": bson.M{"$gte": st, "$lt": et},
|
|
}
|
|
}
|
|
it := sess.DB(db.MongdbConf.DbName).C(db.MongdbConf.Collection).Find(query).Select(map[string]interface{}{
|
|
it := sess.DB(db.MongdbConf.DbName).C(db.MongdbConf.Collection).Find(query).Select(map[string]interface{}{
|
|
"_id": 1,
|
|
"_id": 1,
|
|
@@ -214,7 +219,7 @@ func GetBidSign(ctx context.Context, st, et int64) {
|
|
SaveBidSign(ctx, bidSignArr)
|
|
SaveBidSign(ctx, bidSignArr)
|
|
}
|
|
}
|
|
RepeatIds(ctx)
|
|
RepeatIds(ctx)
|
|
- g.Log().Infof(ctx, "GetBidSign date :%s 总加载%d条数据", time.Now().String(), total)
|
|
|
|
|
|
+ g.Log().Infof(ctx, "GetBidSign date :%d 总加载%d条数据", st, total)
|
|
}
|
|
}
|
|
|
|
|
|
func getNewBidList(ctx context.Context, queryStr string) *map[string]bool {
|
|
func getNewBidList(ctx context.Context, queryStr string) *map[string]bool {
|
|
@@ -241,6 +246,12 @@ func eTime() (int64, int64) {
|
|
return sOfDay.Unix(), eOfDay.Unix()
|
|
return sOfDay.Unix(), eOfDay.Unix()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func SignTime() (int64, int64) {
|
|
|
|
+ tm := time.Now()
|
|
|
|
+ // 转换为时间戳
|
|
|
|
+ return tm.Add(-4 * time.Hour).Unix(), tm.Add(-2 * time.Hour).Unix()
|
|
|
|
+}
|
|
|
|
+
|
|
func ColumnInit() {
|
|
func ColumnInit() {
|
|
TitleRemoval = map[string]bool{}
|
|
TitleRemoval = map[string]bool{}
|
|
ColumnNumber = map[columnType]int{}
|
|
ColumnNumber = map[columnType]int{}
|
|
@@ -348,6 +359,8 @@ func (m *runManager) RunColumnData(ctx context.Context) {
|
|
type ProjectSign struct {
|
|
type ProjectSign struct {
|
|
Bid_id string `json:"bid_id"`
|
|
Bid_id string `json:"bid_id"`
|
|
Title string `json:"title"`
|
|
Title string `json:"title"`
|
|
|
|
+ Stage string `json:"stage"`
|
|
|
|
+ Area string `json:"area"`
|
|
Nature string `json:"nature"`
|
|
Nature string `json:"nature"`
|
|
Ownerclass string `json:"ownerclass"`
|
|
Ownerclass string `json:"ownerclass"`
|
|
Category string `json:"category"`
|
|
Category string `json:"category"`
|