modified deleteApp and createService judgment logic

This commit is contained in:
yangk 2020-09-19 21:30:25 +08:00
parent 1812db6690
commit 2694181922
2 changed files with 6 additions and 6 deletions

View File

@ -650,8 +650,12 @@ func (t *TenantStruct) CreateService(w http.ResponseWriter, r *http.Request) {
}
// Check if the application ID exists
if ss.AppID == "" {
httputil.ReturnError(r, w, 404, "create must set correct app_id ,can't find application")
return
}
_, err := handler.GetTenantApplicationHandler().GetAppByID(ss.AppID)
if err != nil || ss.AppID == "" {
if err != nil {
if err.Error() == gorm.ErrRecordNotFound.Error() {
httputil.ReturnError(r, w, 404, "create must set correct app_id ,can't find application")
return

View File

@ -77,9 +77,5 @@ func (a *TenantApplicationAction) GetAppByID(appID string) (*dbmodel.Application
// DeleteApp -
func (a *TenantApplicationAction) DeleteApp(appID string) error {
err := db.GetManager().TenantApplicationDao().DeleteApp(appID)
if err != nil {
return err
}
return nil
return db.GetManager().TenantApplicationDao().DeleteApp(appID)
}