mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
added wrong judgement
This commit is contained in:
parent
9641a41541
commit
1d71a5f40e
@ -11,14 +11,17 @@ import (
|
||||
// AddConfigGroup -
|
||||
func (a *ApplicationAction) AddConfigGroup(appID string, req *model.ApplicationConfigGroup) (*model.ApplicationConfigGroupResp, error) {
|
||||
var serviceResp []dbmodel.ServiceConfigGroup
|
||||
services, err := db.GetManager().TenantServiceDao().GetServicesByServiceIDs(req.ServiceIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Create application configGroup-services
|
||||
for _, sid := range req.ServiceIDs {
|
||||
services, _ := db.GetManager().TenantServiceDao().GetServiceByID(sid)
|
||||
for _, s := range services {
|
||||
serviceConfigGroup := dbmodel.ServiceConfigGroup{
|
||||
AppID: appID,
|
||||
ConfigGroupName: req.ConfigGroupName,
|
||||
ServiceID: sid,
|
||||
ServiceAlias: services.ServiceAlias,
|
||||
ServiceID: s.ServiceID,
|
||||
ServiceAlias: s.ServiceAlias,
|
||||
}
|
||||
serviceResp = append(serviceResp, serviceConfigGroup)
|
||||
if err := db.GetManager().AppConfigGroupServiceDao().AddModel(&serviceConfigGroup); err != nil {
|
||||
@ -57,7 +60,10 @@ func (a *ApplicationAction) AddConfigGroup(appID string, req *model.ApplicationC
|
||||
return nil, err
|
||||
}
|
||||
|
||||
appconfig, _ := db.GetManager().AppConfigGroupDao().GetConfigByID(appID, req.ConfigGroupName)
|
||||
appconfig, err := db.GetManager().AppConfigGroupDao().GetConfigByID(appID, req.ConfigGroupName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var resp *model.ApplicationConfigGroupResp
|
||||
resp = &model.ApplicationConfigGroupResp{
|
||||
CreateTime: appconfig.CreatedAt,
|
||||
|
@ -123,6 +123,7 @@ type TenantServiceDao interface {
|
||||
GetServicesInfoByAppID(appID string, page, pageSize int) ([]*model.TenantServices, int64, error)
|
||||
CountServiceByAppID(appID string) (int64, error)
|
||||
GetServiceIDsByAppID(appID string) (re []model.ServiceID)
|
||||
GetServicesByServiceIDs(serviceIDs []string) ([]*model.TenantServices, error)
|
||||
DeleteServiceByServiceID(serviceID string) error
|
||||
GetServiceMemoryByTenantIDs(tenantIDs, serviceIDs []string) (map[string]map[string]interface{}, error)
|
||||
GetServiceMemoryByServiceIDs(serviceIDs []string) (map[string]map[string]interface{}, error)
|
||||
|
@ -492,6 +492,18 @@ func (t *TenantServicesDaoImpl) GetServiceIDsByAppID(appID string) (re []model.S
|
||||
return
|
||||
}
|
||||
|
||||
//GetServicesByServiceIDs Get Services By ServiceIDs
|
||||
func (t *TenantServicesDaoImpl) GetServicesByServiceIDs(serviceIDs []string) ([]*model.TenantServices, error) {
|
||||
var services []*model.TenantServices
|
||||
if err := t.DB.Where("service_id in (?)", serviceIDs).Find(&services).Error; err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return services, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return services, nil
|
||||
}
|
||||
|
||||
//SetTenantServiceStatus SetTenantServiceStatus
|
||||
func (t *TenantServicesDaoImpl) SetTenantServiceStatus(serviceID, status string) error {
|
||||
var service model.TenantServices
|
||||
|
Loading…
Reference in New Issue
Block a user