download.go 756 B

123456789101112131415161718192021222324
  1. package bizhi
  2. import orm "duoduo/database"
  3. type Download struct {
  4. ID int `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"` // 主键
  5. OpenID string `gorm:"column:open_id;type:varchar(255)" json:"openId"`
  6. BizhiID int `gorm:"column:bizhi_id;type:bigint(20)" json:"bizhiId"` // 壁纸id
  7. Url string `gorm:"column:url;type:varchar(255)" json:"url"` // 壁纸url
  8. CreateTime string `gorm:"column:create_time;type:datetime" json:"createTime"` // 创建时间
  9. }
  10. func (m *Download) TableName() string {
  11. return "download"
  12. }
  13. func (m *Download) Insert() error {
  14. result := orm.BzMysql.Table(m.TableName()).Create(&m)
  15. if result.Error != nil {
  16. err := result.Error
  17. return err
  18. }
  19. return nil
  20. }