|
@@ -15,39 +15,49 @@ type AppService interface {
|
|
|
Create(d *datamodel.App) error
|
|
Create(d *datamodel.App) error
|
|
|
Update(d *datamodel.App) error
|
|
Update(d *datamodel.App) error
|
|
|
Delete(m map[string]interface{}) error
|
|
Delete(m map[string]interface{}) error
|
|
|
|
|
+ GetPermit(roleId int64, appKey string) ([]viewmodel.AppPermitInfo, error)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type appService struct {
|
|
type appService struct {
|
|
|
- repo *repository.AppRepo
|
|
|
|
|
|
|
+ appRepo *repository.AppRepo
|
|
|
|
|
+ appPermitRepo *repository.AppPermitRepo
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func NewAppService() AppService {
|
|
func NewAppService() AppService {
|
|
|
return &appService{
|
|
return &appService{
|
|
|
- repo: repository.NewAppRepo(datasource.InstanceMaster()),
|
|
|
|
|
|
|
+ appRepo: repository.NewAppRepo(datasource.InstanceMaster()),
|
|
|
|
|
+ appPermitRepo: repository.NewAppPermitRepo(datasource.InstanceMaster()),
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *appService) GetList(m map[string]interface{}) ([]viewmodel.AppInfo, error) {
|
|
func (s *appService) GetList(m map[string]interface{}) ([]viewmodel.AppInfo, error) {
|
|
|
- return s.repo.GetList(m)
|
|
|
|
|
|
|
+ return s.appRepo.GetList(m)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *appService) GetPage(m map[string]interface{}) (*base.PageResult, error) {
|
|
func (s *appService) GetPage(m map[string]interface{}) (*base.PageResult, error) {
|
|
|
- return s.repo.GetPage(m)
|
|
|
|
|
|
|
+ return s.appRepo.GetPage(m)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *appService) GetById(appId int64) (*viewmodel.AppInfo, error) {
|
|
func (s *appService) GetById(appId int64) (*viewmodel.AppInfo, error) {
|
|
|
- return s.repo.GetById(appId)
|
|
|
|
|
|
|
+ return s.appRepo.GetById(appId)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *appService) Create(App *datamodel.App) error {
|
|
func (s *appService) Create(App *datamodel.App) error {
|
|
|
App.AppId = NewID()
|
|
App.AppId = NewID()
|
|
|
- return s.repo.Create(App)
|
|
|
|
|
|
|
+ return s.appRepo.Create(App)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *appService) Update(App *datamodel.App) error {
|
|
func (s *appService) Update(App *datamodel.App) error {
|
|
|
- return s.repo.Update(App)
|
|
|
|
|
|
|
+ return s.appRepo.Update(App)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *appService) Delete(m map[string]interface{}) error {
|
|
func (s *appService) Delete(m map[string]interface{}) error {
|
|
|
- return s.repo.Delete(m)
|
|
|
|
|
|
|
+ return s.appRepo.Delete(m)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (s *appService) GetPermit(roleId int64, appKey string) ([]viewmodel.AppPermitInfo, error) {
|
|
|
|
|
+ m := make(map[string]interface{}, 0)
|
|
|
|
|
+ m["appKey"] = appKey
|
|
|
|
|
+ m["roleId"] = roleId
|
|
|
|
|
+ return s.appPermitRepo.GetList(m)
|
|
|
}
|
|
}
|