TODO: extractor openrec

This commit is contained in:
eson
2020-07-10 12:05:33 +08:00
parent 2e9a803645
commit 4af5430572
17 changed files with 4117 additions and 34 deletions

View File

@@ -1 +0,0 @@
../../../config.yaml

View File

@@ -11,12 +11,10 @@ import (
"github.com/tidwall/gjson"
)
var targetTypeRanking = "openrec_ranking"
var targetTypeUser = "openrec_user"
var openrecRanking *OpenrecRanking
// store 源存储实例, 为存储源数据的实现. 表格具体参考sql/intimate_source.sql
var store *intimate.Store = intimate.NewStore("source_openrec")
var store *intimate.SourceStore = intimate.NewSourceStore(string(intimate.STOpenrec))
func init() {
@@ -67,7 +65,7 @@ func (or *OpenrecRanking) Execute(cxt *hunter.TaskContext) {
data.SetSource(sql.NullString{String: userid, Valid: len(userid) > 0})
data.SetUrl(wf.GetRawURL())
data.SetTargetType(targetTypeUser)
data.SetTargetType(string(intimate.TTOpenrecUser))
store.Insert(data)
}
}

View File

@@ -1,2 +0,0 @@
database:
uri: "root:@tcp(127.0.0.1:4000)/intimate_source"

View File

@@ -10,12 +10,10 @@ import (
"github.com/474420502/hunter"
)
var targetTypeUser = "openrec_user"
var targetTypeRanking = "openrec_ranking"
var oer *OpenrecExtratorRanking
// store 源存储实例, 为存储源数据的实现. 表格具体参考sql/intimate_source.sql
var store *intimate.Store = intimate.NewStore("source_openrec")
var store *intimate.SourceStore = intimate.NewSourceStore(string(intimate.STOpenrec))
func init() {
oer = &OpenrecExtratorRanking{}
@@ -31,7 +29,7 @@ func (oer *OpenrecExtratorRanking) Execute(cxt *hunter.TaskContext) {
for {
source, err := store.Pop(targetTypeUser)
source, err := store.Pop(string(intimate.TTOpenrecUser))
if err != nil {
log.Println(err)
return