package models import ( "kefu/types" ) type AigcSessionMessage struct { ID uint `gorm:"primary_key" json:"id"` EntId string `json:"ent_id"` KefuName string `json:"kefu_name"` Content string `json:"content"` KefuAvatar string `json:"kefu_avatar"` AiAvatar string `json:"ai_avatar"` MsgType string `json:"msg_type"` CollectId uint `json:"collect_id"` CreatedAt types.Time `json:"created_at"` } func (v *AigcSessionMessage) CreateAigcSessionMessage() *AigcSessionMessage { DB.Create(v) return v } func FindAigcSessionMessage(page, pagesize int, query interface{}, args ...interface{}) []AigcSessionMessage { offset := (page - 1) * pagesize var res []AigcSessionMessage DB.Table("aigc_session_message").Where(query, args...).Order("id asc").Offset(offset).Limit(pagesize).Find(&res) return res }