init: radio init commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package response
|
||||
|
||||
import "sundynix-go/model/radio"
|
||||
|
||||
// CategoryResponse 分类响应
|
||||
type CategoryResponse struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Icon string `json:"icon"`
|
||||
CoverUrl string `json:"coverUrl"`
|
||||
Sort int `json:"sort"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
// CategoryDetailResponse 分类详情响应
|
||||
type CategoryDetailResponse struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Icon string `json:"icon"`
|
||||
CoverUrl string `json:"coverUrl"`
|
||||
Sort int `json:"sort"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
// ToCategoryResponse 转换为分类响应
|
||||
func ToCategoryResponse(category *radio.RadioCategory) CategoryResponse {
|
||||
resp := CategoryResponse{
|
||||
Id: category.Id,
|
||||
Name: category.Name,
|
||||
Description: category.Description,
|
||||
Sort: category.Sort,
|
||||
Status: category.Status,
|
||||
}
|
||||
if category.Icon != nil {
|
||||
resp.Icon = category.Icon.Url
|
||||
}
|
||||
if category.Cover != nil {
|
||||
resp.CoverUrl = category.Cover.Url
|
||||
}
|
||||
return resp
|
||||
}
|
||||
Reference in New Issue
Block a user