Compare commits
6 Commits
main
...
feature-fo
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a9bb7d179 | |||
| 9f9634e38e | |||
| e1b9781daf | |||
| abecc03b96 | |||
| e2097a5b2c | |||
| ed3c23724d |
File diff suppressed because it is too large
Load Diff
@ -206,6 +206,15 @@ func (this *GenerateJWTRequest) Validate() error {
|
||||
func (this *GenerateJWTResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UnlinkSocialNetworkRequest) Validate() error {
|
||||
if this.Platform == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Platform", fmt.Errorf(`platform不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *UnlinkSocialNetworkResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *HistoryPostId) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.1
|
||||
// - protoc v6.32.0--rc2
|
||||
// source: pb/ayrshare.proto
|
||||
|
||||
package aryshare
|
||||
@ -37,6 +37,7 @@ 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)
|
||||
UnlinkSocialNetwork(ctx context.Context, in *UnlinkSocialNetworkRequest, opts ...grpc_go.CallOption) (*UnlinkSocialNetworkResponse, 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)
|
||||
@ -71,6 +72,7 @@ type AyrshareClientImpl struct {
|
||||
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)
|
||||
UnlinkSocialNetwork func(ctx context.Context, in *UnlinkSocialNetworkRequest) (*UnlinkSocialNetworkResponse, 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)
|
||||
@ -137,6 +139,12 @@ func (c *ayrshareClient) GenerateJWT(ctx context.Context, in *GenerateJWTRequest
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GenerateJWT", in, out)
|
||||
}
|
||||
|
||||
func (c *ayrshareClient) UnlinkSocialNetwork(ctx context.Context, in *UnlinkSocialNetworkRequest, opts ...grpc_go.CallOption) (*UnlinkSocialNetworkResponse, common.ErrorWithAttachment) {
|
||||
out := new(UnlinkSocialNetworkResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UnlinkSocialNetwork", 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)
|
||||
@ -246,6 +254,7 @@ type AyrshareServer interface {
|
||||
CreateProfile(context.Context, *CreateProfileRequest) (*CreateProfileResponse, error)
|
||||
GetProfiles(context.Context, *GetProfilesRequest) (*GetProfilesResponse, error)
|
||||
GenerateJWT(context.Context, *GenerateJWTRequest) (*GenerateJWTResponse, error)
|
||||
UnlinkSocialNetwork(context.Context, *UnlinkSocialNetworkRequest) (*UnlinkSocialNetworkResponse, error)
|
||||
// 历史记录相关 api
|
||||
GetHistory(context.Context, *GetHistoryRequest) (*GetHistoryResponse, error)
|
||||
GetHistoryById(context.Context, *GetHistoryByIdRequest) (*GetHistoryByIdResponse, error)
|
||||
@ -293,6 +302,9 @@ 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) UnlinkSocialNetwork(context.Context, *UnlinkSocialNetworkRequest) (*UnlinkSocialNetworkResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UnlinkSocialNetwork not implemented")
|
||||
}
|
||||
func (UnimplementedAyrshareServer) GetHistory(context.Context, *GetHistoryRequest) (*GetHistoryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetHistory not implemented")
|
||||
}
|
||||
@ -543,6 +555,35 @@ func _Ayrshare_GenerateJWT_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Ayrshare_UnlinkSocialNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UnlinkSocialNetworkRequest)
|
||||
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("UnlinkSocialNetwork", 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_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 {
|
||||
@ -1038,6 +1079,10 @@ var Ayrshare_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "GenerateJWT",
|
||||
Handler: _Ayrshare_GenerateJWT_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UnlinkSocialNetwork",
|
||||
Handler: _Ayrshare_UnlinkSocialNetwork_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetHistory",
|
||||
Handler: _Ayrshare_GetHistory_Handler,
|
||||
|
||||
10406
api/cast/cast.pb.go
10406
api/cast/cast.pb.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.1
|
||||
// - protoc v6.32.0--rc2
|
||||
// source: pb/fiee/cast.proto
|
||||
|
||||
package cast
|
||||
@ -54,6 +54,7 @@ type CastClient interface {
|
||||
RefreshWorkList(ctx context.Context, in *RefreshWorkListReq, opts ...grpc_go.CallOption) (*RefreshWorkListResp, common.ErrorWithAttachment)
|
||||
WorkResource(ctx context.Context, in *WorkResourceReq, opts ...grpc_go.CallOption) (*WorkResourceResp, common.ErrorWithAttachment)
|
||||
UpdateWorkResource(ctx context.Context, in *UpdateWorkResourceReq, opts ...grpc_go.CallOption) (*UpdateWorkResourceResp, common.ErrorWithAttachment)
|
||||
UpdateMediaAccStatus(ctx context.Context, in *UpdateMediaAccStatusReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment)
|
||||
OAuthAccountV2(ctx context.Context, in *OAuthAccountV2Req, opts ...grpc_go.CallOption) (*OAuthAccountV2Resp, common.ErrorWithAttachment)
|
||||
OAuthCodeToToken(ctx context.Context, in *OAuthCodeToTokenReq, opts ...grpc_go.CallOption) (*OAuthCodeToTokenResp, common.ErrorWithAttachment)
|
||||
@ -164,6 +165,7 @@ type CastClientImpl struct {
|
||||
RefreshWorkList func(ctx context.Context, in *RefreshWorkListReq) (*RefreshWorkListResp, error)
|
||||
WorkResource func(ctx context.Context, in *WorkResourceReq) (*WorkResourceResp, error)
|
||||
UpdateWorkResource func(ctx context.Context, in *UpdateWorkResourceReq) (*UpdateWorkResourceResp, error)
|
||||
UpdateMediaAccStatus func(ctx context.Context, in *UpdateMediaAccStatusReq) (*emptypb.Empty, error)
|
||||
OAuthAccount func(ctx context.Context, in *OAuthAccountReq) (*OAuthAccountResp, error)
|
||||
OAuthAccountV2 func(ctx context.Context, in *OAuthAccountV2Req) (*OAuthAccountV2Resp, error)
|
||||
OAuthCodeToToken func(ctx context.Context, in *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error)
|
||||
@ -391,6 +393,12 @@ func (c *castClient) UpdateWorkResource(ctx context.Context, in *UpdateWorkResou
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateWorkResource", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) UpdateMediaAccStatus(ctx context.Context, in *UpdateMediaAccStatusReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) {
|
||||
out := new(emptypb.Empty)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateMediaAccStatus", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment) {
|
||||
out := new(OAuthAccountResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -798,6 +806,7 @@ type CastServer interface {
|
||||
RefreshWorkList(context.Context, *RefreshWorkListReq) (*RefreshWorkListResp, error)
|
||||
WorkResource(context.Context, *WorkResourceReq) (*WorkResourceResp, error)
|
||||
UpdateWorkResource(context.Context, *UpdateWorkResourceReq) (*UpdateWorkResourceResp, error)
|
||||
UpdateMediaAccStatus(context.Context, *UpdateMediaAccStatusReq) (*emptypb.Empty, error)
|
||||
OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error)
|
||||
OAuthAccountV2(context.Context, *OAuthAccountV2Req) (*OAuthAccountV2Resp, error)
|
||||
OAuthCodeToToken(context.Context, *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error)
|
||||
@ -959,6 +968,9 @@ func (UnimplementedCastServer) WorkResource(context.Context, *WorkResourceReq) (
|
||||
func (UnimplementedCastServer) UpdateWorkResource(context.Context, *UpdateWorkResourceReq) (*UpdateWorkResourceResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkResource not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) UpdateMediaAccStatus(context.Context, *UpdateMediaAccStatusReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateMediaAccStatus not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OAuthAccount not implemented")
|
||||
}
|
||||
@ -1901,6 +1913,35 @@ func _Cast_UpdateWorkResource_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_UpdateMediaAccStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateMediaAccStatusReq)
|
||||
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("UpdateMediaAccStatus", 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 _Cast_OAuthAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OAuthAccountReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3835,6 +3876,10 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "UpdateWorkResource",
|
||||
Handler: _Cast_UpdateWorkResource_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateMediaAccStatus",
|
||||
Handler: _Cast_UpdateMediaAccStatus_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OAuthAccount",
|
||||
Handler: _Cast_OAuthAccount_Handler,
|
||||
|
||||
@ -43,13 +43,6 @@ var PlatformPublishStatusMM = map[cast.PublishStatusENUM]string{
|
||||
cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION: "异常",
|
||||
}
|
||||
|
||||
var PlatformIDMM = map[int]string{
|
||||
1: "TIKTOK",
|
||||
2: "YouTube",
|
||||
3: "Ins",
|
||||
4: "DM",
|
||||
}
|
||||
|
||||
var WorkStatusMM = map[int]string{
|
||||
1: "草稿",
|
||||
2: "审核中",
|
||||
|
||||
@ -24,6 +24,7 @@ func MediaRouter(r *gin.RouterGroup) {
|
||||
media.POST("artist-info", serviceCast.ArtistInfo)
|
||||
media.POST("sync-as-profile", serviceCast.SyncAsProfile)
|
||||
media.POST("import-media-account", serviceCast.ImportMediaAccount)
|
||||
media.POST("unbind-auth", serviceCast.UnbindAuth)
|
||||
}
|
||||
mediaNoLogin := r.Group("media")
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"fonchain-fiee/cmd/config"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@ -16,7 +17,7 @@ func UserAccounts(ctx *gin.Context) {
|
||||
userInfo := login.GetUserInfoFromC(ctx)
|
||||
req.ArtistUuid = fmt.Sprint(userInfo.ID)
|
||||
} else {
|
||||
req.ArtistUuid = "61"
|
||||
req.ArtistUuid = "1234"
|
||||
}
|
||||
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
|
||||
@ -992,6 +992,14 @@ func processMediaMetricsTask(ctx context.Context, task mediaMetricsTask) *cast.M
|
||||
}
|
||||
socialResp, err := service.AyrshareProvider.GetSocialAnalytics(ctx, socialReq)
|
||||
if err != nil {
|
||||
// 传送账号错误,用来判断是不是被封了
|
||||
go func(task mediaMetricsTask) {
|
||||
_, _ = service.CastProvider.UpdateMediaAccStatus(ctx, &cast.UpdateMediaAccStatusReq{
|
||||
ArtistUuid: task.artistInfo.ArtistUuid,
|
||||
PlatformID: task.platformID,
|
||||
InfoResp: err.Error(),
|
||||
})
|
||||
}(task)
|
||||
// 构建失败记录
|
||||
return buildFailedMediaMetricsItem(task.artistInfo, task.dateCN, 3, "获取社交分析数据失败", task.platformID, mediaInfoResp.Info)
|
||||
}
|
||||
|
||||
@ -772,3 +772,48 @@ func updateMediaAccount(platformName string, platformId cast.PlatformIDENUM, sub
|
||||
//}
|
||||
return err
|
||||
}
|
||||
|
||||
func UnbindAuth(ctx *gin.Context) {
|
||||
var req *cast.OAuthAccountV2Req
|
||||
var err error
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
if err = req.Validate(); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
mediaResp, err := service.CastProvider.MediaUserList(ctx, &cast.MediaUserListReq{
|
||||
MediaUserID: req.MediaAccountUuid,
|
||||
Page: 1,
|
||||
PageSize: 1,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
if mediaResp == nil || len(mediaResp.Data) == 0 {
|
||||
service.Error(ctx, errors.New("未找到该账号"))
|
||||
return
|
||||
}
|
||||
asArtistResp, _err := service.CastProvider.GetArtist(context.Background(), &cast.GetArtistReq{
|
||||
ArtistUuid: fmt.Sprint(mediaResp.Data[0].ArtistUuid),
|
||||
})
|
||||
if _err != nil {
|
||||
service.Error(ctx, errors.New("未找到该艺人"))
|
||||
return
|
||||
}
|
||||
resp, err := service.AyrshareProvider.UnlinkSocialNetwork(context.Background(), &aryshare.UnlinkSocialNetworkRequest{
|
||||
Platform: modelCast.PlatformNameKv[mediaResp.Data[0].PlatformID],
|
||||
ProfileKey: asArtistResp.ArtistInfo.ProfileKey,
|
||||
})
|
||||
if err != nil {
|
||||
zap.L().Error("UnlinkSocialNetwork err", zap.Error(err))
|
||||
service.Error(ctx, errors.New("解除授权失败"))
|
||||
return
|
||||
}
|
||||
_ = SyncAsAuth(mediaResp.Data[0].ArtistUuid)
|
||||
service.Success(ctx, resp)
|
||||
return
|
||||
}
|
||||
|
||||
@ -17,13 +17,17 @@ import (
|
||||
func Test(ctx *gin.Context) {
|
||||
action := ctx.PostForm("action")
|
||||
if action == "" {
|
||||
workUuid := ctx.PostForm("workUuid")
|
||||
err := CheckImage(workUuid)
|
||||
profileKey := ctx.PostForm("profileKey")
|
||||
platformName := ctx.PostForm("platformName")
|
||||
resp, err := service.AyrshareProvider.GetSocialAnalytics(context.Background(), &aryshare.GetSocialAnalyticsRequest{
|
||||
ProfileKey: profileKey,
|
||||
Platforms: []string{platformName},
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
service.Success(ctx, nil)
|
||||
service.Success(ctx, resp)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -1497,6 +1497,7 @@ func ImportWorkBatch(ctx *gin.Context) {
|
||||
temp.ArtistName = subInfoResp.Name
|
||||
temp.ArtistPhone = subInfoResp.TelNum
|
||||
temp.ArtistPhoneAreaCode = subInfoResp.TelAreaCode
|
||||
temp.ArtistSubNum = subInfoResp.SubNum
|
||||
}
|
||||
if len(row) > 7 {
|
||||
temp.Title = utils.CleanString(row[7])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user