refactor(util): 重构映射工具函数并优化异步任务轮询逻辑

This commit is contained in:
2026-06-03 13:30:39 +08:00
parent c11a9ad5c8
commit 3fa2896fc3
9 changed files with 80 additions and 75 deletions

View File

@@ -16,6 +16,7 @@ type modelDao struct{}
func (d *modelDao) Get(ctx context.Context, req *entity.AsynchModel, fields ...string) (m *entity.AsynchModel, err error) {
r, err := gfdb.DB(ctx, public.DbNameModelGateway).Model(ctx, public.TableNameModel).
OmitEmpty().
Where(entity.AsynchModelCol.Id, req.Id).
Where(entity.AsynchModelCol.Creator, req.Creator).
Where(entity.AsynchModelCol.IsChatModel, req.IsChatModel).
Where(entity.AsynchModelCol.ModelName, req.ModelName).
@@ -26,15 +27,3 @@ func (d *modelDao) Get(ctx context.Context, req *entity.AsynchModel, fields ...s
err = r.Struct(&m)
return
}
// GetsByModelName 批量获取模型
func (d *modelDao) GetsByModelName(ctx context.Context, creator string, modelNames []string, fields ...string) (list []*entity.AsynchModel, err error) {
err = gfdb.DB(ctx, public.DbNameModelGateway).Model(ctx, public.TableNameModel).
OmitEmpty().
Where(entity.AsynchModelCol.Creator, creator).
WhereIn(entity.AsynchModelCol.ModelName, modelNames).
Fields(fields).
Scan(&list)
return
}