package backend import ( "context" "kpt-tmr-group/config" "kpt-tmr-group/pkg/di" operationPb "kpt-tmr-group/proto/go/backend/operation" "kpt-tmr-group/service/excel" "kpt-tmr-group/store/kptstore" "github.com/gin-gonic/gin" "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 //SSO *sso.Cache // AsynqClient asynqsvc.Client // Cache *redis.Client ExcelClient *excel.ExcelServer } func NewStore(store StoreEntry) KptService { return &store } type KptService interface { Operation SystemOperation } type Operation interface { // CreateGroupPasture 牧场管理相关 CreateGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error EditGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error SearchGroupPastureList(ctx context.Context, req *operationPb.SearchPastureRequest) (*operationPb.SearchPastureResponse, error) DeleteGroupPasture(ctx context.Context, pastureId int64) error ResetPasswordGroupPasture(ctx context.Context, req *operationPb.RestPasswordGroupPasture) error IsShowGroupPasture(ctx context.Context, req *operationPb.IsShowGroupPasture) error // ParentCattleCategoryList 牧畜类别 ParentCattleCategoryList(ctx context.Context) map[operationPb.CattleCategoryParent_Kind]string AddCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error EditCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error IsShowCattleCategory(ctx context.Context, req *operationPb.IsShowCattleCategory) error DeleteCattleCategory(ctx context.Context, cattleCategoryId int64) error SearchCattleCategoryList(ctx context.Context, req *operationPb.SearchCattleCategoryRequest) (*operationPb.SearchCattleCategoryResponse, error) // ParentForageCategoryList 饲料类别相关 ParentForageCategoryList(ctx context.Context) map[operationPb.ForageCategoryParent_Kind]string AddForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error EditForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error IsShowForageCategory(ctx context.Context, req *operationPb.IsShowForageCategory) error DeleteForageCategory(ctx context.Context, cattleCategoryId int64) error SearchForageCategoryList(ctx context.Context, req *operationPb.SearchForageCategoryRequest) (*operationPb.SearchForageCategoryResponse, error) // CreateForage 饲料相关 CreateForage(ctx context.Context, req *operationPb.AddForageRequest) error EditForage(ctx context.Context, req *operationPb.AddForageRequest) error SearchForageList(ctx context.Context, req *operationPb.SearchForageListRequest) (*operationPb.SearchForageListResponse, error) ForageEnumList(ctx context.Context) *ForageEnumList DeleteForageList(ctx context.Context, ids []int64) error IsShowForage(ctx context.Context, req *operationPb.IsShowForage) error ImportForage(ctx context.Context) error ExportForage(ctx *gin.Context, req *operationPb.SearchForageListRequest) error } type SystemOperation interface { // Auth 系统用户相关 Auth(ctx context.Context, auth *operationPb.UserAuthData) (*operationPb.SystemToken, 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 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 // SearchMobileList 移动端 SearchMobileList(ctx context.Context, req *operationPb.SearchMobileRequest) (*operationPb.SearchMobileResponse, error) }