diff --git a/internal/logic/aryshare_comment.go b/internal/logic/aryshare_comment.go index e5d5397..d704df5 100644 --- a/internal/logic/aryshare_comment.go +++ b/internal/logic/aryshare_comment.go @@ -196,14 +196,17 @@ func (a *AyrshareComment) PostComment(req *dto.PostCommentRequest) (res *dto.Pos for platform, value := range rawObj { if platformMap, ok := value.(map[string]interface{}); ok { if status, ok := platformMap["status"].(string); ok && status == "error" { + // 构建错误消息 errMsg := msg.ErrorPostCommentFailed - if msg, ok := platformMap["message"].(string); ok && msg != "" { - errMsg = msg + if msgStr, ok := platformMap["message"].(string); ok && msgStr != "" { + errMsg = msgStr } if code, ok := platformMap["code"].(float64); ok && code != 0 { errMsg = fmt.Sprintf("错误代码: %.0f, %s", code, errMsg) } - return nil, errCommon.ReturnError(fmt.Errorf("%s平台: %s", platform, errMsg), errMsg, "发布评论 失败: ") + // 构建包含平台信息的完整错误消息 + fullErrMsg := fmt.Sprintf("%s平台: %s", platform, errMsg) + return nil, errCommon.ReturnError(fmt.Errorf(fullErrMsg), fullErrMsg, "发布评论 失败: ") } } }