feat: Add platform adapters for various content publishing platforms
- Implemented Dongchedi adapter for user detection and publishing. - Implemented Jianshu adapter for user detection and publishing. - Implemented Juejin adapter for user detection and publishing. - Implemented Qiehao adapter for user detection and publishing. - Implemented Smzdm adapter for user detection and publishing. - Implemented Sohuhao adapter for user detection and publishing. - Implemented Toutiaohao adapter for user detection and publishing. - Implemented Wangyihao adapter for user detection and publishing. - Implemented Weixin Gzh adapter for user detection and publishing. - Implemented Zol adapter for user detection and publishing. - Added documentation for manual testing of media publishing.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/geo-platform/tenant-api/internal/shared/auth"
|
||||
"github.com/geo-platform/tenant-api/internal/shared/response"
|
||||
@@ -19,11 +20,12 @@ import (
|
||||
const minBrowserExtensionVersion = "0.1.0"
|
||||
|
||||
type MediaService struct {
|
||||
pool *pgxpool.Pool
|
||||
pool *pgxpool.Pool
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
func NewMediaService(pool *pgxpool.Pool) *MediaService {
|
||||
return &MediaService{pool: pool}
|
||||
func NewMediaService(pool *pgxpool.Pool, logger *zap.Logger) *MediaService {
|
||||
return &MediaService{pool: pool, logger: logger}
|
||||
}
|
||||
|
||||
type MediaPlatformResponse struct {
|
||||
@@ -712,6 +714,22 @@ func (s *MediaService) HandlePublishCallback(ctx context.Context, req PluginPubl
|
||||
publishedAt = &now
|
||||
}
|
||||
|
||||
if reqStatus != "success" && s.logger != nil {
|
||||
s.logger.Warn("publisher callback reported non-success status",
|
||||
zap.Int64("plugin_session_id", req.PluginSessionID),
|
||||
zap.Int64("publish_record_id", req.PublishRecordID),
|
||||
zap.Int64("platform_account_id", req.PlatformAccountID),
|
||||
zap.Int64("article_id", req.ArticleID),
|
||||
zap.String("platform_id", req.PlatformID),
|
||||
zap.String("status", reqStatus),
|
||||
zap.Stringp("error_message", req.ErrorMessage),
|
||||
zap.Stringp("external_article_id", req.ExternalArticleID),
|
||||
zap.Stringp("external_article_url", req.ExternalArticleURL),
|
||||
zap.Any("request_payload", req.RequestPayload),
|
||||
zap.Any("response_payload", req.ResponsePayload),
|
||||
)
|
||||
}
|
||||
|
||||
if _, err := tx.Exec(ctx, `
|
||||
UPDATE publish_records
|
||||
SET status = $1,
|
||||
|
||||
Reference in New Issue
Block a user