Merge branch 'feature-four-daiyb' into dev

This commit is contained in:
戴育兵 2026-01-21 14:18:21 +08:00
commit 22de3d0ce9
6 changed files with 3014 additions and 5172 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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
}

View File

@ -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,

View File

@ -45,13 +45,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: "审核中",

View File

@ -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")
{

View File

@ -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
}