Merge branch 'feature-newApi-daiyb'

This commit is contained in:
戴育兵 2025-12-15 09:40:53 +08:00
commit 759e8384dd
3 changed files with 29 additions and 0 deletions

View File

@ -2,6 +2,10 @@ package cast
type BalanceTypeEnum int32 type BalanceTypeEnum int32
type SyncAsProfileReq struct {
ID uint64 `json:"id"`
}
// 定义枚举值 // 定义枚举值
const ( const (
BalanceTypeAccountValue BalanceTypeEnum = 1 BalanceTypeAccountValue BalanceTypeEnum = 1

View File

@ -22,6 +22,7 @@ func MediaRouter(r *gin.RouterGroup) {
media.POST("oauth-account", serviceCast.OAuthAccount) media.POST("oauth-account", serviceCast.OAuthAccount)
media.POST("refresh-token", serviceCast.RefreshToken) media.POST("refresh-token", serviceCast.RefreshToken)
media.POST("artist-info", serviceCast.ArtistInfo) media.POST("artist-info", serviceCast.ArtistInfo)
media.POST("sync-as-profile", serviceCast.SyncAsProfile)
} }
mediaNoLogin := r.Group("media") mediaNoLogin := r.Group("media")
{ {

View File

@ -464,3 +464,27 @@ func CheckAsProfile(infoResp *accountFiee.UserInfoResponse) error {
} }
return nil return nil
} }
func SyncAsProfile(ctx *gin.Context) {
var req *modelCast.SyncAsProfileReq
var err error
if err = ctx.ShouldBind(&req); err != nil {
service.Error(ctx, err)
return
}
infoResp, err := GetArtistAccountInfo(req.ID)
if err != nil {
service.Error(ctx, err)
return
}
if infoResp.SubNum == "" {
service.Error(ctx, errors.New("用户不存在"))
return
}
if err = CheckAsProfile(infoResp); err != nil {
service.Error(ctx, err)
return
}
service.Success(ctx, infoResp)
return
}