From 9a2d597e2b03b73a0e527e5062d9326067d774dd Mon Sep 17 00:00:00 2001 From: zerosaturation Date: Sun, 12 Apr 2026 16:05:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E9=81=97=E7=95=99bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/pkg/proto/user/user.triple.go" | 670 ++++++++++++++++++ backend/deploy/envs/gateway.env | 2 +- backend/gateway/config/config.go | 2 +- .../gateway/controller/asset_controller.go | 22 + backend/pkg/proto/asset/asset.pb.go | 28 +- backend/pkg/proto/user/user.pb.go | 19 +- backend/proto/asset.proto | 1 + backend/proto/user.proto | 2 +- .../repository/asset_repository.go | 16 + frontend/pages/asset-detail/asset-detail.vue | 2 +- frontend/pages/castlove/create.vue | 8 +- frontend/pages/components/Header.vue | 61 +- frontend/pages/components/StarbookContent.vue | 4 +- frontend/pages/discover/generation-result.vue | 215 +++--- frontend/pages/exhibition/exhibition.vue | 2 +- frontend/pages/profile/profile.vue | 4 +- frontend/pages/support-activity/index.vue | 10 +- frontend/utils/assetImageHelper.js | 1 - mock/minimax.json | 9 + 19 files changed, 953 insertions(+), 125 deletions(-) create mode 100644 "backend\n/Users/liulujian/Documents/code/TopFansByGithub/backend/gateway\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/activityService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/assetService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/galleryService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/socialService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/userService/github.com/topfans/backend/pkg/proto/user/user.triple.go" create mode 100644 mock/minimax.json diff --git "a/backend\n/Users/liulujian/Documents/code/TopFansByGithub/backend/gateway\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/activityService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/assetService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/galleryService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/socialService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/userService/github.com/topfans/backend/pkg/proto/user/user.triple.go" "b/backend\n/Users/liulujian/Documents/code/TopFansByGithub/backend/gateway\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/activityService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/assetService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/galleryService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/socialService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/userService/github.com/topfans/backend/pkg/proto/user/user.triple.go" new file mode 100644 index 0000000..0dd48fb --- /dev/null +++ "b/backend\n/Users/liulujian/Documents/code/TopFansByGithub/backend/gateway\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/activityService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/assetService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/galleryService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/socialService\n/Users/liulujian/Documents/code/TopFansByGithub/backend/services/userService/github.com/topfans/backend/pkg/proto/user/user.triple.go" @@ -0,0 +1,670 @@ +// Code generated by protoc-gen-triple. DO NOT EDIT. +// +// Source: user.proto +package user + +import ( + "context" + +) + +import ( + "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/client" + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol" + "dubbo.apache.org/dubbo-go/v3/server" +) + +// This is a compile-time assertion to ensure that this generated file and the Triple package +// are compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of Triple newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of Triple or updating the Triple +// version compiled into your binary. +const _ = triple_protocol.IsAtLeastVersion0_1_0 + +const ( + // UserSocialServiceName is the fully-qualified name of the UserSocialService service. + UserSocialServiceName = "topfans.user.UserSocialService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // UserSocialServiceRegisterProcedure is the fully-qualified name of the UserSocialService's Register RPC. + UserSocialServiceRegisterProcedure = "/topfans.user.UserSocialService/Register" + // UserSocialServiceLoginProcedure is the fully-qualified name of the UserSocialService's Login RPC. + UserSocialServiceLoginProcedure = "/topfans.user.UserSocialService/Login" + // UserSocialServiceRefreshTokenProcedure is the fully-qualified name of the UserSocialService's RefreshToken RPC. + UserSocialServiceRefreshTokenProcedure = "/topfans.user.UserSocialService/RefreshToken" + // UserSocialServiceValidateTokenProcedure is the fully-qualified name of the UserSocialService's ValidateToken RPC. + UserSocialServiceValidateTokenProcedure = "/topfans.user.UserSocialService/ValidateToken" + // UserSocialServiceLogoutProcedure is the fully-qualified name of the UserSocialService's Logout RPC. + UserSocialServiceLogoutProcedure = "/topfans.user.UserSocialService/Logout" + // UserSocialServiceCheckNicknameProcedure is the fully-qualified name of the UserSocialService's CheckNickname RPC. + UserSocialServiceCheckNicknameProcedure = "/topfans.user.UserSocialService/CheckNickname" + // UserSocialServiceCheckMobileProcedure is the fully-qualified name of the UserSocialService's CheckMobile RPC. + UserSocialServiceCheckMobileProcedure = "/topfans.user.UserSocialService/CheckMobile" + // UserSocialServiceGetUserProcedure is the fully-qualified name of the UserSocialService's GetUser RPC. + UserSocialServiceGetUserProcedure = "/topfans.user.UserSocialService/GetUser" + // UserSocialServiceGetFanProfileProcedure is the fully-qualified name of the UserSocialService's GetFanProfile RPC. + UserSocialServiceGetFanProfileProcedure = "/topfans.user.UserSocialService/GetFanProfile" + // UserSocialServiceUpdateFanProfileSocialProcedure is the fully-qualified name of the UserSocialService's UpdateFanProfileSocial RPC. + UserSocialServiceUpdateFanProfileSocialProcedure = "/topfans.user.UserSocialService/UpdateFanProfileSocial" + // UserSocialServiceUpdateCrystalBalanceProcedure is the fully-qualified name of the UserSocialService's UpdateCrystalBalance RPC. + UserSocialServiceUpdateCrystalBalanceProcedure = "/topfans.user.UserSocialService/UpdateCrystalBalance" + // UserSocialServiceUpdateAssetsCountProcedure is the fully-qualified name of the UserSocialService's UpdateAssetsCount RPC. + UserSocialServiceUpdateAssetsCountProcedure = "/topfans.user.UserSocialService/UpdateAssetsCount" + // UserSocialServiceGetCurrentUserProcedure is the fully-qualified name of the UserSocialService's GetCurrentUser RPC. + UserSocialServiceGetCurrentUserProcedure = "/topfans.user.UserSocialService/GetCurrentUser" + // UserSocialServiceGetMyProfileProcedure is the fully-qualified name of the UserSocialService's GetMyProfile RPC. + UserSocialServiceGetMyProfileProcedure = "/topfans.user.UserSocialService/GetMyProfile" + // UserSocialServiceUpdateNicknameProcedure is the fully-qualified name of the UserSocialService's UpdateNickname RPC. + UserSocialServiceUpdateNicknameProcedure = "/topfans.user.UserSocialService/UpdateNickname" + // UserSocialServiceUpdatePasswordProcedure is the fully-qualified name of the UserSocialService's UpdatePassword RPC. + UserSocialServiceUpdatePasswordProcedure = "/topfans.user.UserSocialService/UpdatePassword" + // UserSocialServiceUpdateAvatarProcedure is the fully-qualified name of the UserSocialService's UpdateAvatar RPC. + UserSocialServiceUpdateAvatarProcedure = "/topfans.user.UserSocialService/UpdateAvatar" + // UserSocialServiceGetFanIdentitiesProcedure is the fully-qualified name of the UserSocialService's GetFanIdentities RPC. + UserSocialServiceGetFanIdentitiesProcedure = "/topfans.user.UserSocialService/GetFanIdentities" + // UserSocialServiceGetMyFanIdentitiesProcedure is the fully-qualified name of the UserSocialService's GetMyFanIdentities RPC. + UserSocialServiceGetMyFanIdentitiesProcedure = "/topfans.user.UserSocialService/GetMyFanIdentities" + // UserSocialServiceAddIdentityProcedure is the fully-qualified name of the UserSocialService's AddIdentity RPC. + UserSocialServiceAddIdentityProcedure = "/topfans.user.UserSocialService/AddIdentity" + // UserSocialServiceSwitchIdentityProcedure is the fully-qualified name of the UserSocialService's SwitchIdentity RPC. + UserSocialServiceSwitchIdentityProcedure = "/topfans.user.UserSocialService/SwitchIdentity" +) + +var ( + _ UserSocialService = (*UserSocialServiceImpl)(nil) + + +) + + +// UserSocialService is a client for the topfans.user.UserSocialService service. +type UserSocialService interface { + Register(ctx context.Context, req *RegisterRequest, opts ...client.CallOption) (*RegisterResponse, error) + Login(ctx context.Context, req *LoginRequest, opts ...client.CallOption) (*LoginResponse, error) + RefreshToken(ctx context.Context, req *RefreshTokenRequest, opts ...client.CallOption) (*RefreshTokenResponse, error) + ValidateToken(ctx context.Context, req *ValidateTokenRequest, opts ...client.CallOption) (*ValidateTokenResponse, error) + Logout(ctx context.Context, req *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error) + CheckNickname(ctx context.Context, req *CheckNicknameRequest, opts ...client.CallOption) (*CheckNicknameResponse, error) + CheckMobile(ctx context.Context, req *CheckMobileRequest, opts ...client.CallOption) (*CheckMobileResponse, error) + GetUser(ctx context.Context, req *GetUserRequest, opts ...client.CallOption) (*GetUserResponse, error) + GetFanProfile(ctx context.Context, req *GetFanProfileRequest, opts ...client.CallOption) (*GetFanProfileResponse, error) + UpdateFanProfileSocial(ctx context.Context, req *UpdateFanProfileSocialRequest, opts ...client.CallOption) (*UpdateFanProfileSocialResponse, error) + UpdateCrystalBalance(ctx context.Context, req *UpdateCrystalBalanceRequest, opts ...client.CallOption) (*UpdateCrystalBalanceResponse, error) + UpdateAssetsCount(ctx context.Context, req *UpdateAssetsCountRequest, opts ...client.CallOption) (*UpdateAssetsCountResponse, error) + GetCurrentUser(ctx context.Context, req *GetCurrentUserRequest, opts ...client.CallOption) (*GetCurrentUserResponse, error) + GetMyProfile(ctx context.Context, req *GetMyProfileRequest, opts ...client.CallOption) (*GetMyProfileResponse, error) + UpdateNickname(ctx context.Context, req *UpdateNicknameRequest, opts ...client.CallOption) (*UpdateNicknameResponse, error) + UpdatePassword(ctx context.Context, req *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error) + UpdateAvatar(ctx context.Context, req *UpdateAvatarRequest, opts ...client.CallOption) (*UpdateAvatarResponse, error) + GetFanIdentities(ctx context.Context, req *GetFanIdentitiesRequest, opts ...client.CallOption) (*GetFanIdentitiesResponse, error) + GetMyFanIdentities(ctx context.Context, req *GetMyFanIdentitiesRequest, opts ...client.CallOption) (*GetMyFanIdentitiesResponse, error) + AddIdentity(ctx context.Context, req *AddIdentityRequest, opts ...client.CallOption) (*AddIdentityResponse, error) + SwitchIdentity(ctx context.Context, req *SwitchIdentityRequest, opts ...client.CallOption) (*SwitchIdentityResponse, error) +} + +// NewUserSocialService constructs a client for the user.UserSocialService service. +func NewUserSocialService(cli *client.Client, opts ...client.ReferenceOption) (UserSocialService, error) { + conn, err := cli.DialWithInfo("topfans.user.UserSocialService", &UserSocialService_ClientInfo, opts...) + if err != nil { + return nil, err + } + return &UserSocialServiceImpl{ + conn: conn, + }, nil +} + +func SetConsumerUserSocialService(srv common.RPCService) { + dubbo.SetConsumerServiceWithInfo(srv,&UserSocialService_ClientInfo) +} + +// UserSocialServiceImpl implements UserSocialService. +type UserSocialServiceImpl struct { + conn *client.Connection +} + +func (c *UserSocialServiceImpl) Register(ctx context.Context, req *RegisterRequest, opts ...client.CallOption) (*RegisterResponse, error) { + resp := new(RegisterResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Register", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) Login(ctx context.Context, req *LoginRequest, opts ...client.CallOption) (*LoginResponse, error) { + resp := new(LoginResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Login", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) RefreshToken(ctx context.Context, req *RefreshTokenRequest, opts ...client.CallOption) (*RefreshTokenResponse, error) { + resp := new(RefreshTokenResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "RefreshToken", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) ValidateToken(ctx context.Context, req *ValidateTokenRequest, opts ...client.CallOption) (*ValidateTokenResponse, error) { + resp := new(ValidateTokenResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "ValidateToken", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) Logout(ctx context.Context, req *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error) { + resp := new(LogoutResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Logout", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) CheckNickname(ctx context.Context, req *CheckNicknameRequest, opts ...client.CallOption) (*CheckNicknameResponse, error) { + resp := new(CheckNicknameResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "CheckNickname", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) CheckMobile(ctx context.Context, req *CheckMobileRequest, opts ...client.CallOption) (*CheckMobileResponse, error) { + resp := new(CheckMobileResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "CheckMobile", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) GetUser(ctx context.Context, req *GetUserRequest, opts ...client.CallOption) (*GetUserResponse, error) { + resp := new(GetUserResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetUser", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) GetFanProfile(ctx context.Context, req *GetFanProfileRequest, opts ...client.CallOption) (*GetFanProfileResponse, error) { + resp := new(GetFanProfileResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetFanProfile", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) UpdateFanProfileSocial(ctx context.Context, req *UpdateFanProfileSocialRequest, opts ...client.CallOption) (*UpdateFanProfileSocialResponse, error) { + resp := new(UpdateFanProfileSocialResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateFanProfileSocial", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) UpdateCrystalBalance(ctx context.Context, req *UpdateCrystalBalanceRequest, opts ...client.CallOption) (*UpdateCrystalBalanceResponse, error) { + resp := new(UpdateCrystalBalanceResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateCrystalBalance", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) UpdateAssetsCount(ctx context.Context, req *UpdateAssetsCountRequest, opts ...client.CallOption) (*UpdateAssetsCountResponse, error) { + resp := new(UpdateAssetsCountResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateAssetsCount", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) GetCurrentUser(ctx context.Context, req *GetCurrentUserRequest, opts ...client.CallOption) (*GetCurrentUserResponse, error) { + resp := new(GetCurrentUserResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetCurrentUser", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) GetMyProfile(ctx context.Context, req *GetMyProfileRequest, opts ...client.CallOption) (*GetMyProfileResponse, error) { + resp := new(GetMyProfileResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetMyProfile", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) UpdateNickname(ctx context.Context, req *UpdateNicknameRequest, opts ...client.CallOption) (*UpdateNicknameResponse, error) { + resp := new(UpdateNicknameResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateNickname", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) UpdatePassword(ctx context.Context, req *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error) { + resp := new(UpdatePasswordResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdatePassword", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) UpdateAvatar(ctx context.Context, req *UpdateAvatarRequest, opts ...client.CallOption) (*UpdateAvatarResponse, error) { + resp := new(UpdateAvatarResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateAvatar", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) GetFanIdentities(ctx context.Context, req *GetFanIdentitiesRequest, opts ...client.CallOption) (*GetFanIdentitiesResponse, error) { + resp := new(GetFanIdentitiesResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetFanIdentities", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) GetMyFanIdentities(ctx context.Context, req *GetMyFanIdentitiesRequest, opts ...client.CallOption) (*GetMyFanIdentitiesResponse, error) { + resp := new(GetMyFanIdentitiesResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetMyFanIdentities", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) AddIdentity(ctx context.Context, req *AddIdentityRequest, opts ...client.CallOption) (*AddIdentityResponse, error) { + resp := new(AddIdentityResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "AddIdentity", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *UserSocialServiceImpl) SwitchIdentity(ctx context.Context, req *SwitchIdentityRequest, opts ...client.CallOption) (*SwitchIdentityResponse, error) { + resp := new(SwitchIdentityResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "SwitchIdentity", opts...); err != nil { + return nil, err + } + return resp, nil +} + + + + +var UserSocialService_ClientInfo = client.ClientInfo{ + InterfaceName: "topfans.user.UserSocialService", + MethodNames: []string{"Register","Login","RefreshToken","ValidateToken","Logout","CheckNickname","CheckMobile","GetUser","GetFanProfile","UpdateFanProfileSocial","UpdateCrystalBalance","UpdateAssetsCount","GetCurrentUser","GetMyProfile","UpdateNickname","UpdatePassword","UpdateAvatar","GetFanIdentities","GetMyFanIdentities","AddIdentity","SwitchIdentity"}, + ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) { + dubboCli := dubboCliRaw.(*UserSocialServiceImpl) + dubboCli.conn = conn + }, +} + +// UserSocialServiceHandler is an implementation of the topfans.user.UserSocialService service. +type UserSocialServiceHandler interface { + Register(context.Context, *RegisterRequest) (*RegisterResponse, error) + Login(context.Context, *LoginRequest) (*LoginResponse, error) + RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error) + ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error) + Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) + CheckNickname(context.Context, *CheckNicknameRequest) (*CheckNicknameResponse, error) + CheckMobile(context.Context, *CheckMobileRequest) (*CheckMobileResponse, error) + GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) + GetFanProfile(context.Context, *GetFanProfileRequest) (*GetFanProfileResponse, error) + UpdateFanProfileSocial(context.Context, *UpdateFanProfileSocialRequest) (*UpdateFanProfileSocialResponse, error) + UpdateCrystalBalance(context.Context, *UpdateCrystalBalanceRequest) (*UpdateCrystalBalanceResponse, error) + UpdateAssetsCount(context.Context, *UpdateAssetsCountRequest) (*UpdateAssetsCountResponse, error) + GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) + GetMyProfile(context.Context, *GetMyProfileRequest) (*GetMyProfileResponse, error) + UpdateNickname(context.Context, *UpdateNicknameRequest) (*UpdateNicknameResponse, error) + UpdatePassword(context.Context, *UpdatePasswordRequest) (*UpdatePasswordResponse, error) + UpdateAvatar(context.Context, *UpdateAvatarRequest) (*UpdateAvatarResponse, error) + GetFanIdentities(context.Context, *GetFanIdentitiesRequest) (*GetFanIdentitiesResponse, error) + GetMyFanIdentities(context.Context, *GetMyFanIdentitiesRequest) (*GetMyFanIdentitiesResponse, error) + AddIdentity(context.Context, *AddIdentityRequest) (*AddIdentityResponse, error) + SwitchIdentity(context.Context, *SwitchIdentityRequest) (*SwitchIdentityResponse, error) +} + +func RegisterUserSocialServiceHandler(srv *server.Server, hdlr UserSocialServiceHandler, opts ...server.ServiceOption) error { + return srv.Register(hdlr, &UserSocialService_ServiceInfo, opts...) +} + +func SetProviderUserSocialService(srv common.RPCService) { + dubbo.SetProviderServiceWithInfo(srv,&UserSocialService_ServiceInfo) +} + + +var UserSocialService_ServiceInfo = server.ServiceInfo{ + InterfaceName: "topfans.user.UserSocialService", + ServiceType: (*UserSocialServiceHandler)(nil), + Methods: []server.MethodInfo{ + { + Name: "Register", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(RegisterRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*RegisterRequest) + res, err := handler.(UserSocialServiceHandler).Register(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "Login", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(LoginRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*LoginRequest) + res, err := handler.(UserSocialServiceHandler).Login(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "RefreshToken", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(RefreshTokenRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*RefreshTokenRequest) + res, err := handler.(UserSocialServiceHandler).RefreshToken(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "ValidateToken", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(ValidateTokenRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*ValidateTokenRequest) + res, err := handler.(UserSocialServiceHandler).ValidateToken(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "Logout", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(LogoutRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*LogoutRequest) + res, err := handler.(UserSocialServiceHandler).Logout(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "CheckNickname", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(CheckNicknameRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*CheckNicknameRequest) + res, err := handler.(UserSocialServiceHandler).CheckNickname(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "CheckMobile", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(CheckMobileRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*CheckMobileRequest) + res, err := handler.(UserSocialServiceHandler).CheckMobile(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetUser", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetUserRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetUserRequest) + res, err := handler.(UserSocialServiceHandler).GetUser(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetFanProfile", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetFanProfileRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetFanProfileRequest) + res, err := handler.(UserSocialServiceHandler).GetFanProfile(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "UpdateFanProfileSocial", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(UpdateFanProfileSocialRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*UpdateFanProfileSocialRequest) + res, err := handler.(UserSocialServiceHandler).UpdateFanProfileSocial(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "UpdateCrystalBalance", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(UpdateCrystalBalanceRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*UpdateCrystalBalanceRequest) + res, err := handler.(UserSocialServiceHandler).UpdateCrystalBalance(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "UpdateAssetsCount", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(UpdateAssetsCountRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*UpdateAssetsCountRequest) + res, err := handler.(UserSocialServiceHandler).UpdateAssetsCount(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetCurrentUser", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetCurrentUserRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetCurrentUserRequest) + res, err := handler.(UserSocialServiceHandler).GetCurrentUser(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetMyProfile", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetMyProfileRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetMyProfileRequest) + res, err := handler.(UserSocialServiceHandler).GetMyProfile(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "UpdateNickname", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(UpdateNicknameRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*UpdateNicknameRequest) + res, err := handler.(UserSocialServiceHandler).UpdateNickname(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "UpdatePassword", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(UpdatePasswordRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*UpdatePasswordRequest) + res, err := handler.(UserSocialServiceHandler).UpdatePassword(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "UpdateAvatar", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(UpdateAvatarRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*UpdateAvatarRequest) + res, err := handler.(UserSocialServiceHandler).UpdateAvatar(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetFanIdentities", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetFanIdentitiesRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetFanIdentitiesRequest) + res, err := handler.(UserSocialServiceHandler).GetFanIdentities(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetMyFanIdentities", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetMyFanIdentitiesRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetMyFanIdentitiesRequest) + res, err := handler.(UserSocialServiceHandler).GetMyFanIdentities(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "AddIdentity", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(AddIdentityRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*AddIdentityRequest) + res, err := handler.(UserSocialServiceHandler).AddIdentity(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "SwitchIdentity", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(SwitchIdentityRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*SwitchIdentityRequest) + res, err := handler.(UserSocialServiceHandler).SwitchIdentity(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + }, +} diff --git a/backend/deploy/envs/gateway.env b/backend/deploy/envs/gateway.env index 71821cc..d86c38b 100644 --- a/backend/deploy/envs/gateway.env +++ b/backend/deploy/envs/gateway.env @@ -2,7 +2,7 @@ # 多机部署时将此文件放到 gateway 服务器的 /etc/topfans/gateway.env # Gin 运行模式: debug, release -GIN_MODE=release +GIN_MODE=debug # API 网关监听端口 SERVER_PORT=8080 diff --git a/backend/gateway/config/config.go b/backend/gateway/config/config.go index 00a8c0b..bc0a2ea 100644 --- a/backend/gateway/config/config.go +++ b/backend/gateway/config/config.go @@ -25,7 +25,7 @@ type DubboConfig struct { UserServiceURL string SocialServiceURL string AssetServiceURL string - GalleryServiceURL string + GalleryServiceURL string ActivityServiceURL string } diff --git a/backend/gateway/controller/asset_controller.go b/backend/gateway/controller/asset_controller.go index 647ffdc..b080fef 100644 --- a/backend/gateway/controller/asset_controller.go +++ b/backend/gateway/controller/asset_controller.go @@ -12,6 +12,7 @@ import ( "io" "net/http" "net/url" + "os" "path/filepath" "strconv" "strings" @@ -1428,12 +1429,33 @@ func (ctrl *AssetController) ImageGeneration(c *gin.Context) { return } + // 开发模式下使用 mock 数据 + if config.Load().Server.Mode == "debug" { + mockData, err := os.ReadFile("/Users/liulujian/Documents/code/TopFansByGithub/mock/minimax.json") + if err != nil { + response.Error(c, 500, "Failed to read mock data: "+err.Error()) + return + } + var mockResult map[string]interface{} + if err := json.Unmarshal(mockData, &mockResult); err != nil { + response.Error(c, 500, "Failed to parse mock data: "+err.Error()) + return + } + response.Success(c, mockResult) + return + } + result, err := ctrl.minimaxService.GenerateImage(c.Request.Context(), &req) if err != nil { response.Error(c, 500, "Image generation failed: "+err.Error()) return } + // 将输入图片追加到图片数组末尾 + if len(req.SubjectReference) > 0 && req.SubjectReference[0].ImageFile != "" { + result.Images = append(result.Images, req.SubjectReference[0].ImageFile) + } + response.Success(c, gin.H{ "images": result.Images, }) diff --git a/backend/pkg/proto/asset/asset.pb.go b/backend/pkg/proto/asset/asset.pb.go index cfeaca7..8e15344 100644 --- a/backend/pkg/proto/asset/asset.pb.go +++ b/backend/pkg/proto/asset/asset.pb.go @@ -47,7 +47,7 @@ type Asset struct { Owner *OwnerInfo `protobuf:"bytes,18,opt,name=owner,proto3" json:"owner,omitempty"` // 持有者信息(保留用于兼容性) OwnerNickname string `protobuf:"bytes,19,opt,name=owner_nickname,json=ownerNickname,proto3" json:"owner_nickname,omitempty"` // 持有者昵称(在该star下的昵称) IsLiked bool `protobuf:"varint,20,opt,name=is_liked,json=isLiked,proto3" json:"is_liked,omitempty"` // 当前用户是否已点赞 - Info string `protobuf:"bytes,21,opt,name=info,proto3" json:"info,omitempty"` // 藏品信息 + Info string `protobuf:"bytes,21,opt,name=info,proto3" json:"info,omitempty"` // 藏品信息 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -309,6 +309,7 @@ type MintOrder struct { CreatedAt int64 `protobuf:"varint,14,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间(毫秒时间戳) UpdatedAt int64 `protobuf:"varint,15,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // 更新时间(毫秒时间戳) MintedAt int64 `protobuf:"varint,16,opt,name=minted_at,json=mintedAt,proto3" json:"minted_at,omitempty"` // 上链成功时间(毫秒时间戳,可选) + Info string `protobuf:"bytes,17,opt,name=info,proto3" json:"info,omitempty"` // 藏品信息(必填) unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -455,6 +456,13 @@ func (x *MintOrder) GetMintedAt() int64 { return 0 } +func (x *MintOrder) GetInfo() string { + if x != nil { + return x.Info + } + return "" +} + // 阶段一:初始化铸造订单(仅生成并落库 order_id,status=PENDING) type InitMintOrderRequest struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -562,7 +570,7 @@ type CreateMintOrderRequest struct { Rarity int32 `protobuf:"varint,5,opt,name=rarity,proto3" json:"rarity,omitempty"` // 稀有度(可选) Tags []string `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"` // 标签列表(可选) MaterialType string `protobuf:"bytes,7,opt,name=material_type,json=materialType,proto3" json:"material_type,omitempty"` // 素材类型(可选) - Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` // 藏品信息(必填) + Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` // 藏品信息(必填) unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2294,7 +2302,7 @@ var File_asset_proto protoreflect.FileDescriptor const file_asset_proto_rawDesc = "" + "\n" + - "\vasset.proto\x12\rtopfans.asset\x1a\x12proto/common.proto\x1a\x1cgoogle/api/annotations.proto\"\xda\x04\n" + + "\vasset.proto\x12\rtopfans.asset\x1a\x12proto/common.proto\x1a\x1cgoogle/api/annotations.proto\"\xee\x04\n" + "\x05Asset\x12\x19\n" + "\basset_id\x18\x01 \x01(\x03R\aassetId\x12\x1b\n" + "\towner_uid\x18\x02 \x01(\x03R\bownerUid\x12\x17\n" + @@ -2321,11 +2329,12 @@ const file_asset_proto_rawDesc = "" + "\tminted_at\x18\x11 \x01(\x03R\bmintedAt\x12.\n" + "\x05owner\x18\x12 \x01(\v2\x18.topfans.asset.OwnerInfoR\x05owner\x12%\n" + "\x0eowner_nickname\x18\x13 \x01(\tR\rownerNickname\x12\x19\n" + - "\bis_liked\x18\x14 \x01(\bR\aisLiked\"X\n" + + "\bis_liked\x18\x14 \x01(\bR\aisLiked\x12\x12\n" + + "\x04info\x18\x15 \x01(\tR\x04info\"X\n" + "\tOwnerInfo\x12\x17\n" + "\auser_id\x18\x01 \x01(\x03R\x06userId\x12\x1a\n" + "\bnickname\x18\x02 \x01(\tR\bnickname\x12\x16\n" + - "\x06avatar\x18\x03 \x01(\tR\x06avatar\"\xe3\x03\n" + + "\x06avatar\x18\x03 \x01(\tR\x06avatar\"\xf7\x03\n" + "\tMintOrder\x12\x19\n" + "\border_id\x18\x01 \x01(\tR\aorderId\x12\x17\n" + "\auser_id\x18\x02 \x01(\x03R\x06userId\x12\x19\n" + @@ -2346,12 +2355,13 @@ const file_asset_proto_rawDesc = "" + "created_at\x18\x0e \x01(\x03R\tcreatedAt\x12\x1d\n" + "\n" + "updated_at\x18\x0f \x01(\x03R\tupdatedAt\x12\x1b\n" + - "\tminted_at\x18\x10 \x01(\x03R\bmintedAt\"1\n" + + "\tminted_at\x18\x10 \x01(\x03R\bmintedAt\x12\x12\n" + + "\x04info\x18\x11 \x01(\tR\x04info\"1\n" + "\x14InitMintOrderRequest\x12\x19\n" + "\border_id\x18\x01 \x01(\tR\aorderId\"y\n" + "\x15InitMintOrderResponse\x120\n" + "\x04base\x18\x01 \x01(\v2\x1c.topfans.common.BaseResponseR\x04base\x12.\n" + - "\x05order\x18\x02 \x01(\v2\x18.topfans.asset.MintOrderR\x05order\"\xf3\x01\n" + + "\x05order\x18\x02 \x01(\v2\x18.topfans.asset.MintOrderR\x05order\"\xf1\x01\n" + "\x16CreateMintOrderRequest\x12\x19\n" + "\border_id\x18\x02 \x01(\tR\aorderId\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12!\n" + @@ -2359,8 +2369,8 @@ const file_asset_proto_rawDesc = "" + "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + "\x06rarity\x18\x05 \x01(\x05R\x06rarity\x12\x12\n" + "\x04tags\x18\x06 \x03(\tR\x04tags\x12#\n" + - "\rmaterial_type\x18\a \x01(\tR\fmaterialType\x12\x14\n" + - "\x05event\x18\b \x01(\tR\x05event\"\xaf\x01\n" + + "\rmaterial_type\x18\a \x01(\tR\fmaterialType\x12\x12\n" + + "\x04info\x18\b \x01(\tR\x04info\"\xaf\x01\n" + "\x19PreCreateMintOrderRequest\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12!\n" + "\fmaterial_url\x18\x02 \x01(\tR\vmaterialUrl\x12 \n" + diff --git a/backend/pkg/proto/user/user.pb.go b/backend/pkg/proto/user/user.pb.go index 5257f11..bbc3d67 100644 --- a/backend/pkg/proto/user/user.pb.go +++ b/backend/pkg/proto/user/user.pb.go @@ -539,9 +539,9 @@ func (x *RegisterResponse) GetFanProfile() *FanProfile { // 登录请求 type LoginRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - Mobile string `protobuf:"bytes,1,opt,name=mobile,proto3" json:"mobile,omitempty"` // 手机号 - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // 密码 - StarId *int64 `protobuf:"varint,3,opt,name=star_id,json=starId,proto3,oneof" json:"star_id,omitempty"` // 可选:指定登录的明星ID,不指定则使用最早创建的粉丝档案 + Mobile string `protobuf:"bytes,1,opt,name=mobile,proto3" json:"mobile,omitempty"` // 手机号 + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // 密码 + StarId int64 `protobuf:"varint,3,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` // 可选:指定登录的明星ID,不指定则使用最早创建的粉丝档案 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -591,8 +591,8 @@ func (x *LoginRequest) GetPassword() string { } func (x *LoginRequest) GetStarId() int64 { - if x != nil && x.StarId != nil { - return *x.StarId + if x != nil { + return x.StarId } return 0 } @@ -2765,13 +2765,11 @@ const file_user_proto_rawDesc = "" + "expires_in\x18\x03 \x01(\x03R\texpiresIn\x12&\n" + "\x04user\x18\x04 \x01(\v2\x12.topfans.user.UserR\x04user\x129\n" + "\vfan_profile\x18\x05 \x01(\v2\x18.topfans.user.FanProfileR\n" + - "fanProfile\"l\n" + + "fanProfile\"[\n" + "\fLoginRequest\x12\x16\n" + "\x06mobile\x18\x01 \x01(\tR\x06mobile\x12\x1a\n" + - "\bpassword\x18\x02 \x01(\tR\bpassword\x12\x1c\n" + - "\astar_id\x18\x03 \x01(\x03H\x00R\x06starId\x88\x01\x01B\n" + - "\n" + - "\b_star_id\"\xa3\x02\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\x12\x17\n" + + "\astar_id\x18\x03 \x01(\x03R\x06starId\"\xa3\x02\n" + "\rLoginResponse\x120\n" + "\x04base\x18\x01 \x01(\v2\x1c.topfans.common.BaseResponseR\x04base\x12!\n" + "\faccess_token\x18\x02 \x01(\tR\vaccessToken\x12\x1d\n" + @@ -3086,7 +3084,6 @@ func file_user_proto_init() { if File_user_proto != nil { return } - file_user_proto_msgTypes[5].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/backend/proto/asset.proto b/backend/proto/asset.proto index 98aef80..e0838aa 100644 --- a/backend/proto/asset.proto +++ b/backend/proto/asset.proto @@ -61,6 +61,7 @@ message MintOrder { int64 created_at = 14; // 创建时间(毫秒时间戳) int64 updated_at = 15; // 更新时间(毫秒时间戳) int64 minted_at = 16; // 上链成功时间(毫秒时间戳,可选) + string info = 17; // 藏品信息(必填) } // ==================== 铸造相关消息 ==================== diff --git a/backend/proto/user.proto b/backend/proto/user.proto index c79b1aa..8e596bb 100644 --- a/backend/proto/user.proto +++ b/backend/proto/user.proto @@ -76,7 +76,7 @@ message RegisterResponse { message LoginRequest { string mobile = 1; // 手机号 string password = 2; // 密码 - optional int64 star_id = 3; // 可选:指定登录的明星ID,不指定则使用最早创建的粉丝档案 + int64 star_id = 3; // 可选:指定登录的明星ID,不指定则使用最早创建的粉丝档案 } // 登录响应 diff --git a/backend/services/assetService/repository/asset_repository.go b/backend/services/assetService/repository/asset_repository.go index 89261ef..d5ee9c6 100644 --- a/backend/services/assetService/repository/asset_repository.go +++ b/backend/services/assetService/repository/asset_repository.go @@ -4,6 +4,7 @@ import ( "errors" "time" + "github.com/sirupsen/logrus" appErrors "github.com/topfans/backend/pkg/errors" "github.com/topfans/backend/pkg/models" "gorm.io/gorm" @@ -117,6 +118,21 @@ func (r *assetRepository) GetByIDAndOwner(assetID, ownerUID, starID int64) (*mod return nil, err } + logrus.WithFields(logrus.Fields{ + "owner_uid": ownerUID, + "star_id": starID, + "asset_id": asset.ID, + "name": asset.Name, + "cover_url": asset.CoverURL, + "info": asset.Info, + "status": asset.Status, + "tx_hash": asset.TxHash, + "block_number": asset.BlockNumber, + "minted_at": asset.MintedAt, + "created_at": asset.CreatedAt, + "updated_at": asset.UpdatedAt, + }).Info("GetByIDAndOwner 查询结果") + return &asset, nil } diff --git a/frontend/pages/asset-detail/asset-detail.vue b/frontend/pages/asset-detail/asset-detail.vue index 6190061..f98a856 100644 --- a/frontend/pages/asset-detail/asset-detail.vue +++ b/frontend/pages/asset-detail/asset-detail.vue @@ -288,7 +288,7 @@ const handleLike = async () => { // 返回逻辑 const handleBack = () => { if (fromParam.value === 'castlove') { - uni.reLaunch({ url: '/pages/square/square?tab=1' }); + uni.reLaunch({ url: '/pages/castlove/mall' }); } else { uni.navigateBack(); } diff --git a/frontend/pages/castlove/create.vue b/frontend/pages/castlove/create.vue index 9dfae4f..71ce42d 100644 --- a/frontend/pages/castlove/create.vue +++ b/frontend/pages/castlove/create.vue @@ -8,9 +8,9 @@ - + @@ -705,9 +705,7 @@ onMounted(() => { font-weight: 700; font-family: 'ZaoZiGongFangJianHei-1', sans-serif; text-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.5); - background: linear-gradient(165deg, #F0E4B1 0%, #F08399 50%, #B94E73 90%, #834B9E 100%); - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; + background-clip: text; } diff --git a/frontend/pages/components/Header.vue b/frontend/pages/components/Header.vue index 242cc39..e0499c2 100644 --- a/frontend/pages/components/Header.vue +++ b/frontend/pages/components/Header.vue @@ -36,7 +36,7 @@ - + @@ -94,6 +94,7 @@ import { useStore } from 'vuex'; import Avatar from './Avatar.vue'; import TaskModal from './TaskModal.vue'; import GuideListModal from '@/components/GuideListModal.vue'; +import { getActivityListApi } from '@/utils/api.js'; // 定义 props const props = defineProps({ @@ -221,12 +222,68 @@ const handleBack = () => { } } }; - // 处理任务图标点击 const handleTaskClick = () => { showTaskModal.value = true; }; +// 处理星援活动图标点击 +const handleStarActivityClick = async () => { + try { + // 从本地存储获取star_id + const starId = uni.getStorageSync('star_id'); + if (!starId) { + uni.showToast({ + title: '无法获取用户信息', + icon: 'none' + }); + return; + } + + // 显示加载提示 + uni.showLoading({ + title: '加载中...' + }); + + // 调用API获取活动列表 + const response = await getActivityListApi(starId, 'active', 1, 10); + + uni.hideLoading(); + + // 检查响应数据 + if (response && response.data && response.data.activities) { + const activities = response.data.activities; + + // 查找activity_type为bus的活动 + const busActivity = activities.find(activity => activity.activity_type === 'bus'); + + if (busActivity) { + // 跳转到应援活动页面 + uni.navigateTo({ + url: `/pages/support-activity/index?id=${busActivity.id}` + }); + } else { + uni.showToast({ + title: '暂无巴士应援活动', + icon: 'none' + }); + } + } else { + uni.showToast({ + title: '获取活动列表失败', + icon: 'none' + }); + } + } catch (error) { + uni.hideLoading(); + console.error('获取活动列表失败:', error); + uni.showToast({ + title: error.message || '获取活动列表失败', + icon: 'none' + }); + } +}; + // 点击新手引导 const handleGuideClick = () => { showGuideListModal.value = true; diff --git a/frontend/pages/components/StarbookContent.vue b/frontend/pages/components/StarbookContent.vue index 68279b1..d3ae1cd 100644 --- a/frontend/pages/components/StarbookContent.vue +++ b/frontend/pages/components/StarbookContent.vue @@ -70,9 +70,9 @@ const cardCustomStyle = { // 添加NFT处理 - 跳转到铸爱页面 const handleAddNft = () => { - // 跳转到广场页面的铸爱 tab + // 跳转到铸爱商城页面 uni.navigateTo({ - url: '/pages/square/square?tab=2' + url: '/pages/castlove/mall' }); }; diff --git a/frontend/pages/discover/generation-result.vue b/frontend/pages/discover/generation-result.vue index 9845606..21a2f02 100644 --- a/frontend/pages/discover/generation-result.vue +++ b/frontend/pages/discover/generation-result.vue @@ -33,16 +33,16 @@ @click="selectCard(index)" > + + + - - - - - @@ -99,32 +99,77 @@ const getStarStyle = (index) => { }; }; -// 获取卡片样式 +// 获取卡片样式 - 金字塔布局(5张图) const getCardStyle = (index) => { - const positions = [ - { left: '8%', top: '18%', rotate: '-12deg', scale: 1 }, - { left: '52%', top: '15%', rotate: '8deg', scale: 0.92 }, - { left: '5%', top: '42%', rotate: '-6deg', scale: 0.95 }, - { left: '50%', top: '45%', rotate: '10deg', scale: 0.93 } + // 金字塔布局: + // 顶部:1张大卡片(居中,往下移)- z-index: 30 + // 中间:2张中等卡片(居中对称)- z-index: 20 + // 底部:2张小卡片(左右对称,边距更小)- z-index: 10 + // 使用rpx单位,屏幕宽度750rpx,卡片宽度200rpx + // 定义5个位置,对应图片0,1,2,3,4的初始位置 + const allPositions = [ + // 位置0(图片0):底部左 + { left: 40, top: 624, rotate: '-5deg', scale: 0.72, zIndex: 10 }, + // 位置1(图片1):中间左 + { left: 130, top: 580, rotate: '-8deg', scale: 0.82, zIndex: 20 }, + // 位置2(图片2):顶部中心 + { left: 275, top: 500, rotate: '0deg', scale: 1.15, zIndex: 30 }, + // 位置3(图片3):中间右 + { left: 420, top: 580, rotate: '8deg', scale: 0.82, zIndex: 20 }, + // 位置4(图片4):底部右 + { left: 510, top: 624, rotate: '5deg', scale: 0.72, zIndex: 10 } ]; - const pos = positions[index] || positions[0]; + // 计算当前图片应该在哪个位置 + let posIndex; + if (selectedIndex.value === -1) { + // 没有选中,图片index对应位置index + posIndex = index; + } else { + // 有选中的卡片,重新计算位置 + if (index === selectedIndex.value) { + // 选中的卡片移到位置2(顶部中心) + posIndex = 2; + } else { + // 其他卡片按顺序填充到 0,1,3,4 位置 + // 计算相对位置 + const relativePos = (index - selectedIndex.value + 5) % 5; + // 映射到实际位置(跳过位置2) + // relativePos: 1,2,3,4 对应位置: 3,4,0,1 + if (relativePos === 1) { + posIndex = 3; // 下一张 → 中间右 + } else if (relativePos === 2) { + posIndex = 4; // 下下张 → 底部右 + } else if (relativePos === 3) { + posIndex = 0; // 下下下张 → 底部左 + } else if (relativePos === 4) { + posIndex = 1; // 上一张 → 中间左 + } else { + // relativePos === 0,这是选中的卡片,不应该到这里 + console.error('逻辑错误:relativePos为0但不是选中的卡片'); + posIndex = 2; + } + } + } - // 如果是选中的卡片,添加高亮效果 + const pos = allPositions[posIndex]; + + // 如果是选中的卡片,放大1.5倍并设置最高层级 if (selectedIndex.value === index) { return { - left: pos.left, - top: pos.top, - transform: `rotate(${pos.rotate}) scale(${pos.scale * 1.05})`, - filter: 'brightness(1.2)', - zIndex: 100 + left: `${pos.left}rpx`, + top: `${pos.top}rpx`, + transform: `scale(${pos.scale * 1.15})!important`, + filter: 'brightness(1.15) drop-shadow(0 0 40rpx rgba(100, 200, 255, 0.9))', + zIndex: 100 // 选中时层级最高 }; } return { - left: pos.left, - top: pos.top, - transform: `rotate(${pos.rotate}) scale(${pos.scale})` + left: `${pos.left}rpx`, + top: `${pos.top}rpx`, + transform: `scale(${pos.scale})`, + zIndex: pos.zIndex }; }; @@ -133,11 +178,11 @@ const selectCard = (index) => { selectedIndex.value = index; // 可以添加选中效果 - uni.showToast({ - title: `已选择第${index + 1}张卡片`, - icon: 'none', - duration: 1000 - }); + // uni.showToast({ + // title: `已选择第${index + 1}张卡片`, + // icon: 'none', + // duration: 1000 + // }); }; // 将base64转换为Blob @@ -621,7 +666,8 @@ const selectAsset = async () => { material_url: imageUrl, rarity: 0, tags: [], - order_id: currentOrderId.value + order_id: currentOrderId.value, + info: orderValue.info || '' // 添加info字段 }; // 调用创建铸造订单API @@ -697,7 +743,7 @@ onMounted(() => {