You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
976 B
41 lines
976 B
package service |
|
|
|
import ( |
|
"flag" |
|
"path/filepath" |
|
"sync" |
|
"time" |
|
|
|
"go-common/app/job/openplatform/article/conf" |
|
"go-common/app/job/openplatform/article/dao" |
|
"go-common/library/queue/databus" |
|
) |
|
|
|
// func WithService(f func(s *Service)) func() { |
|
// return func() { |
|
// dir, _ := filepath.Abs("../goconvey.toml") |
|
// flag.Set("conf", dir) |
|
// conf.Init() |
|
// s := New(conf.Conf) |
|
// // s.dao = dao.New(conf.Conf) |
|
// f(s) |
|
// } |
|
// } |
|
|
|
func WithoutProcService(f func(s *Service)) func() { |
|
return func() { |
|
dir, _ := filepath.Abs("../goconvey.toml") |
|
flag.Set("conf", dir) |
|
conf.Init() |
|
s := &Service{ |
|
c: conf.Conf, |
|
dao: dao.New(conf.Conf), |
|
waiter: new(sync.WaitGroup), |
|
// articleRPC: artrpc.New(conf.Conf.ArticleRPC), |
|
articleSub: databus.New(conf.Conf.ArticleSub), |
|
articleStatSub: databus.New(conf.Conf.ArticleStatSub), |
|
updateDbInterval: int64(time.Duration(conf.Conf.Job.UpdateDbInterval) / time.Second), |
|
} |
|
f(s) |
|
} |
|
}
|
|
|