28 lines
649 B
Go
28 lines
649 B
Go
package impl
|
|
|
|
import (
|
|
"ai_scheduler/internal/data/model"
|
|
"ai_scheduler/tmpl/dataTemp"
|
|
"ai_scheduler/utils"
|
|
"database/sql"
|
|
)
|
|
|
|
type BotGroupImpl struct {
|
|
dataTemp.DataTemp
|
|
}
|
|
|
|
func NewBotGroupImpl(db *utils.Db) *BotGroupImpl {
|
|
return &BotGroupImpl{
|
|
DataTemp: *dataTemp.NewDataTemp(db, new(model.AiBotGroup)),
|
|
}
|
|
}
|
|
|
|
func (k BotGroupImpl) GetByConversationIdAndRobotCode(staffId string, robotCode string) (*model.AiBotGroup, error) {
|
|
var data model.AiBotGroup
|
|
err := k.Db.Model(k.Model).Where("conversation_id = ? and robot_code = ?", staffId, robotCode).Find(&data).Error
|
|
if data.GroupID == 0 {
|
|
err = sql.ErrNoRows
|
|
}
|
|
return &data, err
|
|
}
|