diff --git a/config/i18n.go b/config/i18n.go index a08ca3cab3f4b75cd6a9829b28ea8fc9a3fe0783..c50047f9665122eb6360f725d74f550c275b3950 100644 --- a/config/i18n.go +++ b/config/i18n.go @@ -59,6 +59,7 @@ var ( "Regexp %s matched, but cannot get substring()": "主正则 %s 匹配成功,但无法匹配到子串", "TagKey or TagValue contains illegal characters[:,/=\r\n\t]": "标签KEY或者标签值包含非法字符串[:,/=\r\n\t]", "Resource cannot delete in preset classpath": "预置分组不能删除资源", + "No such resource %s": "不存在该资源(%s)", } langDict = map[string]map[string]string{ "zh": dict, diff --git a/models/classpath_resource.go b/models/classpath_resource.go index 4d7d96c2f817aaa780bb89aed4944e55df9ab267..2fab973772008b199567d1afb2ce2f24547a7bed 100644 --- a/models/classpath_resource.go +++ b/models/classpath_resource.go @@ -56,6 +56,15 @@ func ClasspathResourceAdd(classpathId int64, resIdent string) error { return nil } + res, err := ResourceGet("ident=?", resIdent) + if err != nil { + return err + } + + if res == nil { + return _e("No such resource %s", resIdent) + } + obj := ClasspathResource{ ClasspathId: classpathId, ResIdent: resIdent,