kefu/models/qrcodes.go

38 lines
799 B
Go

package models
import (
"kefu/types"
"time"
)
type Qrcode struct {
ID uint `gorm:"primary_key" json:"id"`
EntId string `json:"ent_id"`
Uuid string `json:"uuid"`
Url string `json:"url"`
KefuName string `json:"kefu_name"`
CreatedAt types.Time `json:"created_at"`
}
func CreateQrcode(EntId, Uuid, Url, KefuName string) Qrcode {
model := Qrcode{
EntId: EntId,
Uuid: Uuid,
Url: Url,
KefuName: KefuName,
CreatedAt: types.Time{
time.Now(),
},
}
DB.Create(&model)
return model
}
func DelQrcode(query interface{}, args ...interface{}) {
DB.Where(query, args...).Delete(&Qrcode{})
}
func FindQrcode(query interface{}, args ...interface{}) Qrcode {
var model Qrcode
DB.Where(query, args...).Find(&model)
return model
}