53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package publisher
|
||
|
||
import (
|
||
"geo/internal/config"
|
||
"log"
|
||
)
|
||
|
||
type PublisherInerface interface {
|
||
PublishNote() (bool, string)
|
||
WaitLogin() (bool, string)
|
||
}
|
||
|
||
type NewPublisher func(
|
||
param *TaskParams,
|
||
cfg *config.Config,
|
||
logger *log.Logger) PublisherInerface
|
||
|
||
type PublisherValue struct {
|
||
Name string
|
||
InitMethod NewPublisher
|
||
ContentFormat string //需要的文章格式,html,text,markdown
|
||
ImgNeed int8 //是否需要图片,1需要,2非必须,3不要
|
||
Type int8 //类型:1文章2视频
|
||
WordContainImg bool //文章带上头图
|
||
}
|
||
|
||
var PublisherMap = map[string]*PublisherValue{
|
||
"xhs": {
|
||
Name: "小红书",
|
||
InitMethod: NewXiaohongshuPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 3,
|
||
Type: 1,
|
||
WordContainImg: false,
|
||
},
|
||
"bjh": {
|
||
Name: "百家号",
|
||
InitMethod: NewBaijiahaoPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: true,
|
||
},
|
||
"toutiao": {
|
||
Name: "今日头条",
|
||
InitMethod: NewToutiaoPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: true,
|
||
},
|
||
}
|