Merge branch 'feat-cjy-data' into dev
# Conflicts: # api/aryshare/ayrshare.pb.go # api/aryshare/ayrshare.validator.pb.go # api/aryshare/ayrshare_triple.pb.go # pkg/cron/task.go
This commit is contained in:
commit
5463e7f44c
File diff suppressed because it is too large
Load Diff
@ -6,11 +6,10 @@ package aryshare
|
||||
import (
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||
_ "github.com/mwitkow/go-proto-validators"
|
||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -41,6 +40,11 @@ func (this *PostRequest) Validate() error {
|
||||
if len(this.Platforms) < 1 {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
for _, item := range this.Platforms {
|
||||
if item == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
}
|
||||
if this.InstagramOptions != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.InstagramOptions); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("InstagramOptions", err)
|
||||
@ -173,12 +177,6 @@ func (this *Email) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GenerateJWTRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`domain不能为空`))
|
||||
}
|
||||
if this.PrivateKey == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("PrivateKey", fmt.Errorf(`privateKey不能为空`))
|
||||
}
|
||||
if this.ProfileKey == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ProfileKey", fmt.Errorf(`profileKey不能为空`))
|
||||
}
|
||||
@ -192,3 +190,711 @@ func (this *GenerateJWTRequest) Validate() error {
|
||||
func (this *GenerateJWTResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *HistoryPostId) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *HistoryItem) Validate() error {
|
||||
for _, item := range this.PostIds {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("PostIds", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.ScheduleDate != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ScheduleDate); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ScheduleDate", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetHistoryRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetHistoryResponse) Validate() error {
|
||||
for _, item := range this.History {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("History", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetHistoryByIdRequest) Validate() error {
|
||||
if this.Id == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`帖子ID不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetHistoryByIdResponse) Validate() error {
|
||||
for _, item := range this.PostIds {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("PostIds", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.ScheduleDate != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ScheduleDate); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ScheduleDate", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *PlatformPost) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetHistoryByPlatformRequest) Validate() error {
|
||||
if this.Platform == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platform", fmt.Errorf(`平台名称不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetHistoryByPlatformResponse) Validate() error {
|
||||
for _, item := range this.Posts {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Posts", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SendMessageRequest) Validate() error {
|
||||
if this.Platform == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platform", fmt.Errorf(`平台不能为空`))
|
||||
}
|
||||
if this.RecipientId == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("RecipientId", fmt.Errorf(`接收者ID不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *MessageItem) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SendMessageResponse) Validate() error {
|
||||
for _, item := range this.Messages {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Messages", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetMessagesRequest) Validate() error {
|
||||
if this.Platform == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platform", fmt.Errorf(`平台不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *MessageAttachment) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *MessageSenderDetails) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *MessageRecipientDetails) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *MessageReaction) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetMessagesItem) Validate() error {
|
||||
if this.SenderDetails != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.SenderDetails); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("SenderDetails", err)
|
||||
}
|
||||
}
|
||||
if this.RecipientDetails != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.RecipientDetails); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("RecipientDetails", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.Attachments {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Attachments", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Reactions {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Reactions", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ConversationParticipant) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ConversationDetail) Validate() error {
|
||||
if this.Participant != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Participant); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Participant", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetMessagesResponse) Validate() error {
|
||||
for _, item := range this.Messages {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Messages", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.ConversationsDetails {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ConversationsDetails", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *PostCommentRequest) Validate() error {
|
||||
if this.Id == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`id不能为空`))
|
||||
}
|
||||
if this.Comment == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Comment", fmt.Errorf(`comment不能为空`))
|
||||
}
|
||||
if len(this.Platforms) < 1 {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
for _, item := range this.Platforms {
|
||||
if item == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *InstagramCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TikTokCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BlueskyCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *FacebookCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *LinkedInCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TwitterCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *YouTubeCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PlatformError) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PostCommentResponse) Validate() error {
|
||||
if this.Instagram != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Instagram); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Instagram", err)
|
||||
}
|
||||
}
|
||||
if this.Tiktok != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Tiktok); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Tiktok", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.Errors {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Errors", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.Bluesky != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Bluesky); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Bluesky", err)
|
||||
}
|
||||
}
|
||||
if this.Facebook != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Facebook); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Facebook", err)
|
||||
}
|
||||
}
|
||||
if this.Linkedin != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Linkedin); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Linkedin", err)
|
||||
}
|
||||
}
|
||||
if this.Twitter != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Twitter); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Twitter", err)
|
||||
}
|
||||
}
|
||||
if this.Youtube != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Youtube); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Youtube", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetCommentRequest) Validate() error {
|
||||
if this.Id == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`id不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *InstagramUser) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *InstagramUserInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *InstagramComment) Validate() error {
|
||||
if this.From != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.From); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("From", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.Replies {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Replies", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.User != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.User); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("User", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TikTokComment) Validate() error {
|
||||
for _, item := range this.Replies {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Replies", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *BlueskyComment) Validate() error {
|
||||
for _, item := range this.Replies {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Replies", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *FacebookUser) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *FacebookParent) Validate() error {
|
||||
if this.From != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.From); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("From", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *FacebookComment) Validate() error {
|
||||
if this.From != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.From); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("From", err)
|
||||
}
|
||||
}
|
||||
if this.Parent != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Parent); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Parent", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.Replies {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Replies", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *LinkedInMedia) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *LinkedInFrom) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *LinkedInComment) Validate() error {
|
||||
if this.From != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.From); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("From", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.Media {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Media", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *RedditUser) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RedditComment) Validate() error {
|
||||
if this.From != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.From); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("From", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ThreadsComment) Validate() error {
|
||||
for _, item := range this.Replies {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Replies", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TwitterPublicMetrics) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TwitterReferencedTweet) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TwitterReplyTo) Validate() error {
|
||||
if this.PublicMetrics != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PublicMetrics); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("PublicMetrics", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TwitterComment) Validate() error {
|
||||
if this.PublicMetrics != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PublicMetrics); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("PublicMetrics", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.ReferencedTweets {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ReferencedTweets", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.ReplyTo != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ReplyTo); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ReplyTo", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *YouTubeReply) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *YouTubeComment) Validate() error {
|
||||
for _, item := range this.Replies {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Replies", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetCommentResponse) Validate() error {
|
||||
for _, item := range this.Instagram {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Instagram", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Tiktok {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Tiktok", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Bluesky {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Bluesky", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Facebook {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Facebook", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Linkedin {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Linkedin", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Reddit {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Reddit", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Threads {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Threads", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Twitter {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Twitter", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Youtube {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Youtube", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *DeleteCommentRequest) Validate() error {
|
||||
if this.Id == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`id不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *InstagramDeleteResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TikTokDeleteResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *DeleteCommentResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ReplyCommentRequest) Validate() error {
|
||||
if this.Id == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`id不能为空`))
|
||||
}
|
||||
if this.Comment == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Comment", fmt.Errorf(`comment不能为空`))
|
||||
}
|
||||
if len(this.Platforms) < 1 {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
for _, item := range this.Platforms {
|
||||
if item == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *InstagramReplyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TikTokReplyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BlueskyReplyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *FacebookReplyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *LinkedInReplyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TwitterReplyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *YouTubeReplyResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ReplyCommentResponse) Validate() error {
|
||||
if this.Instagram != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Instagram); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Instagram", err)
|
||||
}
|
||||
}
|
||||
if this.Tiktok != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Tiktok); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Tiktok", err)
|
||||
}
|
||||
}
|
||||
if this.Bluesky != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Bluesky); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Bluesky", err)
|
||||
}
|
||||
}
|
||||
if this.Facebook != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Facebook); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Facebook", err)
|
||||
}
|
||||
}
|
||||
if this.Linkedin != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Linkedin); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Linkedin", err)
|
||||
}
|
||||
}
|
||||
if this.Twitter != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Twitter); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Twitter", err)
|
||||
}
|
||||
}
|
||||
if this.Youtube != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Youtube); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Youtube", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetPostAnalyticsRequest) Validate() error {
|
||||
if this.Id == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`帖子ID不能为空`))
|
||||
}
|
||||
if len(this.Platforms) < 1 {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
for _, item := range this.Platforms {
|
||||
if item == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetPostAnalyticsBySocialIDRequest) Validate() error {
|
||||
if this.Id == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`Social Post ID不能为空`))
|
||||
}
|
||||
if len(this.Platforms) < 1 {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
for _, item := range this.Platforms {
|
||||
if item == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetPostAnalyticsResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetSocialAnalyticsRequest) Validate() error {
|
||||
if len(this.Platforms) < 1 {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
for _, item := range this.Platforms {
|
||||
if item == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platforms", fmt.Errorf(`platforms平台列表不能为空`))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetSocialAnalyticsResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *AutoHashtagsRequest) Validate() error {
|
||||
if this.Post == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Post", fmt.Errorf(`post内容不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *AutoHashtagsResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CheckBannedHashtagRequest) Validate() error {
|
||||
if this.Hashtag == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Hashtag", fmt.Errorf(`hashtag不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *CheckBannedHashtagResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *HashtagRecommendation) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RecommendHashtagsRequest) Validate() error {
|
||||
if this.Keyword == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Keyword", fmt.Errorf(`keyword不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *RecommendHashtagsResponse) Validate() error {
|
||||
for _, item := range this.Recommendations {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Recommendations", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SearchHashtagsRequest) Validate() error {
|
||||
if this.Keyword == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Keyword", fmt.Errorf(`keyword不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SearchHashtagInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SearchHashtagChild) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SearchHashtagChildren) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SearchHashtagMedia) Validate() error {
|
||||
if this.Children != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Children); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Children", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SearchHashtagsResponse) Validate() error {
|
||||
if this.Hashtag != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Hashtag); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Hashtag", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.SearchResults {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("SearchResults", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -37,6 +37,27 @@ type AyrshareClient interface {
|
||||
CreateProfile(ctx context.Context, in *CreateProfileRequest, opts ...grpc_go.CallOption) (*CreateProfileResponse, common.ErrorWithAttachment)
|
||||
GetProfiles(ctx context.Context, in *GetProfilesRequest, opts ...grpc_go.CallOption) (*GetProfilesResponse, common.ErrorWithAttachment)
|
||||
GenerateJWT(ctx context.Context, in *GenerateJWTRequest, opts ...grpc_go.CallOption) (*GenerateJWTResponse, common.ErrorWithAttachment)
|
||||
// 历史记录相关 api
|
||||
GetHistory(ctx context.Context, in *GetHistoryRequest, opts ...grpc_go.CallOption) (*GetHistoryResponse, common.ErrorWithAttachment)
|
||||
GetHistoryById(ctx context.Context, in *GetHistoryByIdRequest, opts ...grpc_go.CallOption) (*GetHistoryByIdResponse, common.ErrorWithAttachment)
|
||||
GetHistoryByPlatform(ctx context.Context, in *GetHistoryByPlatformRequest, opts ...grpc_go.CallOption) (*GetHistoryByPlatformResponse, common.ErrorWithAttachment)
|
||||
// 消息相关 api
|
||||
SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc_go.CallOption) (*SendMessageResponse, common.ErrorWithAttachment)
|
||||
GetMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc_go.CallOption) (*GetMessagesResponse, common.ErrorWithAttachment)
|
||||
// 评论相关 api
|
||||
PostComment(ctx context.Context, in *PostCommentRequest, opts ...grpc_go.CallOption) (*PostCommentResponse, common.ErrorWithAttachment)
|
||||
GetComment(ctx context.Context, in *GetCommentRequest, opts ...grpc_go.CallOption) (*GetCommentResponse, common.ErrorWithAttachment)
|
||||
DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc_go.CallOption) (*DeleteCommentResponse, common.ErrorWithAttachment)
|
||||
ReplyComment(ctx context.Context, in *ReplyCommentRequest, opts ...grpc_go.CallOption) (*ReplyCommentResponse, common.ErrorWithAttachment)
|
||||
// 分析相关 api
|
||||
GetPostAnalytics(ctx context.Context, in *GetPostAnalyticsRequest, opts ...grpc_go.CallOption) (*GetPostAnalyticsResponse, common.ErrorWithAttachment)
|
||||
GetPostAnalyticsBySocialID(ctx context.Context, in *GetPostAnalyticsBySocialIDRequest, opts ...grpc_go.CallOption) (*GetPostAnalyticsResponse, common.ErrorWithAttachment)
|
||||
GetSocialAnalytics(ctx context.Context, in *GetSocialAnalyticsRequest, opts ...grpc_go.CallOption) (*GetSocialAnalyticsResponse, common.ErrorWithAttachment)
|
||||
// Hashtags 相关 api
|
||||
AutoHashtags(ctx context.Context, in *AutoHashtagsRequest, opts ...grpc_go.CallOption) (*AutoHashtagsResponse, common.ErrorWithAttachment)
|
||||
CheckBannedHashtag(ctx context.Context, in *CheckBannedHashtagRequest, opts ...grpc_go.CallOption) (*CheckBannedHashtagResponse, common.ErrorWithAttachment)
|
||||
RecommendHashtags(ctx context.Context, in *RecommendHashtagsRequest, opts ...grpc_go.CallOption) (*RecommendHashtagsResponse, common.ErrorWithAttachment)
|
||||
SearchHashtags(ctx context.Context, in *SearchHashtagsRequest, opts ...grpc_go.CallOption) (*SearchHashtagsResponse, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type ayrshareClient struct {
|
||||
@ -44,12 +65,28 @@ type ayrshareClient struct {
|
||||
}
|
||||
|
||||
type AyrshareClientImpl struct {
|
||||
Post func(ctx context.Context, in *PostRequest) (*PostResponse, error)
|
||||
GetPost func(ctx context.Context, in *GetPostRequest) (*GetPostResponse, error)
|
||||
GetUser func(ctx context.Context, in *GetUserRequest) (*GetUserResponse, error)
|
||||
CreateProfile func(ctx context.Context, in *CreateProfileRequest) (*CreateProfileResponse, error)
|
||||
GetProfiles func(ctx context.Context, in *GetProfilesRequest) (*GetProfilesResponse, error)
|
||||
GenerateJWT func(ctx context.Context, in *GenerateJWTRequest) (*GenerateJWTResponse, error)
|
||||
Post func(ctx context.Context, in *PostRequest) (*PostResponse, error)
|
||||
GetPost func(ctx context.Context, in *GetPostRequest) (*GetPostResponse, error)
|
||||
GetUser func(ctx context.Context, in *GetUserRequest) (*GetUserResponse, error)
|
||||
CreateProfile func(ctx context.Context, in *CreateProfileRequest) (*CreateProfileResponse, error)
|
||||
GetProfiles func(ctx context.Context, in *GetProfilesRequest) (*GetProfilesResponse, error)
|
||||
GenerateJWT func(ctx context.Context, in *GenerateJWTRequest) (*GenerateJWTResponse, error)
|
||||
GetHistory func(ctx context.Context, in *GetHistoryRequest) (*GetHistoryResponse, error)
|
||||
GetHistoryById func(ctx context.Context, in *GetHistoryByIdRequest) (*GetHistoryByIdResponse, error)
|
||||
GetHistoryByPlatform func(ctx context.Context, in *GetHistoryByPlatformRequest) (*GetHistoryByPlatformResponse, error)
|
||||
SendMessage func(ctx context.Context, in *SendMessageRequest) (*SendMessageResponse, error)
|
||||
GetMessages func(ctx context.Context, in *GetMessagesRequest) (*GetMessagesResponse, error)
|
||||
PostComment func(ctx context.Context, in *PostCommentRequest) (*PostCommentResponse, error)
|
||||
GetComment func(ctx context.Context, in *GetCommentRequest) (*GetCommentResponse, error)
|
||||
DeleteComment func(ctx context.Context, in *DeleteCommentRequest) (*DeleteCommentResponse, error)
|
||||
ReplyComment func(ctx context.Context, in *ReplyCommentRequest) (*ReplyCommentResponse, error)
|
||||
GetPostAnalytics func(ctx context.Context, in *GetPostAnalyticsRequest) (*GetPostAnalyticsResponse, error)
|
||||
GetPostAnalyticsBySocialID func(ctx context.Context, in *GetPostAnalyticsBySocialIDRequest) (*GetPostAnalyticsResponse, error)
|
||||
GetSocialAnalytics func(ctx context.Context, in *GetSocialAnalyticsRequest) (*GetSocialAnalyticsResponse, error)
|
||||
AutoHashtags func(ctx context.Context, in *AutoHashtagsRequest) (*AutoHashtagsResponse, error)
|
||||
CheckBannedHashtag func(ctx context.Context, in *CheckBannedHashtagRequest) (*CheckBannedHashtagResponse, error)
|
||||
RecommendHashtags func(ctx context.Context, in *RecommendHashtagsRequest) (*RecommendHashtagsResponse, error)
|
||||
SearchHashtags func(ctx context.Context, in *SearchHashtagsRequest) (*SearchHashtagsResponse, error)
|
||||
}
|
||||
|
||||
func (c *AyrshareClientImpl) GetDubboStub(cc *triple.TripleConn) AyrshareClient {
|
||||
@ -100,6 +137,102 @@ func (c *ayrshareClient) GenerateJWT(ctx context.Context, in *GenerateJWTRequest
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GenerateJWT", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetHistory(ctx context.Context, in *GetHistoryRequest, opts ...grpc_go.CallOption) (*GetHistoryResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetHistoryResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetHistory", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetHistoryById(ctx context.Context, in *GetHistoryByIdRequest, opts ...grpc_go.CallOption) (*GetHistoryByIdResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetHistoryByIdResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetHistoryById", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetHistoryByPlatform(ctx context.Context, in *GetHistoryByPlatformRequest, opts ...grpc_go.CallOption) (*GetHistoryByPlatformResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetHistoryByPlatformResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetHistoryByPlatform", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc_go.CallOption) (*SendMessageResponse, common.ErrorWithAttachment) {
|
||||
out := new(SendMessageResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SendMessage", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc_go.CallOption) (*GetMessagesResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetMessagesResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetMessages", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) PostComment(ctx context.Context, in *PostCommentRequest, opts ...grpc_go.CallOption) (*PostCommentResponse, common.ErrorWithAttachment) {
|
||||
out := new(PostCommentResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/PostComment", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetComment(ctx context.Context, in *GetCommentRequest, opts ...grpc_go.CallOption) (*GetCommentResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetCommentResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetComment", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc_go.CallOption) (*DeleteCommentResponse, common.ErrorWithAttachment) {
|
||||
out := new(DeleteCommentResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeleteComment", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) ReplyComment(ctx context.Context, in *ReplyCommentRequest, opts ...grpc_go.CallOption) (*ReplyCommentResponse, common.ErrorWithAttachment) {
|
||||
out := new(ReplyCommentResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ReplyComment", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetPostAnalytics(ctx context.Context, in *GetPostAnalyticsRequest, opts ...grpc_go.CallOption) (*GetPostAnalyticsResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetPostAnalyticsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetPostAnalytics", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetPostAnalyticsBySocialID(ctx context.Context, in *GetPostAnalyticsBySocialIDRequest, opts ...grpc_go.CallOption) (*GetPostAnalyticsResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetPostAnalyticsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetPostAnalyticsBySocialID", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) GetSocialAnalytics(ctx context.Context, in *GetSocialAnalyticsRequest, opts ...grpc_go.CallOption) (*GetSocialAnalyticsResponse, common.ErrorWithAttachment) {
|
||||
out := new(GetSocialAnalyticsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetSocialAnalytics", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) AutoHashtags(ctx context.Context, in *AutoHashtagsRequest, opts ...grpc_go.CallOption) (*AutoHashtagsResponse, common.ErrorWithAttachment) {
|
||||
out := new(AutoHashtagsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AutoHashtags", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) CheckBannedHashtag(ctx context.Context, in *CheckBannedHashtagRequest, opts ...grpc_go.CallOption) (*CheckBannedHashtagResponse, common.ErrorWithAttachment) {
|
||||
out := new(CheckBannedHashtagResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CheckBannedHashtag", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) RecommendHashtags(ctx context.Context, in *RecommendHashtagsRequest, opts ...grpc_go.CallOption) (*RecommendHashtagsResponse, common.ErrorWithAttachment) {
|
||||
out := new(RecommendHashtagsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/RecommendHashtags", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) SearchHashtags(ctx context.Context, in *SearchHashtagsRequest, opts ...grpc_go.CallOption) (*SearchHashtagsResponse, common.ErrorWithAttachment) {
|
||||
out := new(SearchHashtagsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SearchHashtags", in, out)
|
||||
}
|
||||
|
||||
// AyrshareServer is the server API for Ayrshare service.
|
||||
// All implementations must embed UnimplementedAyrshareServer
|
||||
// for forward compatibility
|
||||
@ -113,6 +246,27 @@ type AyrshareServer interface {
|
||||
CreateProfile(context.Context, *CreateProfileRequest) (*CreateProfileResponse, error)
|
||||
GetProfiles(context.Context, *GetProfilesRequest) (*GetProfilesResponse, error)
|
||||
GenerateJWT(context.Context, *GenerateJWTRequest) (*GenerateJWTResponse, error)
|
||||
// 历史记录相关 api
|
||||
GetHistory(context.Context, *GetHistoryRequest) (*GetHistoryResponse, error)
|
||||
GetHistoryById(context.Context, *GetHistoryByIdRequest) (*GetHistoryByIdResponse, error)
|
||||
GetHistoryByPlatform(context.Context, *GetHistoryByPlatformRequest) (*GetHistoryByPlatformResponse, error)
|
||||
// 消息相关 api
|
||||
SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error)
|
||||
GetMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error)
|
||||
// 评论相关 api
|
||||
PostComment(context.Context, *PostCommentRequest) (*PostCommentResponse, error)
|
||||
GetComment(context.Context, *GetCommentRequest) (*GetCommentResponse, error)
|
||||
DeleteComment(context.Context, *DeleteCommentRequest) (*DeleteCommentResponse, error)
|
||||
ReplyComment(context.Context, *ReplyCommentRequest) (*ReplyCommentResponse, error)
|
||||
// 分析相关 api
|
||||
GetPostAnalytics(context.Context, *GetPostAnalyticsRequest) (*GetPostAnalyticsResponse, error)
|
||||
GetPostAnalyticsBySocialID(context.Context, *GetPostAnalyticsBySocialIDRequest) (*GetPostAnalyticsResponse, error)
|
||||
GetSocialAnalytics(context.Context, *GetSocialAnalyticsRequest) (*GetSocialAnalyticsResponse, error)
|
||||
// Hashtags 相关 api
|
||||
AutoHashtags(context.Context, *AutoHashtagsRequest) (*AutoHashtagsResponse, error)
|
||||
CheckBannedHashtag(context.Context, *CheckBannedHashtagRequest) (*CheckBannedHashtagResponse, error)
|
||||
RecommendHashtags(context.Context, *RecommendHashtagsRequest) (*RecommendHashtagsResponse, error)
|
||||
SearchHashtags(context.Context, *SearchHashtagsRequest) (*SearchHashtagsResponse, error)
|
||||
mustEmbedUnimplementedAyrshareServer()
|
||||
}
|
||||
|
||||
@ -139,6 +293,54 @@ func (UnimplementedAyrshareServer) GetProfiles(context.Context, *GetProfilesRequ
|
||||
func (UnimplementedAyrshareServer) GenerateJWT(context.Context, *GenerateJWTRequest) (*GenerateJWTResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GenerateJWT not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetHistory(context.Context, *GetHistoryRequest) (*GetHistoryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetHistory not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetHistoryById(context.Context, *GetHistoryByIdRequest) (*GetHistoryByIdResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetHistoryById not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetHistoryByPlatform(context.Context, *GetHistoryByPlatformRequest) (*GetHistoryByPlatformResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetHistoryByPlatform not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMessages not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) PostComment(context.Context, *PostCommentRequest) (*PostCommentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PostComment not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetComment(context.Context, *GetCommentRequest) (*GetCommentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetComment not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) DeleteComment(context.Context, *DeleteCommentRequest) (*DeleteCommentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteComment not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) ReplyComment(context.Context, *ReplyCommentRequest) (*ReplyCommentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ReplyComment not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetPostAnalytics(context.Context, *GetPostAnalyticsRequest) (*GetPostAnalyticsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPostAnalytics not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetPostAnalyticsBySocialID(context.Context, *GetPostAnalyticsBySocialIDRequest) (*GetPostAnalyticsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPostAnalyticsBySocialID not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetSocialAnalytics(context.Context, *GetSocialAnalyticsRequest) (*GetSocialAnalyticsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetSocialAnalytics not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) AutoHashtags(context.Context, *AutoHashtagsRequest) (*AutoHashtagsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AutoHashtags not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) CheckBannedHashtag(context.Context, *CheckBannedHashtagRequest) (*CheckBannedHashtagResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CheckBannedHashtag not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) RecommendHashtags(context.Context, *RecommendHashtagsRequest) (*RecommendHashtagsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RecommendHashtags not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) SearchHashtags(context.Context, *SearchHashtagsRequest) (*SearchHashtagsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SearchHashtags not implemented")
|
||||
}
|
||||
func (s *UnimplementedAyrshareServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -341,6 +543,470 @@ func _Ayrshare_GenerateJWT_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetHistoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetHistory", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetHistoryById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetHistoryByIdRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetHistoryById", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetHistoryByPlatform_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetHistoryByPlatformRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetHistoryByPlatform", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SendMessageRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("SendMessage", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetMessagesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetMessages", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_PostComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostCommentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("PostComment", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetCommentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetComment", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_DeleteComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteCommentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("DeleteComment", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_ReplyComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ReplyCommentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ReplyComment", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetPostAnalytics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetPostAnalyticsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetPostAnalytics", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetPostAnalyticsBySocialID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetPostAnalyticsBySocialIDRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetPostAnalyticsBySocialID", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_GetSocialAnalytics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetSocialAnalyticsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetSocialAnalytics", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_AutoHashtags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AutoHashtagsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("AutoHashtags", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_CheckBannedHashtag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CheckBannedHashtagRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("CheckBannedHashtag", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_RecommendHashtags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecommendHashtagsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("RecommendHashtags", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_SearchHashtags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SearchHashtagsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("SearchHashtags", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Ayrshare_ServiceDesc is the grpc_go.ServiceDesc for Ayrshare service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -372,6 +1038,70 @@ var Ayrshare_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "GenerateJWT",
|
||||
Handler: _Ayrshare_GenerateJWT_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetHistory",
|
||||
Handler: _Ayrshare_GetHistory_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetHistoryById",
|
||||
Handler: _Ayrshare_GetHistoryById_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetHistoryByPlatform",
|
||||
Handler: _Ayrshare_GetHistoryByPlatform_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SendMessage",
|
||||
Handler: _Ayrshare_SendMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMessages",
|
||||
Handler: _Ayrshare_GetMessages_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PostComment",
|
||||
Handler: _Ayrshare_PostComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetComment",
|
||||
Handler: _Ayrshare_GetComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteComment",
|
||||
Handler: _Ayrshare_DeleteComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ReplyComment",
|
||||
Handler: _Ayrshare_ReplyComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPostAnalytics",
|
||||
Handler: _Ayrshare_GetPostAnalytics_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPostAnalyticsBySocialID",
|
||||
Handler: _Ayrshare_GetPostAnalyticsBySocialID_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetSocialAnalytics",
|
||||
Handler: _Ayrshare_GetSocialAnalytics_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AutoHashtags",
|
||||
Handler: _Ayrshare_AutoHashtags_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CheckBannedHashtag",
|
||||
Handler: _Ayrshare_CheckBannedHashtag_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RecommendHashtags",
|
||||
Handler: _Ayrshare_RecommendHashtags_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SearchHashtags",
|
||||
Handler: _Ayrshare_SearchHashtags_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/ayrshare.proto",
|
||||
|
||||
@ -31,6 +31,9 @@ func InitTasks() error {
|
||||
err = cm.AddTask("artistAutoConfirmAnalysis", "0 */1 * * * *", ArtistAutoConfirmAnalysisTask)
|
||||
err = cm.AddTask("refreshWorkAnalysisApprovalStatus", "0 */1 * * * *", RefreshWorkAnalysisApprovalStatusTask)
|
||||
err = cm.AddTask("scheduledPublish", "0 */1 * * * *", ScheduledPublishTask)
|
||||
|
||||
// 每天 00:30 和 12:30 执行 Ayrshare 指标采集任务
|
||||
err = cm.AddTask("ayrshareMetricsCollector", "30 0,12 * * *", AyrshareMetricsCollectorTask)
|
||||
if err != nil {
|
||||
log.Printf("添加定时任务失败: %v", err)
|
||||
}
|
||||
@ -388,3 +391,8 @@ func ScheduledPublishTask() {
|
||||
zap.Int("expired_count", expiredCount),
|
||||
zap.Int("total_count", len(workList)))
|
||||
}
|
||||
|
||||
// AyrshareMetricsCollectorTask Ayrshare 指标采集定时任务(每天 00:30 和 12:30 执行)
|
||||
func AyrshareMetricsCollectorTask() {
|
||||
serverCast.ExecuteAyrshareMetricsCollector()
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ import (
|
||||
)
|
||||
|
||||
func AnalysisRouter(r *gin.RouterGroup) {
|
||||
r.POST("analysis/trigger-ayrshare-metrics", serviceCast.TriggerAyrshareMetricsCollector)
|
||||
|
||||
analysis := r.Group("analysis")
|
||||
analysis.Use(middleware.CheckWebLogin(service.AccountProvider))
|
||||
{
|
||||
@ -29,6 +31,7 @@ func AnalysisRouter(r *gin.RouterGroup) {
|
||||
analysis.POST("artist-metrics-single", serviceCast.ArtistMetricsDailyWindow) // 艺人指标日窗口
|
||||
analysis.POST("tobe-confirmed-list", serviceCast.TobeConfirmedList) // 待确认数据列表
|
||||
analysis.POST("update-approval-id", serviceCast.UpdateWorkAnalysisApprovalID) // 更新作品分析审批ID
|
||||
// analysis.POST("trigger-ayrshare-metrics", serviceCast.TriggerAyrshareMetricsCollector) // 手动触发 Ayrshare 指标采集任务
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,10 @@ package cast
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/api/aryshare"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/api/cast"
|
||||
"fonchain-fiee/pkg/cache"
|
||||
@ -17,6 +19,7 @@ import (
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/common/constant"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@ -639,3 +642,545 @@ func autoConfirmAnalysis(ctx context.Context, analysisUuid string) (err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// TriggerAyrshareMetricsCollector 手动触发 Ayrshare 指标采集任务
|
||||
func TriggerAyrshareMetricsCollector(ctx *gin.Context) {
|
||||
// 在后台 goroutine 中执行任务,避免阻塞 HTTP 请求
|
||||
go func() {
|
||||
// 同时使用 zap 和 fmt.Printf 确保日志输出到终端
|
||||
zap.L().Info("手动触发 Ayrshare 指标采集任务")
|
||||
fmt.Printf("[%s] 手动触发 Ayrshare 指标采集任务\n", time.Now().Format("2006-01-02 15:04:05"))
|
||||
executeAyrshareMetricsCollector()
|
||||
}()
|
||||
service.Success(ctx, map[string]string{
|
||||
"message": "任务已触发,正在后台执行",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// ExecuteAyrshareMetricsCollector 提供给定时任务调用的 Ayrshare 指标采集入口
|
||||
func ExecuteAyrshareMetricsCollector() {
|
||||
executeAyrshareMetricsCollector()
|
||||
}
|
||||
|
||||
// executeAyrshareMetricsCollector 执行 Ayrshare 指标采集任务
|
||||
func executeAyrshareMetricsCollector() {
|
||||
ctx := context.Background()
|
||||
zap.L().Info("开始执行 Ayrshare 指标采集任务")
|
||||
fmt.Printf("[%s] [INFO] 开始执行 Ayrshare 指标采集任务\n", time.Now().Format("2006-01-02 15:04:05"))
|
||||
|
||||
// 获取当前日期(中国时区,格式:YYYYMMDD)
|
||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||
now := time.Now().In(loc)
|
||||
dateCN := now.Year()*10000 + int(now.Month())*100 + now.Day()
|
||||
|
||||
// 第一步:获取所有状态为1的艺人AyrShare信息
|
||||
mediaMetricsList, err := collectMediaMetricsForAyrshare(ctx, dateCN)
|
||||
if err != nil {
|
||||
zap.L().Error("采集账号指标失败", zap.Error(err))
|
||||
fmt.Printf("[%s] [ERROR] 采集账号指标失败: %v\n", time.Now().Format("2006-01-02 15:04:05"), err)
|
||||
return
|
||||
}
|
||||
|
||||
// 批量插入账号指标
|
||||
if len(mediaMetricsList) > 0 {
|
||||
req := &cast.UpsertMediaMetricsDailyBatchReq{
|
||||
Data: mediaMetricsList,
|
||||
}
|
||||
resp, err := service.CastProvider.UpsertMediaMetricsDailyBatch(ctx, req)
|
||||
if err != nil {
|
||||
zap.L().Error("批量插入账号指标失败", zap.Error(err))
|
||||
fmt.Printf("[%s] [ERROR] 批量插入账号指标失败: %v\n", time.Now().Format("2006-01-02 15:04:05"), err)
|
||||
} else if resp != nil && resp.Success {
|
||||
zap.L().Info("批量插入账号指标成功", zap.Int("count", len(mediaMetricsList)))
|
||||
fmt.Printf("[%s] [INFO] 批量插入账号指标成功,数量: %d\n", time.Now().Format("2006-01-02 15:04:05"), len(mediaMetricsList))
|
||||
}
|
||||
}
|
||||
|
||||
// 第二步:获取作品指标
|
||||
workMetricsList, err := collectWorkMetricsForAyrshare(ctx, dateCN)
|
||||
if err != nil {
|
||||
zap.L().Error("采集作品指标失败", zap.Error(err))
|
||||
fmt.Printf("[%s] [ERROR] 采集作品指标失败: %v\n", time.Now().Format("2006-01-02 15:04:05"), err)
|
||||
return
|
||||
}
|
||||
|
||||
// 批量插入作品指标
|
||||
if len(workMetricsList) > 0 {
|
||||
req := &cast.UpsertWorkMetricsDailyBatchReq{
|
||||
Data: workMetricsList,
|
||||
}
|
||||
resp, err := service.CastProvider.UpsertWorkMetricsDailyBatch(ctx, req)
|
||||
if err != nil {
|
||||
zap.L().Error("批量插入作品指标失败", zap.Error(err))
|
||||
fmt.Printf("[%s] [ERROR] 批量插入作品指标失败: %v\n", time.Now().Format("2006-01-02 15:04:05"), err)
|
||||
} else if resp != nil && resp.Success {
|
||||
zap.L().Info("批量插入作品指标成功", zap.Int("count", len(workMetricsList)))
|
||||
fmt.Printf("[%s] [INFO] 批量插入作品指标成功,数量: %d\n", time.Now().Format("2006-01-02 15:04:05"), len(workMetricsList))
|
||||
}
|
||||
}
|
||||
|
||||
zap.L().Info("Ayrshare 指标采集任务执行完成")
|
||||
fmt.Printf("[%s] [INFO] Ayrshare 指标采集任务执行完成\n", time.Now().Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
|
||||
// collectMediaMetricsForAyrshare 采集账号指标
|
||||
func collectMediaMetricsForAyrshare(ctx context.Context, dateCN int) ([]*cast.MediaMetricsDailyItem, error) {
|
||||
metricsList := make([]*cast.MediaMetricsDailyItem, 0)
|
||||
page := int32(1)
|
||||
pageSize := int32(500)
|
||||
fmt.Printf("[%s] [INFO] 开始采集账号指标\n", time.Now().Format("2006-01-02 15:04:05"))
|
||||
|
||||
for {
|
||||
// 获取状态为1的艺人AyrShare信息
|
||||
req := &cast.GetArtistAyrShareInfoReq{
|
||||
Status: 1, // 状态为1表示有效
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
}
|
||||
resp, err := service.CastProvider.GetArtistAyrShareInfo(ctx, req)
|
||||
if err != nil {
|
||||
zap.L().Error("获取艺人AyrShare信息失败", zap.Error(err), zap.Int32("page", page))
|
||||
fmt.Printf("[%s] [ERROR] 获取艺人AyrShare信息失败,页码: %d, 错误: %v\n", time.Now().Format("2006-01-02 15:04:05"), page, err)
|
||||
return metricsList, err
|
||||
}
|
||||
|
||||
if resp == nil || resp.Data == nil || len(resp.Data) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
fmt.Printf("[%s] [INFO] 获取到第 %d 页艺人信息,数量: %d\n", time.Now().Format("2006-01-02 15:04:05"), page, len(resp.Data))
|
||||
|
||||
// 对每个艺人调用 GetSocialAnalytics
|
||||
for _, artistInfo := range resp.Data {
|
||||
if artistInfo.ProfileKey == "" {
|
||||
zap.L().Warn("艺人ProfileKey为空,跳过", zap.String("artistUuid", artistInfo.ArtistUuid))
|
||||
fmt.Printf("[%s] [WARN] 艺人ProfileKey为空,跳过,artistUuid: %s\n", time.Now().Format("2006-01-02 15:04:05"), artistInfo.ArtistUuid)
|
||||
continue
|
||||
}
|
||||
|
||||
// 调用 GetSocialAnalytics,平台为 ["instagram", "tiktok"]
|
||||
socialReq := &aryshare.GetSocialAnalyticsRequest{
|
||||
Platforms: []string{"instagram", "tiktok"},
|
||||
ProfileKey: artistInfo.ProfileKey,
|
||||
}
|
||||
socialResp, err := service.AyrshareProvider.GetSocialAnalytics(ctx, socialReq)
|
||||
if err != nil {
|
||||
zap.L().Warn("获取社交分析数据失败", zap.Error(err), zap.String("profileKey", artistInfo.ProfileKey))
|
||||
fmt.Printf("[%s] [WARN] 获取社交分析数据失败,profileKey: %s, 错误: %v\n", time.Now().Format("2006-01-02 15:04:05"), artistInfo.ProfileKey, err)
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Println("socialResp", socialResp)
|
||||
|
||||
// 解析 JSON 数据并构建指标
|
||||
items := parseSocialAnalyticsToMediaMetricsForAyrshare(socialResp, artistInfo, dateCN)
|
||||
metricsList = append(metricsList, items...)
|
||||
|
||||
// 避免请求过于频繁
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
}
|
||||
|
||||
// 如果返回的数据少于 pageSize,说明已经是最后一页
|
||||
if len(resp.Data) < int(pageSize) {
|
||||
break
|
||||
}
|
||||
page++
|
||||
}
|
||||
|
||||
fmt.Printf("[%s] [INFO] 账号指标采集完成,共采集 %d 条\n", time.Now().Format("2006-01-02 15:04:05"), len(metricsList))
|
||||
fmt.Println("metricsList", metricsList)
|
||||
return metricsList, nil
|
||||
}
|
||||
|
||||
// parseSocialAnalyticsToMediaMetricsForAyrshare 解析社交分析数据并转换为媒体指标
|
||||
func parseSocialAnalyticsToMediaMetricsForAyrshare(socialResp *aryshare.GetSocialAnalyticsResponse, artistInfo *cast.ArtistAyrShareInfo, dateCN int) []*cast.MediaMetricsDailyItem {
|
||||
items := make([]*cast.MediaMetricsDailyItem, 0)
|
||||
|
||||
// 解析 Instagram 数据
|
||||
if socialResp.Instagram != "" {
|
||||
// 调试:打印 Instagram JSON 字符串的前500字符
|
||||
instaPreview := socialResp.Instagram
|
||||
if len(instaPreview) > 500 {
|
||||
instaPreview = instaPreview[:500] + "..."
|
||||
}
|
||||
fmt.Printf("[%s] [DEBUG] Instagram JSON 字符串预览: %s\n", time.Now().Format("2006-01-02 15:04:05"), instaPreview)
|
||||
|
||||
item := parsePlatformDataForAyrshare(socialResp.Instagram, "instagram", artistInfo, dateCN)
|
||||
if item != nil {
|
||||
items = append(items, item)
|
||||
fmt.Printf("[%s] [INFO] 解析 Instagram 账号指标成功,艺人: %s\n", time.Now().Format("2006-01-02 15:04:05"), artistInfo.ArtistUuid)
|
||||
}
|
||||
}
|
||||
|
||||
// 解析 TikTok 数据
|
||||
if socialResp.Tiktok != "" {
|
||||
// 调试:打印 TikTok JSON 字符串的前500字符
|
||||
tiktokPreview := socialResp.Tiktok
|
||||
if len(tiktokPreview) > 500 {
|
||||
tiktokPreview = tiktokPreview[:500] + "..."
|
||||
}
|
||||
fmt.Printf("[%s] [DEBUG] TikTok JSON 字符串预览: %s\n", time.Now().Format("2006-01-02 15:04:05"), tiktokPreview)
|
||||
|
||||
item := parsePlatformDataForAyrshare(socialResp.Tiktok, "tiktok", artistInfo, dateCN)
|
||||
if item != nil {
|
||||
items = append(items, item)
|
||||
fmt.Printf("[%s] [INFO] 解析 TikTok 账号指标成功,艺人: %s\n", time.Now().Format("2006-01-02 15:04:05"), artistInfo.ArtistUuid)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("items", items)
|
||||
fmt.Println("items length", len(items))
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
// parsePlatformDataForAyrshare 解析平台数据(JSON格式)
|
||||
func parsePlatformDataForAyrshare(jsonData, platform string, artistInfo *cast.ArtistAyrShareInfo, dateCN int) *cast.MediaMetricsDailyItem {
|
||||
// 调试:打印原始 JSON 数据(截取前500字符避免日志过长)
|
||||
jsonPreview := jsonData
|
||||
fmt.Printf("parsePlatformDataForAyrshare 原始 JSON 数据: %s\n", jsonPreview)
|
||||
|
||||
var rootData map[string]interface{}
|
||||
if err := json.Unmarshal([]byte(jsonData), &rootData); err != nil {
|
||||
zap.L().Warn("解析平台数据失败", zap.Error(err), zap.String("platform", platform))
|
||||
fmt.Printf("parsePlatformDataForAyrshare 解析平台数据失败,平台: %s, 错误: %v\n", platform, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
// 调试:打印根数据的所有 key
|
||||
rootKeys := make([]string, 0, len(rootData))
|
||||
for k := range rootData {
|
||||
rootKeys = append(rootKeys, k)
|
||||
}
|
||||
fmt.Printf("parsePlatformDataForAyrshare 根数据字段: %v\n", rootKeys)
|
||||
|
||||
// 根据平台映射平台ID:1 TikTok, 3 Instagram
|
||||
var platformID uint32
|
||||
if platform == "tiktok" {
|
||||
platformID = 1
|
||||
} else if platform == "instagram" {
|
||||
platformID = 3
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 从根数据中提取 analytics 对象,实际数据在 analytics 字段下
|
||||
var analyticsData map[string]interface{}
|
||||
if analyticsVal, ok := rootData["analytics"]; ok {
|
||||
if analyticsMap, ok := analyticsVal.(map[string]interface{}); ok {
|
||||
analyticsData = analyticsMap
|
||||
} else {
|
||||
fmt.Printf("parsePlatformDataForAyrshare analytics 字段类型不正确: %T\n", analyticsVal)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("[%s] [WARN] %s 根数据中没有找到 analytics 字段\n", time.Now().Format("2006-01-02 15:04:05"), platform)
|
||||
}
|
||||
|
||||
// 如果没有 analytics 字段,尝试直接从根数据提取(兼容旧格式)
|
||||
if analyticsData == nil {
|
||||
analyticsData = rootData
|
||||
fmt.Printf("parsePlatformDataForAyrshare 使用根数据作为 analytics 数据\n")
|
||||
}
|
||||
|
||||
// 调试:打印 analytics 数据的所有 key,帮助诊断字段名
|
||||
if len(analyticsData) > 0 {
|
||||
keys := make([]string, 0, len(analyticsData))
|
||||
for k := range analyticsData {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
fmt.Printf("parsePlatformDataForAyrshare analytics 数据字段: %v\n", keys)
|
||||
} else {
|
||||
fmt.Printf("parsePlatformDataForAyrshare analytics 数据为空\n")
|
||||
}
|
||||
|
||||
// 提取指标数据(根据 Ayrshare API 的实际返回结构)
|
||||
// Instagram 字段:followersCount, likeCount, mediaCount, viewsCount, commentsCount
|
||||
// TikTok 字段:videoCountTotal, viewCountTotal, commentCountTotal, shareCountTotal
|
||||
item := &cast.MediaMetricsDailyItem{
|
||||
Uuid: uuid.NewString(),
|
||||
ArtistUuid: artistInfo.ArtistUuid,
|
||||
MediaAccUserID: "", // MediaAccUserID 需要通过其他接口获取,暂时留空
|
||||
MediaName: "", // MediaName 需要通过其他接口获取,暂时留空
|
||||
ArtistName: "", // ArtistName 需要通过其他接口获取,暂时留空
|
||||
ArtistPhone: "", // ArtistPhone 需要通过其他接口获取,暂时留空
|
||||
PlatformID: platformID,
|
||||
Date: int32(dateCN),
|
||||
// 粉丝数:Instagram 使用 followsCount,TikTok 可能没有直接对应字段
|
||||
FansCount: extractInt64ForAyrshare(analyticsData, "followsCount", "followersCount", "followers", "followerCount", "fans", "fanCount"),
|
||||
// 观看量:Instagram 使用 viewsCount,TikTok 使用 viewCountTotal
|
||||
ViewsCount: extractInt64ForAyrshare(analyticsData, "viewCountTotal", "viewsCount", "views", "viewCount", "viewCountPeriod"),
|
||||
// 点赞数:Instagram 使用 likeCount
|
||||
LikesCount: extractInt64ForAyrshare(analyticsData, "likeCount", "likes", "likesCount", "likeCountTotal"),
|
||||
// 评论数:Instagram 使用 commentsCount,TikTok 使用 commentCountTotal
|
||||
CommentsCount: extractInt64ForAyrshare(analyticsData, "commentCountTotal", "commentsCount", "comments", "commentCount", "commentCountPeriod"),
|
||||
// 分享数:Instagram 使用 reachCount,TikTok 使用 shareCountTotal
|
||||
SharesCount: extractInt64ForAyrshare(analyticsData, "shareCountTotal", "shares", "shareCount", "sharesCount", "shareCountPeriod"),
|
||||
// 视频数:Instagram 使用 mediaCount,TikTok 使用 videoCountTotal
|
||||
VideoCount: extractInt64ForAyrshare(analyticsData, "mediaCount", "videoCountTotal", "videos", "videoCount", "videosCount"),
|
||||
// 图片/媒体数:Instagram 可能没有直接对应字段,使用 posts 等
|
||||
ImageCount: extractInt64ForAyrshare(analyticsData, "posts", "postCount", "postsCount", "images", "imageCount", "imagesCount"),
|
||||
}
|
||||
|
||||
// 调试:打印提取到的指标值
|
||||
fmt.Printf("parsePlatformDataForAyrshare 提取的指标 - 粉丝数: %d, 观看量: %d, 点赞数: %d, 评论数: %d, 分享数: %d, 视频数: %d, 图片数: %d\n",
|
||||
item.FansCount, item.ViewsCount, item.LikesCount, item.CommentsCount, item.SharesCount, item.VideoCount, item.ImageCount)
|
||||
|
||||
return item
|
||||
}
|
||||
|
||||
// extractInt64ForAyrshare 从 map 中提取 int64 值,尝试多个可能的 key
|
||||
// getMapKeys 获取 map 的所有键,用于调试
|
||||
func getMapKeys(m map[string]interface{}) []string {
|
||||
keys := make([]string, 0, len(m))
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
func extractInt64ForAyrshare(data map[string]interface{}, keys ...string) int64 {
|
||||
for _, key := range keys {
|
||||
if val, ok := data[key]; ok {
|
||||
// 调试:打印找到的字段和值
|
||||
fmt.Printf("extractInt64ForAyrshare 找到字段 %s, 值: %v, 类型: %T\n", key, val, val)
|
||||
switch v := val.(type) {
|
||||
case float64:
|
||||
return int64(v)
|
||||
case int64:
|
||||
return v
|
||||
case int:
|
||||
return int64(v)
|
||||
case int32:
|
||||
return int64(v)
|
||||
case string:
|
||||
// 如果是字符串,尝试解析为数字
|
||||
if key == "viewCountPeriod" || key == "commentCountPeriod" || key == "shareCountPeriod" {
|
||||
// 这些字段是字符串,跳过
|
||||
continue
|
||||
}
|
||||
// 尝试将字符串解析为数字
|
||||
if num, err := strconv.ParseInt(v, 10, 64); err == nil {
|
||||
return num
|
||||
}
|
||||
if num, err := strconv.ParseFloat(v, 64); err == nil {
|
||||
return int64(num)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// collectWorkMetricsForAyrshare 采集作品指标
|
||||
func collectWorkMetricsForAyrshare(ctx context.Context, dateCN int) ([]*cast.WorkMetricsDailyItem, error) {
|
||||
metricsList := make([]*cast.WorkMetricsDailyItem, 0)
|
||||
fmt.Printf("[%s] [INFO] 开始采集作品指标\n", time.Now().Format("2006-01-02 15:04:05"))
|
||||
|
||||
// 调用 ListWorkPlatformInfo,PlatformIDs=[1,3], PublishMediaStatus=2, PageSize=99999999
|
||||
req := &cast.ListWorkPlatformInfoReq{
|
||||
PlatformIDs: []uint32{1, 3}, // 1 TikTok, 3 Instagram
|
||||
PublishMediaStatus: 2, // 状态为2
|
||||
Page: 1,
|
||||
PageSize: 99999999,
|
||||
}
|
||||
resp, err := service.CastProvider.ListWorkPlatformInfo(ctx, req)
|
||||
if err != nil {
|
||||
return metricsList, err
|
||||
}
|
||||
|
||||
fmt.Println("--------------------------------")
|
||||
fmt.Println("66666666666666666666666666666")
|
||||
fmt.Println("resp", resp)
|
||||
fmt.Println("66666666666666666666666666666")
|
||||
fmt.Println("--------------------------------")
|
||||
|
||||
if resp == nil || resp.Data == nil || len(resp.Data) == 0 {
|
||||
zap.L().Info("没有作品平台信息")
|
||||
return metricsList, nil
|
||||
}
|
||||
|
||||
// 对每个作品调用 GetPostAnalytics
|
||||
for _, platformInfo := range resp.Data {
|
||||
if platformInfo.PublishMediaID == "" || platformInfo.WorkUuid == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// 只处理 TikTok(1) 和 Instagram(3) 平台
|
||||
if platformInfo.PlatformID != 1 && platformInfo.PlatformID != 3 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 通过 ArtistUuid 获取艺人的 AyrShare 信息,获取 profileKey
|
||||
artistAyrShareReq := &cast.GetArtistAyrShareInfoReq{
|
||||
ArtistUuid: platformInfo.ArtistUuid,
|
||||
Status: 1, // 状态为1表示有效
|
||||
Page: 1,
|
||||
PageSize: 1,
|
||||
}
|
||||
artistAyrShareResp, err := service.CastProvider.GetArtistAyrShareInfo(ctx, artistAyrShareReq)
|
||||
if err != nil || artistAyrShareResp == nil || len(artistAyrShareResp.Data) == 0 {
|
||||
zap.L().Warn("获取艺人AyrShare信息失败", zap.Error(err), zap.String("artistUuid", platformInfo.ArtistUuid))
|
||||
fmt.Printf("collectWorkMetricsForAyrshare 获取艺人AyrShare信息失败,artistUuid: %s, 错误: %v\n", platformInfo.ArtistUuid, err)
|
||||
continue
|
||||
}
|
||||
|
||||
profileKey := artistAyrShareResp.Data[0].ProfileKey
|
||||
if profileKey == "" {
|
||||
zap.L().Warn("作品ProfileKey为空,跳过", zap.String("workUuid", platformInfo.WorkUuid))
|
||||
fmt.Printf("collectWorkMetricsForAyrshare 作品ProfileKey为空,跳过,workUuid: %s\n", platformInfo.WorkUuid)
|
||||
continue
|
||||
}
|
||||
|
||||
// 调用 GetPostAnalytics 接口
|
||||
var postReq *aryshare.GetPostAnalyticsRequest
|
||||
if platformInfo.PlatformID == 1 {
|
||||
// TikTok 平台
|
||||
postReq = &aryshare.GetPostAnalyticsRequest{
|
||||
Id: platformInfo.PublishMediaID,
|
||||
Platforms: []string{"tiktok"},
|
||||
ProfileKey: profileKey,
|
||||
}
|
||||
} else if platformInfo.PlatformID == 3 {
|
||||
// Instagram 平台
|
||||
postReq = &aryshare.GetPostAnalyticsRequest{
|
||||
Id: platformInfo.PublishMediaID,
|
||||
Platforms: []string{"instagram"},
|
||||
ProfileKey: profileKey,
|
||||
}
|
||||
}
|
||||
|
||||
postResp, err := service.AyrshareProvider.GetPostAnalytics(ctx, postReq)
|
||||
fmt.Println("--------------------------------")
|
||||
fmt.Println("postResp", postResp)
|
||||
fmt.Println("--------------------------------")
|
||||
if err != nil {
|
||||
zap.L().Warn("获取作品分析数据失败", zap.Error(err), zap.String("publishMediaID", platformInfo.PublishMediaID))
|
||||
fmt.Printf("collectWorkMetricsForAyrshare 获取作品分析数据失败,publishMediaID: %s, 错误: %v\n", platformInfo.PublishMediaID, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// 解析作品分析数据并构建指标
|
||||
item := parsePostAnalyticsToWorkMetricsForAyrshare(postResp, platformInfo, dateCN)
|
||||
if item != nil {
|
||||
fmt.Println("--------------------------------")
|
||||
fmt.Println("test")
|
||||
fmt.Println("item", item)
|
||||
fmt.Println("--------------------------------")
|
||||
metricsList = append(metricsList, item)
|
||||
fmt.Printf("collectWorkMetricsForAyrshare 解析作品指标成功,workUuid: %s, platformID: %d\n", platformInfo.WorkUuid, platformInfo.PlatformID)
|
||||
}
|
||||
|
||||
// 避免请求过于频繁
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
}
|
||||
|
||||
fmt.Println("--------------------------------")
|
||||
fmt.Println("metricsList", metricsList)
|
||||
fmt.Println("--------------------------------")
|
||||
|
||||
fmt.Printf("collectWorkMetricsForAyrshare 作品指标采集完成,共采集 %d 条\n", len(metricsList))
|
||||
return metricsList, nil
|
||||
}
|
||||
|
||||
// parsePostAnalyticsToWorkMetricsForAyrshare 解析作品分析数据并转换为作品指标
|
||||
func parsePostAnalyticsToWorkMetricsForAyrshare(postResp *aryshare.GetPostAnalyticsResponse, platformInfo *cast.WorkPlatformInfo, dateCN int) *cast.WorkMetricsDailyItem {
|
||||
fmt.Println("--------------------------------")
|
||||
fmt.Println("44444444444444444444444444444")
|
||||
fmt.Println("platformInfo", platformInfo)
|
||||
fmt.Println("44444444444444444444444444444")
|
||||
fmt.Println("--------------------------------")
|
||||
// 根据平台ID选择对应的 JSON 数据
|
||||
var jsonData string
|
||||
if platformInfo.PlatformID == 1 { // TikTok
|
||||
jsonData = postResp.Tiktok
|
||||
} else if platformInfo.PlatformID == 3 { // Instagram
|
||||
jsonData = postResp.Instagram
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
if jsonData == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 解析 JSON 数据
|
||||
var rootData map[string]interface{}
|
||||
if err := json.Unmarshal([]byte(jsonData), &rootData); err != nil {
|
||||
zap.L().Warn("解析作品分析数据失败", zap.Error(err))
|
||||
fmt.Printf("parsePostAnalyticsToWorkMetricsForAyrshare 解析作品分析数据失败,workUuid: %s, 错误: %v\n", platformInfo.WorkUuid, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
// 调试:打印根数据的键
|
||||
fmt.Printf("[DEBUG] 根数据包含的键: %v\n", getMapKeys(rootData))
|
||||
|
||||
// 从根数据中提取 analytics 对象,实际数据可能在 analytics 字段下
|
||||
var analyticsData map[string]interface{}
|
||||
if analyticsVal, ok := rootData["analytics"]; ok {
|
||||
if analyticsMap, ok := analyticsVal.(map[string]interface{}); ok {
|
||||
analyticsData = analyticsMap
|
||||
fmt.Printf("analytics 字段提取数据,包含的键: %v\n", getMapKeys(analyticsData))
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有 analytics 字段,尝试直接从根数据提取(兼容旧格式)
|
||||
if analyticsData == nil {
|
||||
analyticsData = rootData
|
||||
fmt.Printf("parsePostAnalyticsToWorkMetricsForAyrshare 使用根数据作为 analyticsData,包含的键: %v\n", getMapKeys(analyticsData))
|
||||
}
|
||||
|
||||
// 构建作品指标项,使用 ListWorkPlatformInfo 返回的字段信息
|
||||
item := &cast.WorkMetricsDailyItem{
|
||||
Uuid: uuid.NewString(),
|
||||
WorkUuid: platformInfo.WorkUuid,
|
||||
ArtistUuid: platformInfo.ArtistUuid,
|
||||
MediaAccUserID: platformInfo.PlatformUserID, // 使用平台用户ID
|
||||
MediaName: platformInfo.PlatformUserName, // 平台用户名
|
||||
ArtistName: platformInfo.ArtistName, // 艺人名字
|
||||
ArtistPhone: platformInfo.ArtistPhone, // 艺人手机号
|
||||
PlatformID: platformInfo.PlatformID,
|
||||
Date: int32(dateCN),
|
||||
}
|
||||
|
||||
// 根据平台ID使用不同的字段提取逻辑
|
||||
if platformInfo.PlatformID == 3 {
|
||||
// Instagram 平台
|
||||
// 访问量:使用 viewsCount
|
||||
item.ViewsCount = extractInt64ForAyrshare(analyticsData, "viewsCount", "viewCount", "views")
|
||||
// 点赞数:使用 likeCount
|
||||
item.LikesCount = extractInt64ForAyrshare(analyticsData, "likeCount", "likes", "likesCount")
|
||||
// 评论数:Instagram 可能没有评论数字段,尝试多种可能
|
||||
item.CommentsCount = extractInt64ForAyrshare(analyticsData, "commentsCount", "commentCount", "comments")
|
||||
// 分享数:使用 sharesCount(注意是复数形式)
|
||||
item.SharesCount = extractInt64ForAyrshare(analyticsData, "sharesCount", "shareCount", "shares")
|
||||
|
||||
// 打印解析结果
|
||||
fmt.Printf("parsePostAnalyticsToWorkMetricsForAyrshare Instagram 作品指标解析完成 - workUuid: %s, 访问量: %d, 点赞数: %d, 评论数: %d, 分享数: %d\n",
|
||||
platformInfo.WorkUuid,
|
||||
item.ViewsCount, item.LikesCount, item.CommentsCount, item.SharesCount)
|
||||
} else if platformInfo.PlatformID == 1 {
|
||||
// TikTok 平台
|
||||
// 访问量:使用 viewCountTotal
|
||||
item.ViewsCount = extractInt64ForAyrshare(analyticsData, "viewCountTotal", "viewCount", "views", "videoViews")
|
||||
// 点赞数:使用 likeCount
|
||||
item.LikesCount = extractInt64ForAyrshare(analyticsData, "likeCount", "likes", "likesCount")
|
||||
// 评论数:使用 commentCountTotal
|
||||
item.CommentsCount = extractInt64ForAyrshare(analyticsData, "commentCountTotal", "commentCount", "comments", "commentsCount")
|
||||
// 分享数:使用 shareCountTotal
|
||||
item.SharesCount = extractInt64ForAyrshare(analyticsData, "shareCountTotal", "shareCount", "shares", "sharesCount")
|
||||
|
||||
// 打印解析结果
|
||||
fmt.Printf("parsePostAnalyticsToWorkMetricsForAyrshare TikTok 作品指标解析完成 - workUuid: %s, 访问量: %d, 点赞数: %d, 评论数: %d, 分享数: %d\n",
|
||||
platformInfo.WorkUuid,
|
||||
item.ViewsCount, item.LikesCount, item.CommentsCount, item.SharesCount)
|
||||
}
|
||||
|
||||
fmt.Println("--------------------------------")
|
||||
fmt.Println("5555555555555555555555")
|
||||
fmt.Println("item", item)
|
||||
fmt.Println("5555555555555555555555")
|
||||
fmt.Println("--------------------------------")
|
||||
|
||||
return item
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user