feek_back.go 515 B

12345678910111213141516171819202122232425
  1. package user
  2. import (
  3. "eta/eta_mini_ht_api/models"
  4. "gorm.io/gorm"
  5. "time"
  6. )
  7. type FeedBack struct {
  8. Id int `gorm:" primaryKey;autoIncrement:'id'"`
  9. UserID int `gorm:"index"`
  10. Mobile string `gorm:"size:15"`
  11. Message string `gorm:"type:longtext"`
  12. CreatedTime time.Time
  13. }
  14. func InsertFeedBack(feedBack FeedBack) (err error) {
  15. db := models.Main()
  16. return db.Create(&feedBack).Error
  17. }
  18. func (fb *FeedBack) BeforeCreate(tx *gorm.DB) (err error) {
  19. fb.CreatedTime = time.Now()
  20. return
  21. }