From 3addc12f456043425a80777119fd6c04b543ad6d Mon Sep 17 00:00:00 2001 From: ljw <84855512@qq.com> Date: Fri, 20 Sep 2024 20:46:32 +0800 Subject: [PATCH] bug fix --- http/controller/admin/tag.go | 2 +- http/request/admin/tag.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/http/controller/admin/tag.go b/http/controller/admin/tag.go index 305ef0b..7adb3df 100644 --- a/http/controller/admin/tag.go +++ b/http/controller/admin/tag.go @@ -65,7 +65,7 @@ func (ct *Tag) Create(c *gin.Context) { } t := f.ToTag() u := service.AllService.UserService.CurUser(c) - if !service.AllService.UserService.IsAdmin(u) { + if !service.AllService.UserService.IsAdmin(u) || t.UserId == 0 { t.UserId = u.Id } err := service.AllService.TagService.Create(t) diff --git a/http/request/admin/tag.go b/http/request/admin/tag.go index 3a07377..dc088c8 100644 --- a/http/request/admin/tag.go +++ b/http/request/admin/tag.go @@ -6,7 +6,7 @@ type TagForm struct { Id uint `json:"id"` Name string `json:"name" validate:"required"` Color uint `json:"color" validate:"required"` - UserId uint `json:"user_id" validate:"required"` + UserId uint `json:"user_id"` } func (f *TagForm) FromTag(group *model.Tag) *TagForm {