package backend import ( "context" "kpt-calf-feed/config" "kpt-calf-feed/service/wechat" "kpt-calf-feed/store/kptstore" operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation" "gitee.com/xuyiping_admin/pkg/di" "go.uber.org/dig" ) var Module = di.Options(di.Provide(NewStore)) type Hub struct { dig.In OpsService KptService } type StoreEntry struct { dig.In Cfg *config.AppConfig DB *kptstore.DB HttpClient *wechat.ClientService } func NewStore(store StoreEntry) KptService { return &store } func NewStoreEntry(cfg *config.AppConfig, Db *kptstore.DB) *StoreEntry { return &StoreEntry{ Cfg: cfg, DB: Db, HttpClient: nil, } } //go:generate mockgen -destination mock/kptservice.go -package kptservicemock kpt-calf-feed/module/backend KptService type KptService interface { SystemService // 系统相关操作 } //go:generate mockgen -destination mock/SystemService.go -package kptservicemock kpt-calf-feed/module/backend SystemService type SystemService interface { // Auth 系统用户相关 Auth(ctx context.Context, auth *operationPb.UserAuthData) (*operationPb.SystemToken, error) GetCurrentUserName(ctx context.Context) (string, error) GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error) CreateSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error SearchSystemUserList(ctx context.Context, req *operationPb.SearchUserRequest) (*operationPb.SearchUserResponse, error) EditSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error DeleteSystemUser(ctx context.Context, userId int64) error ResetPasswordSystemUser(ctx context.Context, userId int64) error DetailsSystemUser(ctx context.Context, userId int64) (*operationPb.UserDetails, error) IsShowSystemUser(ctx context.Context, req *operationPb.IsShowSystemUserRequest) error GetSystemUserPermissions(ctx context.Context, token string) (*operationPb.SystemUserMenuPermissions, error) // CreateSystemRole 系统角色相关 CreateSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error EditSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error DeleteSystemRole(ctx context.Context, roleId int64) error GetRolePermissions(ctx context.Context, roleId int64) (*operationPb.RolePermissionsList, error) SearchSystemRoleList(ctx context.Context, req *operationPb.SearchRoleRequest) (*operationPb.SearchRoleResponse, error) // CreateSystemMenu 系统菜单权限 CreateSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error EditSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error IsShowSystemMenu(ctx context.Context, req *operationPb.IsShowSystemMenuRequest) error SearchSystemMenuList(ctx context.Context, req *operationPb.SearchMenuRequest) (*operationPb.SearchMenuResponse, error) DeleteSystemMenu(ctx context.Context, menuId int64) error }