This commit is contained in:
parent
7d00772dd4
commit
de48e49511
@ -196,14 +196,17 @@ func (a *AyrshareComment) PostComment(req *dto.PostCommentRequest) (res *dto.Pos
|
|||||||
for platform, value := range rawObj {
|
for platform, value := range rawObj {
|
||||||
if platformMap, ok := value.(map[string]interface{}); ok {
|
if platformMap, ok := value.(map[string]interface{}); ok {
|
||||||
if status, ok := platformMap["status"].(string); ok && status == "error" {
|
if status, ok := platformMap["status"].(string); ok && status == "error" {
|
||||||
|
// 构建错误消息
|
||||||
errMsg := msg.ErrorPostCommentFailed
|
errMsg := msg.ErrorPostCommentFailed
|
||||||
if msg, ok := platformMap["message"].(string); ok && msg != "" {
|
if msgStr, ok := platformMap["message"].(string); ok && msgStr != "" {
|
||||||
errMsg = msg
|
errMsg = msgStr
|
||||||
}
|
}
|
||||||
if code, ok := platformMap["code"].(float64); ok && code != 0 {
|
if code, ok := platformMap["code"].(float64); ok && code != 0 {
|
||||||
errMsg = fmt.Sprintf("错误代码: %.0f, %s", code, errMsg)
|
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, "发布评论 失败: ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user