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.
kuaishou/app.go

34 lines
861 B

package kuaishou
import (
"go.dtapp.net/golog"
"go.dtapp.net/gomongo"
"go.dtapp.net/gorequest"
"gorm.io/gorm"
)
type App struct {
ua string
mongo *gomongo.Client // 日志数据库
pgsql *gorm.DB // pgsql数据库
client *gorequest.App // 请求客户端
log *golog.Api // 日志服务
logTableName string // 日志表名
logStatus bool // 日志状态
}
func NewApp(pgsql *gorm.DB) *App {
app := &App{ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36"}
app.client = gorequest.NewHttp()
if pgsql != nil {
app.pgsql = pgsql
app.logStatus = true
app.logTableName = "kuaishou"
app.log = golog.NewApi(&golog.ApiConfig{
Db: pgsql,
TableName: app.logTableName,
})
}
return app
}