mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-09-17 08:46:39 +08:00
Merge 776307e65b
into 1688aaf371
This commit is contained in:
commit
0861bdb1a6
@ -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]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user