resource.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package models
  2. import (
  3. "eta_gn/eta_api/global"
  4. "time"
  5. )
  6. type Resource struct {
  7. Id int `gorm:"column:id;primaryKey;type:int" orm:"column(id);" description:"资源ID"`
  8. ResourceUrl string `gorm:"column:resource_url;type:varchar(255)" orm:"column(resource_url)" description:"资源地址"`
  9. CreateTime time.Time `gorm:"column:create_time;type:datetime" orm:"column(create_time)" description:"创建时间"`
  10. ResourceType int `gorm:"column:resource_type;type:int" orm:"column(resource_type)" description:"资源类型,1:图片,2:音频,3:视频,4:PPT"`
  11. }
  12. type ResourceResp struct {
  13. Id int64 `orm:"column(id);" description:"用户id"`
  14. ResourceUrl string `description:"资源地址"`
  15. PlaySeconds uint32 `description:"播放时长,单位秒"`
  16. Source string
  17. CacheKey string
  18. ResourceName string `description:"资源名称"`
  19. OpenaiFileId string `description:"openai返回的文件id"`
  20. AiChatTopicId int `description:"主题id"`
  21. }
  22. func AddResource(item *Resource) (newId int64, err error) {
  23. err = global.DmSQL["rddp"].Create(item).Error
  24. newId = int64(item.Id)
  25. return
  26. }
  27. type ResourceBase64Resp struct {
  28. Image string `description:"图片,base64字符串"`
  29. }
  30. type PptResourceResp struct {
  31. Id int64 `orm:"column(id);" description:"用户id"`
  32. ResourceUrl []string `description:"资源地址"`
  33. PlaySeconds uint32 `description:"播放时长,单位秒"`
  34. }
  35. type ImageSvgToPngResp struct {
  36. Data struct {
  37. ResourceURL string `json:"ResourceUrl"`
  38. } `json:"Data"`
  39. ErrCode string `json:"ErrCode"`
  40. ErrMsg string `json:"ErrMsg"`
  41. IsSendEmail bool `json:"IsSendEmail"`
  42. Msg string `json:"Msg"`
  43. Ret int64 `json:"Ret"`
  44. Success bool `json:"Success"`
  45. }