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:
2026-04-03 17:48:30 +08:00
parent 32d6a462cd
commit 134dd063c3
33 changed files with 2722 additions and 457 deletions
@@ -4,6 +4,7 @@ import (
"strconv"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"github.com/geo-platform/tenant-api/internal/bootstrap"
"github.com/geo-platform/tenant-api/internal/shared/response"
@@ -11,11 +12,15 @@ import (
)
type MediaHandler struct {
svc *app.MediaService
svc *app.MediaService
logger *zap.Logger
}
func NewMediaHandler(a *bootstrap.App) *MediaHandler {
return &MediaHandler{svc: app.NewMediaService(a.DB)}
return &MediaHandler{
svc: app.NewMediaService(a.DB, a.Logger),
logger: a.Logger,
}
}
func (h *MediaHandler) ListPlatforms(c *gin.Context) {
@@ -118,6 +123,18 @@ func (h *MediaHandler) PluginBindCallback(c *gin.Context) {
}
data, err := h.svc.HandleBindCallback(c.Request.Context(), req)
if err != nil {
if h.logger != nil {
appErr := response.Normalize(err)
h.logger.Warn("publisher bind callback failed",
zap.String("request_id", c.GetString("request_id")),
zap.Int64("plugin_session_id", req.PluginSessionID),
zap.String("platform_id", req.PlatformID),
zap.String("platform_uid", req.PlatformUID),
zap.Int("code", appErr.Code),
zap.String("message", appErr.Message),
zap.String("detail", appErr.Detail),
)
}
response.Error(c, err)
return
}
@@ -132,6 +149,24 @@ func (h *MediaHandler) PluginPublishCallback(c *gin.Context) {
}
data, err := h.svc.HandlePublishCallback(c.Request.Context(), req)
if err != nil {
if h.logger != nil {
appErr := response.Normalize(err)
h.logger.Warn("publisher publish callback failed",
zap.String("request_id", c.GetString("request_id")),
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", req.Status),
zap.Stringp("error_message", req.ErrorMessage),
zap.Int("code", appErr.Code),
zap.String("message", appErr.Message),
zap.String("detail", appErr.Detail),
zap.Any("request_payload", req.RequestPayload),
zap.Any("response_payload", req.ResponsePayload),
)
}
response.Error(c, err)
return
}