voice_broadcast.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package yb
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hz_crm_api/utils"
  5. )
  6. type VoiceBroadcast struct {
  7. BroadcastId int `gorm:"primaryKey;column:broadcast_id;type:int(11)" description:"语音ID"`
  8. BroadcastName string `description:"语音名称"`
  9. SectionId int `description:"语音分类ID"`
  10. SectionName string `description:"语音分类名称"`
  11. VarietyId int `description:"品种id"`
  12. VarietyName string `description:"品种名称"`
  13. AuthorId int `description:"作者id"`
  14. Author string `description:"作者"`
  15. ImgUrl string `description:"背景图url"`
  16. VoiceUrl string `description:"音频url"`
  17. VoicePlaySeconds string `description:"音频时长"`
  18. VoiceSize string `description:"音频大小"`
  19. CreateTime string `description:"创建时间"`
  20. }
  21. // TableName get sql table name.获取数据库表名
  22. func (m *VoiceBroadcast) TableName() string {
  23. return "yb_voice_broadcast"
  24. }
  25. func UpdateVoiceBroadcast(sectionId int, imgUrl string) {
  26. var err error
  27. defer func() {
  28. if err != nil {
  29. utils.FileLog.Info("UpdateVoiceBroadcast err: ", err)
  30. }
  31. }()
  32. o := orm.NewOrm()
  33. sql := "UPDATE yb_voice_broadcast SET img_url=? WHERE section_id=? "
  34. _, err = o.Raw(sql, imgUrl, sectionId).Exec()
  35. return
  36. }