This commit is contained in:
zhangshican 2025-09-12 00:18:22 +08:00 committed by GitHub
commit 0861bdb1a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,9 +6,10 @@
package dict package dict
import ( import (
"github.com/gogf/gf/v2/util/gconv"
"hash/fnv" "hash/fnv"
"hotgo/internal/model" "hotgo/internal/model"
"github.com/gogf/gf/v2/util/gconv"
) )
// GenDefaultOption 生成默认表格回显样式 // GenDefaultOption 生成默认表格回显样式
@ -122,8 +123,8 @@ func GenHashOption(key interface{}, label string, extra ...any) *model.Option {
tag := "default" tag := "default"
if _, err := hash.Write(gconv.Bytes(label)); err == nil { if _, err := hash.Write(gconv.Bytes(label)); err == nil {
index := int(hash.Sum32()) % len(strings) index := uint32(hash.Sum32()) % uint32(len(strings))
if index < len(strings) { if index < uint32(len(strings)) {
tag = strings[index] tag = strings[index]
} }
} }