This commit is contained in:
ljw
2024-09-20 20:46:32 +08:00
parent 1e3403e3c5
commit 3addc12f45
2 changed files with 2 additions and 2 deletions

View File

@@ -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)

View File

@@ -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 {