interface.go 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package backend
  2. import (
  3. "context"
  4. "kpt-pasture/config"
  5. "kpt-pasture/service/wechat"
  6. "kpt-pasture/store/kptstore"
  7. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  8. operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
  9. "gitee.com/xuyiping_admin/pkg/di"
  10. "go.uber.org/dig"
  11. )
  12. var Module = di.Options(di.Provide(NewStore))
  13. type Hub struct {
  14. dig.In
  15. OpsService KptService
  16. }
  17. type StoreEntry struct {
  18. dig.In
  19. Cfg *config.AppConfig
  20. DB *kptstore.DB
  21. HttpClient *wechat.ClientService
  22. }
  23. func NewStore(store StoreEntry) KptService {
  24. return &store
  25. }
  26. func NewStoreEntry(cfg *config.AppConfig, Db *kptstore.DB) *StoreEntry {
  27. return &StoreEntry{
  28. Cfg: cfg,
  29. DB: Db,
  30. HttpClient: nil,
  31. }
  32. }
  33. //go:generate mockgen -destination mock/kptservice.go -package kptservicemock kpt-pasture/module/backend KptService
  34. type KptService interface {
  35. SystemService // 系统相关操作
  36. }
  37. //go:generate mockgen -destination mock/SystemService.go -package kptservicemock kpt-pasture/module/backend SystemService
  38. type SystemService interface {
  39. // Login 系统用户相关
  40. Login(ctx context.Context, req *pasturePb.SearchUserRequest) (*pasturePb.SystemUserResponse, error)
  41. SearchSystemUserList(ctx context.Context, req *pasturePb.SearchUserRequest) (*pasturePb.SearchUserResponse, error)
  42. IsShowSystemUser(ctx context.Context, userId int64) error
  43. DeleteSystemUser(ctx context.Context, userId int64) error
  44. SystemUserCreateOrUpdate(ctx context.Context, req *pasturePb.SearchUserRequest) error
  45. ResetPasswordSystemUser(ctx context.Context, req *pasturePb.ResetUserPasswordRequest) error
  46. GetCurrentUserName(ctx context.Context) (string, error)
  47. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  48. DetailsSystemUser(ctx context.Context, userId int64) (*operationPb.UserDetails, error)
  49. GetSystemUserPermissions(ctx context.Context, token string) (*operationPb.SystemUserMenuPermissions, error)
  50. // SearchSystemRoleList 系统角色相关
  51. SearchSystemRoleList(ctx context.Context, req *pasturePb.SearchRoleRequest) (*pasturePb.SearchRoleResponse, error)
  52. DeleteSystemRole(ctx context.Context, roleId int64) error
  53. IsShowSystemRole(ctx context.Context, roleId int64) error
  54. SystemRoleCreateOrUpdate(ctx context.Context, req *pasturePb.SearchRoleRequest) error
  55. GetRolePermissions(ctx context.Context, roleId int64) (*operationPb.RolePermissionsList, error)
  56. // SearchSystemMenuList 系统菜单权限
  57. SearchSystemMenuList(ctx context.Context, req *pasturePb.SearchMenuRequest) (*pasturePb.SearchMenuResponse, error)
  58. DeleteSystemMenu(ctx context.Context, menuId int64) error
  59. CreateOrUpdateSystemMenu(ctx context.Context, req *pasturePb.SearchMenuRequest) error
  60. // SearchSystemDeptList 部门列表
  61. SearchSystemDeptList(ctx context.Context, req *pasturePb.SearchDeptRequest) (*pasturePb.SearchDeptResponse, error)
  62. SystemDepDelete(ctx context.Context, id int64) error
  63. SystemDeptCreateOrUpdate(ctx context.Context, req *pasturePb.SearchDeptRequest) error
  64. }