package user

import (
	"eta/eta_mini_ht_api/models"
	"gorm.io/gorm"
	"time"
)

type FeedBack struct {
	Id          int    `gorm:" primaryKey;autoIncrement:'id'"`
	UserID      int    `gorm:"index"`
	Mobile      string `gorm:"size:15"`
	Message     string `gorm:"type:longtext"`
	CreatedTime time.Time
}

func InsertFeedBack(feedBack FeedBack) (err error) {
	db := models.Main()
	return db.Create(&feedBack).Error
}

func (fb *FeedBack) BeforeCreate(tx *gorm.DB) (err error) {
	fb.CreatedTime = time.Now()
	return
}
