interface.go 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. SystemUserRole(ctx context.Context, userId int64) (*pasturePb.SystemUserRoleResponse, error)
  47. SystemUserRoleSave(ctx context.Context, req *pasturePb.SystemUserRoleRequest) error
  48. // GetSystemUserMenu 当前登录用户菜单权限
  49. GetSystemUserMenu(ctx context.Context) (*pasturePb.SystemUserMenuTreeResponse, error)
  50. GetCurrentUserName(ctx context.Context) (string, error)
  51. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  52. DetailsSystemUser(ctx context.Context, userId int64) (*operationPb.UserDetails, error)
  53. // SearchSystemRoleList 系统角色相关
  54. SearchSystemRoleList(ctx context.Context, req *pasturePb.SearchRoleRequest) (*pasturePb.SearchRoleResponse, error)
  55. DeleteSystemRole(ctx context.Context, roleId int64) error
  56. IsShowSystemRole(ctx context.Context, roleId int64) error
  57. SystemRoleCreateOrUpdate(ctx context.Context, req *pasturePb.SearchRoleRequest) error
  58. GetRoleMenuList(ctx context.Context, roleId int64) (*pasturePb.SystemRoleMenuResponse, error)
  59. RoleMenuSave(ctx context.Context, res *pasturePb.SystemRoleMenuRequest) error
  60. SystemRoleList(ctx context.Context) (*pasturePb.GetRoleListResponse, error)
  61. // SearchSystemMenuList 系统菜单权限
  62. SearchSystemMenuList(ctx context.Context, req *pasturePb.SearchMenuRequest) (*pasturePb.SearchMenuResponse, error)
  63. DeleteSystemMenu(ctx context.Context, menuId int64) error
  64. CreateOrUpdateSystemMenu(ctx context.Context, req *pasturePb.SearchMenuRequest) error
  65. SystemMenuTree(ctx context.Context) (*pasturePb.SystemMenuTreeResponse, error)
  66. // SearchSystemDeptList 部门列表
  67. SearchSystemDeptList(ctx context.Context, req *pasturePb.SearchDeptRequest) (*pasturePb.SearchDeptResponse, error)
  68. SystemDepDelete(ctx context.Context, id int64) error
  69. SystemDeptCreateOrUpdate(ctx context.Context, req *pasturePb.SearchDeptRequest) error
  70. }