修改模型、功能查找判断逻辑
This commit is contained in:
parent
eb67ddb45b
commit
63f81760ae
|
|
@ -199,11 +199,11 @@ func doReceiveGenChatMessage(userId int, sessionID *uint, data *proto.WSMessageR
|
||||||
var model dao.Model
|
var model dao.Model
|
||||||
//查看请求功能类型
|
//查看请求功能类型
|
||||||
models, funcs := service.FindFuncModelByFunction(data.Function, userId)
|
models, funcs := service.FindFuncModelByFunction(data.Function, userId)
|
||||||
log.Println("find function model by function:", models, funcs)
|
//log.Println("find function model by function:", models, funcs)
|
||||||
if funcs == nil || len(funcs) == 0 {
|
if len(funcs) == 0 {
|
||||||
return errors.New("function not exist")
|
return errors.New("function not exist")
|
||||||
}
|
}
|
||||||
if models == nil || len(models) == 0 {
|
if len(models) == 0 {
|
||||||
return errors.New("model not exist")
|
return errors.New("model not exist")
|
||||||
}
|
}
|
||||||
model = models[0]
|
model = models[0]
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ func FindFuncModelByFunction(function string, userID int) ([]dao.Model, []dao.Fu
|
||||||
//先查找对应功能
|
//先查找对应功能
|
||||||
funcModels := dao.FindFunctionModelByFunction(function)
|
funcModels := dao.FindFunctionModelByFunction(function)
|
||||||
if len(funcModels) == 0 {
|
if len(funcModels) == 0 {
|
||||||
return nil, nil
|
return []dao.Model{}, funcModels
|
||||||
}
|
}
|
||||||
modelID := funcModels[0].ModelID
|
modelID := funcModels[0].ModelID
|
||||||
//再查找对应模型
|
//再查找对应模型
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue