This commit is contained in:
孟帅
2024-04-22 23:08:40 +08:00
parent 82483bd7b9
commit e144b12580
445 changed files with 17457 additions and 6708 deletions

View File

@@ -9,6 +9,7 @@ import (
"context"
"errors"
"fmt"
"github.com/gogf/gf/v2/frame/g"
"hash/fnv"
"hotgo/internal/model"
"strconv"
@@ -40,6 +41,7 @@ func GetOptionsById(ctx context.Context, id int64) (opts []*model.Option, err er
}
for _, v := range GetAllFunc() {
g.Log().Warningf(ctx, "GetAllFunc GetOptionsById v:%v, %v", v.Id, v.Key)
if v.Id == id {
return LoadFuncOptions(ctx, v)
}
@@ -49,6 +51,24 @@ func GetOptionsById(ctx context.Context, id int64) (opts []*model.Option, err er
return
}
// GetTypeById 通过类型ID获取内置选项类型
func GetTypeById(ctx context.Context, id int64) (typ string, err error) {
for _, v := range GetAllEnums() {
if v.Id == id {
return v.Key, nil
}
}
for _, v := range GetAllFunc() {
if v.Id == id {
return v.Key, nil
}
}
err = NotExistKeyError
return
}
// GenIdHash 生成字典id
func GenIdHash(str string, t int64) int64 {
prefix := 10000 * t