214 lines
6.1 KiB
Go
214 lines
6.1 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type File struct {
|
|
ID string `json:"id"`
|
|
FileName string `json:"file_name"`
|
|
Extension string `json:"extension"`
|
|
FileType string `json:"file_type"`
|
|
}
|
|
|
|
type Widget struct {
|
|
ID int `db:"id"`
|
|
StreamerID int `db:"streamer_id"`
|
|
TemplateID int `db:"template_id"`
|
|
Duration int `db:"duration"`
|
|
MinAmount int `db:"min_amount"`
|
|
CreatedAt string `db:"created_at"`
|
|
UpdatedAt string `db:"updated_at"`
|
|
Files []File `db:"files"`
|
|
}
|
|
|
|
type Donat struct {
|
|
ID DonatID `db:"id"`
|
|
StreamerID StreamerID `db:"streamer_id"`
|
|
WidgetID WidgetID `db:"widget_id"`
|
|
OrderID OrderID `db:"order_id"`
|
|
TargetID TargetID `db:"target_id"`
|
|
|
|
Text string `db:"text"`
|
|
DonatUser string `db:"donat_user"`
|
|
Amount DonatAmount `db:"amount"`
|
|
|
|
Paid bool `db:"paid"`
|
|
View bool `db:"view"`
|
|
|
|
CreatedAt time.Time `db:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at"`
|
|
}
|
|
|
|
type Target struct {
|
|
ID TargetID `db:"id"`
|
|
StreamerID StreamerID `db:"streamer_id"`
|
|
|
|
Text string `db:"text"`
|
|
Collected DonatAmount `db:"collected"`
|
|
Amount DonatAmount `db:"amount"`
|
|
|
|
CreatedAt time.Time `db:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at"`
|
|
}
|
|
|
|
type DonatePage struct {
|
|
ID int `db:"id"`
|
|
StreamerID int `db:"streamer_id"`
|
|
Description string `db:"description"`
|
|
TextAfterDonat string `db:"text_after_donat"`
|
|
HeadImg string `db:"head_img"`
|
|
Avatar string `db:"avatar"`
|
|
BackgroundImg string `db:"background_img"`
|
|
StreamerLogin string `db:"streamer_login"`
|
|
}
|
|
|
|
type Moderation struct {
|
|
ID int `db:"id"`
|
|
StreamerID int `db:"streamer_id"`
|
|
Enable bool `db:"enable"`
|
|
Duration int `db:"duration"`
|
|
}
|
|
|
|
type InnerDonatePageResponse struct {
|
|
Description string `json:"description"`
|
|
TextAfterDonat string `json:"text_after_donat"`
|
|
HeadImg string `json:"head_img"`
|
|
Avatar string `json:"avatar"`
|
|
BackgroundImg string `json:"background_img"`
|
|
}
|
|
|
|
type OuterDonatePageResponse struct {
|
|
Login string `json:"login"`
|
|
OnLine string `json:"online"`
|
|
Description string `json:"description"`
|
|
BackgroundImg string `json:"background_img"`
|
|
AvatarImg string `json:"avatar_img"`
|
|
HeadImg string `json:"head_img"`
|
|
}
|
|
|
|
type Filter struct {
|
|
ID int `db:"id"`
|
|
StreamerID int `db:"streamer_id"`
|
|
EnableLinks bool `db:"enable_links"`
|
|
}
|
|
|
|
type FilterWord struct {
|
|
ID int `db:"id"`
|
|
DonatFilterID int `db:"donat_filter_id"`
|
|
Word string `db:"word"`
|
|
}
|
|
|
|
type VoiceSettings struct {
|
|
ID int `db:"id"`
|
|
StreamerID int `db:"streamer_id"`
|
|
VoiceSpeed int `db:"voice_speed"`
|
|
Scenery string `db:"scenery"`
|
|
VoiceSoundPercent int `db:"voice_sound_percent"`
|
|
MinPrice int `db:"min_price"`
|
|
}
|
|
|
|
type Language struct {
|
|
ID int `db:"id"`
|
|
IsoCode string `db:"iso_code"`
|
|
RuName string `db:"ru_name"`
|
|
EnName string `db:"en_name"`
|
|
}
|
|
|
|
type VoiceLanguage struct {
|
|
ID int `db:"id"`
|
|
VoiceSettingID int `db:"voice_setting_id"`
|
|
LanguageID int `db:"language_id"`
|
|
}
|
|
|
|
type UpdateDonatPage struct {
|
|
ProfileAvatar bool `json:"profile_avatar"`
|
|
Description string `json:"description"`
|
|
TextAfterDonat string `json:"text_after_donat"`
|
|
PageBackground string `json:"page_background"`
|
|
}
|
|
|
|
type VoiceSettingsResponse struct {
|
|
VoiceSpeed int `json:"voice_speed"`
|
|
Scenery string `json:"scenery"`
|
|
VoiceSoundPercent int `json:"voice_sound_percent"`
|
|
MinPrice int `json:"min_price"`
|
|
}
|
|
|
|
type UpdateVoiceSettings struct {
|
|
Enable bool `json:"enable"`
|
|
VoiceSpeed int `json:"voice_speed"`
|
|
Scenery string `json:"scenery"`
|
|
VoiceSoundPercent int `json:"voice_sound_percent"`
|
|
MinPrice int `json:"min_price"`
|
|
}
|
|
|
|
type FilterSettingResponse struct {
|
|
EnableLinks bool `json:"enable_links"`
|
|
FilteredWords []string `json:"filtered_words"`
|
|
}
|
|
|
|
type UpdateFilterSettings struct {
|
|
EnableLinks bool `json:"enable_links"`
|
|
AddWords []string `json:"add_words"`
|
|
RemoveWords []string `json:"remove_words"`
|
|
}
|
|
|
|
type ModerationResponse struct {
|
|
Enable bool `json:"enable"`
|
|
Duration int `json:"duration"`
|
|
}
|
|
|
|
type UpdateModeration struct {
|
|
Enable bool `json:"enable"`
|
|
Duration int `json:"duration"`
|
|
}
|
|
|
|
type CreateWidgetResponse struct {
|
|
WidgetID WidgetID `json:"widget_id"`
|
|
}
|
|
|
|
// CreateWidgetBody структура для создания виджета
|
|
type CreateWidgetBody struct {
|
|
TemplateID int `json:"template_id" validate:"required" example:"1"`
|
|
Duration int `json:"duration" validate:"required" example:"30"`
|
|
Name string `json:"name" validate:"required" example:"My Widget"`
|
|
Image string `json:"image" validate:"required" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440000"`
|
|
Audio string `json:"audio" validate:"required" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440001"`
|
|
MinAmount int `json:"min_amount" validate:"required" example:"10"`
|
|
MaxAmount int `json:"max_amount" validate:"required" example:"100"`
|
|
}
|
|
|
|
type DonatAndWidget struct {
|
|
Donat *Donat
|
|
Display Display
|
|
}
|
|
|
|
//func (widget *Widget) GetMediaUrl(mediaType MediaType) MediaUrl {
|
|
// var mediaUrl MediaUrl
|
|
// if mediaType == "background_url" {
|
|
// mediaUrl = widget.Background
|
|
// } else if mediaType == "image_url" {
|
|
// mediaUrl = widget.Image
|
|
// } else if mediaType == "audio_url" {
|
|
// mediaUrl = widget.Audio
|
|
// }
|
|
// return mediaUrl
|
|
//}
|
|
//
|
|
//func (widget *Widget) NormalizeUrl() {
|
|
// selfDomain := "http://localhost:8002/api/widget/media"
|
|
// strWidgetID := strconv.Itoa(int(widget.ID))
|
|
// if !strings.Contains(string(widget.ImageUrl), "http") && widget.ImageUrl != "" {
|
|
// widget.ImageUrl = MediaUrl(selfDomain + "/image/get/" + strWidgetID)
|
|
// }
|
|
//
|
|
// if !strings.Contains(string(widget.BackgroundUrl), "http") && widget.BackgroundUrl != "" {
|
|
// widget.BackgroundUrl = MediaUrl(selfDomain + "/background/get/" + strWidgetID)
|
|
// }
|
|
//
|
|
// if !strings.Contains(string(widget.AudioUrl), "http") && widget.AudioUrl != "" {
|
|
// widget.AudioUrl = MediaUrl(selfDomain + "/audio/get/" + strWidgetID)
|
|
// }
|
|
//}
|