优化结构
This commit is contained in:
@@ -210,7 +210,7 @@ func (h *Dictionary) Details(c *gin.Context) {
|
||||
func (h *Dictionary) Tree(byType bool) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
rawID := c.Query("sysDictionaryID")
|
||||
id, parseErr := strconv.ParseUint(rawID, 10, 32)
|
||||
var id uint64
|
||||
typ := ""
|
||||
if byType {
|
||||
typ = c.Query("type")
|
||||
@@ -221,9 +221,13 @@ func (h *Dictionary) Tree(byType bool) gin.HandlerFunc {
|
||||
} else if rawID == "" {
|
||||
Fail(c, "字典ID不能为空")
|
||||
return
|
||||
} else if parseErr != nil {
|
||||
Fail(c, "字典ID格式错误")
|
||||
return
|
||||
} else {
|
||||
var parseErr error
|
||||
id, parseErr = strconv.ParseUint(rawID, 10, 32)
|
||||
if parseErr != nil {
|
||||
Fail(c, "字典ID格式错误")
|
||||
return
|
||||
}
|
||||
}
|
||||
items, err := h.service.DictionaryTree(c.Request.Context(), uint(id), typ)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user