init: init refactor
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
Auth struct {
|
||||
AccessSecret string
|
||||
AccessExpire int64
|
||||
}
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
Cache []struct {
|
||||
Host string
|
||||
Pass string
|
||||
Type string
|
||||
}
|
||||
UserRpc zrpc.RpcClientConf
|
||||
FileRpc zrpc.RpcClientConf
|
||||
Tts struct {
|
||||
AppId string
|
||||
ResourceId string
|
||||
AccessKey string
|
||||
}
|
||||
WechatPay struct {
|
||||
MchId string
|
||||
MchCertificateSerialNumber string
|
||||
MchApiV3Key string
|
||||
PrivateKeyPath string
|
||||
PublicKeyPath string
|
||||
NotifyUrl string
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package analytics
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/analytics"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 数据概览
|
||||
func GetAnalyticsOverviewHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AnalyticsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := analytics.NewGetAnalyticsOverviewLogic(r.Context(), svcCtx)
|
||||
err := l.GetAnalyticsOverview(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package analytics
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/analytics"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 频道数据
|
||||
func GetChannelAnalyticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AnalyticsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := analytics.NewGetChannelAnalyticsLogic(r.Context(), svcCtx)
|
||||
err := l.GetChannelAnalytics(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package analytics
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/analytics"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 用户数据
|
||||
func GetUserAnalyticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AnalyticsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := analytics.NewGetUserAnalyticsLogic(r.Context(), svcCtx)
|
||||
err := l.GetUserAnalytics(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package callback
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/callback"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 微信支付回调
|
||||
func WechatPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := callback.NewWechatPayCallbackLogic(r.Context(), svcCtx)
|
||||
err := l.WechatPayCallback()
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/category"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 创建分类
|
||||
func CreateCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CategoryReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := category.NewCreateCategoryLogic(r.Context(), svcCtx)
|
||||
err := l.CreateCategory(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/category"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 删除分类
|
||||
func DeleteCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := category.NewDeleteCategoryLogic(r.Context(), svcCtx)
|
||||
err := l.DeleteCategory(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/category"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 分类列表
|
||||
func GetCategoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CategoryListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := category.NewGetCategoryListLogic(r.Context(), svcCtx)
|
||||
err := l.GetCategoryList(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/category"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 更新分类
|
||||
func UpdateCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CategoryUpdateReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := category.NewUpdateCategoryLogic(r.Context(), svcCtx)
|
||||
err := l.UpdateCategory(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/channel"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 创建频道
|
||||
func CreateChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ChannelReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := channel.NewCreateChannelLogic(r.Context(), svcCtx)
|
||||
err := l.CreateChannel(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/channel"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 删除频道
|
||||
func DeleteChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := channel.NewDeleteChannelLogic(r.Context(), svcCtx)
|
||||
err := l.DeleteChannel(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/channel"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 频道详情
|
||||
func GetChannelDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdPathReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := channel.NewGetChannelDetailLogic(r.Context(), svcCtx)
|
||||
err := l.GetChannelDetail(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/channel"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 频道列表
|
||||
func GetChannelListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ChannelListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := channel.NewGetChannelListLogic(r.Context(), svcCtx)
|
||||
err := l.GetChannelList(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/channel"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 更新频道
|
||||
func UpdateChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ChannelUpdateReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := channel.NewUpdateChannelLogic(r.Context(), svcCtx)
|
||||
err := l.UpdateChannel(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/interaction"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 评论节目
|
||||
func CommentProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CommentReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := interaction.NewCommentProgramLogic(r.Context(), svcCtx)
|
||||
err := l.CommentProgram(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/interaction"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 我的收藏列表
|
||||
func GetFavoriteListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.HistoryListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := interaction.NewGetFavoriteListLogic(r.Context(), svcCtx)
|
||||
err := l.GetFavoriteList(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/interaction"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 播放历史列表
|
||||
func GetHistoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.HistoryListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := interaction.NewGetHistoryListLogic(r.Context(), svcCtx)
|
||||
err := l.GetHistoryList(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/interaction"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 记录播放历史
|
||||
func RecordHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.HistoryReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := interaction.NewRecordHistoryLogic(r.Context(), svcCtx)
|
||||
err := l.RecordHistory(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/interaction"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 收藏/取消收藏
|
||||
func ToggleFavoriteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.FavoriteReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := interaction.NewToggleFavoriteLogic(r.Context(), svcCtx)
|
||||
err := l.ToggleFavorite(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/interaction"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 点赞/取消点赞
|
||||
func ToggleLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.LikeReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := interaction.NewToggleLikeLogic(r.Context(), svcCtx)
|
||||
err := l.ToggleLike(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package pay
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/pay"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 创建支付订单
|
||||
func CreatePayOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreatePayOrderReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := pay.NewCreatePayOrderLogic(r.Context(), svcCtx)
|
||||
err := l.CreatePayOrder(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/program"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 创建节目
|
||||
func CreateProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ProgramReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := program.NewCreateProgramLogic(r.Context(), svcCtx)
|
||||
err := l.CreateProgram(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/program"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 删除节目
|
||||
func DeleteProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := program.NewDeleteProgramLogic(r.Context(), svcCtx)
|
||||
err := l.DeleteProgram(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/program"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// TTS生成音频
|
||||
func GenerateTtsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TtsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := program.NewGenerateTtsLogic(r.Context(), svcCtx)
|
||||
err := l.GenerateTts(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/program"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 节目详情
|
||||
func GetProgramDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdPathReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := program.NewGetProgramDetailLogic(r.Context(), svcCtx)
|
||||
err := l.GetProgramDetail(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/program"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 节目列表
|
||||
func GetProgramListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ProgramListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := program.NewGetProgramListLogic(r.Context(), svcCtx)
|
||||
err := l.GetProgramList(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/program"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 更新节目
|
||||
func UpdateProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ProgramUpdateReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := program.NewUpdateProgramLogic(r.Context(), svcCtx)
|
||||
err := l.UpdateProgram(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.10.1
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
analytics "sundynix-micro-go/app/radio/api/internal/handler/analytics"
|
||||
callback "sundynix-micro-go/app/radio/api/internal/handler/callback"
|
||||
category "sundynix-micro-go/app/radio/api/internal/handler/category"
|
||||
channel "sundynix-micro-go/app/radio/api/internal/handler/channel"
|
||||
interaction "sundynix-micro-go/app/radio/api/internal/handler/interaction"
|
||||
pay "sundynix-micro-go/app/radio/api/internal/handler/pay"
|
||||
program "sundynix-micro-go/app/radio/api/internal/handler/program"
|
||||
subscription "sundynix-micro-go/app/radio/api/internal/handler/subscription"
|
||||
vip "sundynix-micro-go/app/radio/api/internal/handler/vip"
|
||||
voice "sundynix-micro-go/app/radio/api/internal/handler/voice"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 频道数据
|
||||
Method: http.MethodPost,
|
||||
Path: "/analytics/channel",
|
||||
Handler: analytics.GetChannelAnalyticsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 数据概览
|
||||
Method: http.MethodPost,
|
||||
Path: "/analytics/overview",
|
||||
Handler: analytics.GetAnalyticsOverviewHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 用户数据
|
||||
Method: http.MethodPost,
|
||||
Path: "/analytics/user",
|
||||
Handler: analytics.GetUserAnalyticsHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 微信支付回调
|
||||
Method: http.MethodPost,
|
||||
Path: "/callback/wechatpay",
|
||||
Handler: callback.WechatPayCallbackHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 创建分类
|
||||
Method: http.MethodPost,
|
||||
Path: "/category/create",
|
||||
Handler: category.CreateCategoryHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除分类
|
||||
Method: http.MethodDelete,
|
||||
Path: "/category/delete",
|
||||
Handler: category.DeleteCategoryHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 分类列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/category/list",
|
||||
Handler: category.GetCategoryListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新分类
|
||||
Method: http.MethodPut,
|
||||
Path: "/category/update",
|
||||
Handler: category.UpdateCategoryHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 频道详情
|
||||
Method: http.MethodGet,
|
||||
Path: "/channel/:id",
|
||||
Handler: channel.GetChannelDetailHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 创建频道
|
||||
Method: http.MethodPost,
|
||||
Path: "/channel/create",
|
||||
Handler: channel.CreateChannelHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除频道
|
||||
Method: http.MethodDelete,
|
||||
Path: "/channel/delete",
|
||||
Handler: channel.DeleteChannelHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 频道列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/channel/list",
|
||||
Handler: channel.GetChannelListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新频道
|
||||
Method: http.MethodPut,
|
||||
Path: "/channel/update",
|
||||
Handler: channel.UpdateChannelHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 评论节目
|
||||
Method: http.MethodPost,
|
||||
Path: "/interaction/comment",
|
||||
Handler: interaction.CommentProgramHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 收藏/取消收藏
|
||||
Method: http.MethodPost,
|
||||
Path: "/interaction/favorite",
|
||||
Handler: interaction.ToggleFavoriteHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 我的收藏列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/interaction/favorite/list",
|
||||
Handler: interaction.GetFavoriteListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 记录播放历史
|
||||
Method: http.MethodPost,
|
||||
Path: "/interaction/history",
|
||||
Handler: interaction.RecordHistoryHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 播放历史列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/interaction/history/list",
|
||||
Handler: interaction.GetHistoryListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 点赞/取消点赞
|
||||
Method: http.MethodPost,
|
||||
Path: "/interaction/like",
|
||||
Handler: interaction.ToggleLikeHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 创建支付订单
|
||||
Method: http.MethodPost,
|
||||
Path: "/pay/create",
|
||||
Handler: pay.CreatePayOrderHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 节目详情
|
||||
Method: http.MethodGet,
|
||||
Path: "/program/:id",
|
||||
Handler: program.GetProgramDetailHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 创建节目
|
||||
Method: http.MethodPost,
|
||||
Path: "/program/create",
|
||||
Handler: program.CreateProgramHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除节目
|
||||
Method: http.MethodDelete,
|
||||
Path: "/program/delete",
|
||||
Handler: program.DeleteProgramHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 节目列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/program/list",
|
||||
Handler: program.GetProgramListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// TTS生成音频
|
||||
Method: http.MethodPost,
|
||||
Path: "/program/tts",
|
||||
Handler: program.GenerateTtsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新节目
|
||||
Method: http.MethodPut,
|
||||
Path: "/program/update",
|
||||
Handler: program.UpdateProgramHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 我的订阅列表
|
||||
Method: http.MethodGet,
|
||||
Path: "/subscription/list",
|
||||
Handler: subscription.GetMySubscriptionsHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 我的VIP信息
|
||||
Method: http.MethodGet,
|
||||
Path: "/vip/info",
|
||||
Handler: vip.GetMyVipInfoHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// VIP配置列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/vip/list",
|
||||
Handler: vip.GetVipConfigListHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 创建音色
|
||||
Method: http.MethodPost,
|
||||
Path: "/voice/create",
|
||||
Handler: voice.CreateVoiceHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除音色
|
||||
Method: http.MethodDelete,
|
||||
Path: "/voice/delete",
|
||||
Handler: voice.DeleteVoiceHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 音色列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/voice/list",
|
||||
Handler: voice.GetVoiceListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新音色
|
||||
Method: http.MethodPut,
|
||||
Path: "/voice/update",
|
||||
Handler: voice.UpdateVoiceHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/radio"),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package subscription
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/subscription"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 我的订阅列表
|
||||
func GetMySubscriptionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := subscription.NewGetMySubscriptionsLogic(r.Context(), svcCtx)
|
||||
err := l.GetMySubscriptions()
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package vip
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/vip"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 我的VIP信息
|
||||
func GetMyVipInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := vip.NewGetMyVipInfoLogic(r.Context(), svcCtx)
|
||||
err := l.GetMyVipInfo()
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package vip
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/vip"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// VIP配置列表
|
||||
func GetVipConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.VipConfigListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := vip.NewGetVipConfigListLogic(r.Context(), svcCtx)
|
||||
err := l.GetVipConfigList(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/voice"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 创建音色
|
||||
func CreateVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.VoiceReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := voice.NewCreateVoiceLogic(r.Context(), svcCtx)
|
||||
err := l.CreateVoice(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/voice"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 删除音色
|
||||
func DeleteVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.IdsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := voice.NewDeleteVoiceLogic(r.Context(), svcCtx)
|
||||
err := l.DeleteVoice(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/voice"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 音色列表
|
||||
func GetVoiceListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.VoiceListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := voice.NewGetVoiceListLogic(r.Context(), svcCtx)
|
||||
err := l.GetVoiceList(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"sundynix-micro-go/app/radio/api/internal/logic/voice"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
"sundynix-micro-go/common/response"
|
||||
)
|
||||
|
||||
// 更新音色
|
||||
func UpdateVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.VoiceUpdateReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
l := voice.NewUpdateVoiceLogic(r.Context(), svcCtx)
|
||||
err := l.UpdateVoice(&req)
|
||||
if err != nil {
|
||||
response.Fail(w, err.Error())
|
||||
} else {
|
||||
response.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package analytics
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetAnalyticsOverviewLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 数据概览
|
||||
func NewGetAnalyticsOverviewLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAnalyticsOverviewLogic {
|
||||
return &GetAnalyticsOverviewLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetAnalyticsOverviewLogic) GetAnalyticsOverview(req *types.AnalyticsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package analytics
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetChannelAnalyticsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 频道数据
|
||||
func NewGetChannelAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelAnalyticsLogic {
|
||||
return &GetChannelAnalyticsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetChannelAnalyticsLogic) GetChannelAnalytics(req *types.AnalyticsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package analytics
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetUserAnalyticsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 用户数据
|
||||
func NewGetUserAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserAnalyticsLogic {
|
||||
return &GetUserAnalyticsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetUserAnalyticsLogic) GetUserAnalytics(req *types.AnalyticsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package callback
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
)
|
||||
|
||||
type WechatPayCallbackLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 微信支付回调
|
||||
func NewWechatPayCallbackLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WechatPayCallbackLogic {
|
||||
return &WechatPayCallbackLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *WechatPayCallbackLogic) WechatPayCallback() error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateCategoryLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 创建分类
|
||||
func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateCategoryLogic {
|
||||
return &CreateCategoryLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateCategoryLogic) CreateCategory(req *types.CategoryReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteCategoryLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 删除分类
|
||||
func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCategoryLogic {
|
||||
return &DeleteCategoryLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteCategoryLogic) DeleteCategory(req *types.IdsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetCategoryListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 分类列表
|
||||
func NewGetCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryListLogic {
|
||||
return &GetCategoryListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetCategoryListLogic) GetCategoryList(req *types.CategoryListReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UpdateCategoryLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 更新分类
|
||||
func NewUpdateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateCategoryLogic {
|
||||
return &UpdateCategoryLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateCategoryLogic) UpdateCategory(req *types.CategoryUpdateReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateChannelLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 创建频道
|
||||
func NewCreateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChannelLogic {
|
||||
return &CreateChannelLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateChannelLogic) CreateChannel(req *types.ChannelReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteChannelLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 删除频道
|
||||
func NewDeleteChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteChannelLogic {
|
||||
return &DeleteChannelLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteChannelLogic) DeleteChannel(req *types.IdsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetChannelDetailLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 频道详情
|
||||
func NewGetChannelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelDetailLogic {
|
||||
return &GetChannelDetailLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetChannelDetailLogic) GetChannelDetail(req *types.IdPathReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetChannelListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 频道列表
|
||||
func NewGetChannelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelListLogic {
|
||||
return &GetChannelListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetChannelListLogic) GetChannelList(req *types.ChannelListReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package channel
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UpdateChannelLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 更新频道
|
||||
func NewUpdateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateChannelLogic {
|
||||
return &UpdateChannelLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateChannelLogic) UpdateChannel(req *types.ChannelUpdateReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CommentProgramLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 评论节目
|
||||
func NewCommentProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentProgramLogic {
|
||||
return &CommentProgramLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CommentProgramLogic) CommentProgram(req *types.CommentReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetFavoriteListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 我的收藏列表
|
||||
func NewGetFavoriteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFavoriteListLogic {
|
||||
return &GetFavoriteListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetFavoriteListLogic) GetFavoriteList(req *types.HistoryListReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetHistoryListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 播放历史列表
|
||||
func NewGetHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHistoryListLogic {
|
||||
return &GetHistoryListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetHistoryListLogic) GetHistoryList(req *types.HistoryListReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RecordHistoryLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 记录播放历史
|
||||
func NewRecordHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecordHistoryLogic {
|
||||
return &RecordHistoryLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RecordHistoryLogic) RecordHistory(req *types.HistoryReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ToggleFavoriteLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 收藏/取消收藏
|
||||
func NewToggleFavoriteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleFavoriteLogic {
|
||||
return &ToggleFavoriteLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ToggleFavoriteLogic) ToggleFavorite(req *types.FavoriteReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package interaction
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ToggleLikeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 点赞/取消点赞
|
||||
func NewToggleLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleLikeLogic {
|
||||
return &ToggleLikeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ToggleLikeLogic) ToggleLike(req *types.LikeReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreatePayOrderLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 创建支付订单
|
||||
func NewCreatePayOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePayOrderLogic {
|
||||
return &CreatePayOrderLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreatePayOrderLogic) CreatePayOrder(req *types.CreatePayOrderReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateProgramLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 创建节目
|
||||
func NewCreateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProgramLogic {
|
||||
return &CreateProgramLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateProgramLogic) CreateProgram(req *types.ProgramReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteProgramLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 删除节目
|
||||
func NewDeleteProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProgramLogic {
|
||||
return &DeleteProgramLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteProgramLogic) DeleteProgram(req *types.IdsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GenerateTtsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// TTS生成音频
|
||||
func NewGenerateTtsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GenerateTtsLogic {
|
||||
return &GenerateTtsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GenerateTtsLogic) GenerateTts(req *types.TtsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetProgramDetailLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 节目详情
|
||||
func NewGetProgramDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramDetailLogic {
|
||||
return &GetProgramDetailLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetProgramDetailLogic) GetProgramDetail(req *types.IdPathReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetProgramListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 节目列表
|
||||
func NewGetProgramListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramListLogic {
|
||||
return &GetProgramListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetProgramListLogic) GetProgramList(req *types.ProgramListReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package program
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UpdateProgramLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 更新节目
|
||||
func NewUpdateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProgramLogic {
|
||||
return &UpdateProgramLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateProgramLogic) UpdateProgram(req *types.ProgramUpdateReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package subscription
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
)
|
||||
|
||||
type GetMySubscriptionsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 我的订阅列表
|
||||
func NewGetMySubscriptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMySubscriptionsLogic {
|
||||
return &GetMySubscriptionsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetMySubscriptionsLogic) GetMySubscriptions() error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package vip
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
)
|
||||
|
||||
type GetMyVipInfoLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 我的VIP信息
|
||||
func NewGetMyVipInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyVipInfoLogic {
|
||||
return &GetMyVipInfoLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetMyVipInfoLogic) GetMyVipInfo() error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package vip
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetVipConfigListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// VIP配置列表
|
||||
func NewGetVipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVipConfigListLogic {
|
||||
return &GetVipConfigListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetVipConfigListLogic) GetVipConfigList(req *types.VipConfigListReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateVoiceLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 创建音色
|
||||
func NewCreateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVoiceLogic {
|
||||
return &CreateVoiceLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateVoiceLogic) CreateVoice(req *types.VoiceReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteVoiceLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 删除音色
|
||||
func NewDeleteVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVoiceLogic {
|
||||
return &DeleteVoiceLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteVoiceLogic) DeleteVoice(req *types.IdsReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetVoiceListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 音色列表
|
||||
func NewGetVoiceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVoiceListLogic {
|
||||
return &GetVoiceListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetVoiceListLogic) GetVoiceList(req *types.VoiceListReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package voice
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/radio/api/internal/svc"
|
||||
"sundynix-micro-go/app/radio/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UpdateVoiceLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 更新音色
|
||||
func NewUpdateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateVoiceLogic {
|
||||
return &UpdateVoiceLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateVoiceLogic) UpdateVoice(req *types.VoiceUpdateReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package svc
|
||||
|
||||
import (
|
||||
"sundynix-micro-go/app/file/rpc/fileservice"
|
||||
"sundynix-micro-go/app/radio/api/internal/config"
|
||||
radioModel "sundynix-micro-go/app/radio/model"
|
||||
"sundynix-micro-go/app/user/rpc/userservice"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
UserRpc userservice.UserService
|
||||
FileRpc fileservice.FileService
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{})
|
||||
if err != nil {
|
||||
logx.Errorf("连接数据库失败: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 自动迁移
|
||||
if err := db.AutoMigrate(
|
||||
&radioModel.SundynixRadioUserProfile{},
|
||||
&radioModel.SundynixRadioCategory{},
|
||||
&radioModel.SundynixRadioChannel{},
|
||||
&radioModel.SundynixRadioProgram{},
|
||||
&radioModel.SundynixRadioVoice{},
|
||||
&radioModel.SundynixRadioLike{},
|
||||
&radioModel.SundynixRadioFavorite{},
|
||||
&radioModel.SundynixRadioComment{},
|
||||
&radioModel.SundynixRadioHistory{},
|
||||
&radioModel.SundynixRadioSubscription{},
|
||||
&radioModel.SundynixRadioSubscriptionOrder{},
|
||||
&radioModel.SundynixRadioPayNotify{},
|
||||
&radioModel.SundynixRadioVipConfig{},
|
||||
&radioModel.SundynixRadioListenLog{},
|
||||
); err != nil {
|
||||
logx.Errorf("数据库迁移失败: %v", err)
|
||||
}
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
DB: db,
|
||||
UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)),
|
||||
FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.10.1
|
||||
|
||||
package types
|
||||
|
||||
type AnalyticsReq struct {
|
||||
StartDate string `json:"startDate,optional"`
|
||||
EndDate string `json:"endDate,optional"`
|
||||
}
|
||||
|
||||
type CategoryListReq struct {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
}
|
||||
|
||||
type CategoryReq struct {
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
}
|
||||
|
||||
type CategoryUpdateReq struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name,optional"`
|
||||
Icon string `json:"icon,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
}
|
||||
|
||||
type ChannelListReq struct {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
CategoryId string `json:"categoryId,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
}
|
||||
|
||||
type ChannelReq struct {
|
||||
CategoryId string `json:"categoryId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,optional"`
|
||||
IsFree int `json:"isFree,optional"`
|
||||
IsVipOnly int `json:"isVipOnly,optional"`
|
||||
MonthlyPrice int `json:"monthlyPrice,optional"`
|
||||
QuarterlyPrice int `json:"quarterlyPrice,optional"`
|
||||
AnnualPrice int `json:"annualPrice,optional"`
|
||||
Cover string `json:"cover,optional"`
|
||||
Tags string `json:"tags,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
}
|
||||
|
||||
type ChannelUpdateReq struct {
|
||||
Id string `json:"id"`
|
||||
CategoryId string `json:"categoryId,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
IsFree int `json:"isFree,optional"`
|
||||
IsVipOnly int `json:"isVipOnly,optional"`
|
||||
MonthlyPrice int `json:"monthlyPrice,optional"`
|
||||
QuarterlyPrice int `json:"quarterlyPrice,optional"`
|
||||
AnnualPrice int `json:"annualPrice,optional"`
|
||||
Cover string `json:"cover,optional"`
|
||||
Tags string `json:"tags,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
Status int `json:"status,optional"`
|
||||
}
|
||||
|
||||
type CommentReq struct {
|
||||
ProgramId string `json:"programId"`
|
||||
Content string `json:"content"`
|
||||
ParentId string `json:"parentId,optional"`
|
||||
}
|
||||
|
||||
type CreatePayOrderReq struct {
|
||||
ChannelId string `json:"channelId,optional"`
|
||||
PlanType string `json:"planType"`
|
||||
OrderType string `json:"orderType"`
|
||||
}
|
||||
|
||||
type FavoriteReq struct {
|
||||
ProgramId string `json:"programId"`
|
||||
}
|
||||
|
||||
type HistoryListReq struct {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
}
|
||||
|
||||
type HistoryReq struct {
|
||||
ProgramId string `json:"programId"`
|
||||
Duration int `json:"duration,optional"`
|
||||
}
|
||||
|
||||
type IdPathReq struct {
|
||||
Id string `path:"id"`
|
||||
}
|
||||
|
||||
type IdReq struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
type IdsReq struct {
|
||||
Ids []string `json:"ids"`
|
||||
}
|
||||
|
||||
type LikeReq struct {
|
||||
ProgramId string `json:"programId"`
|
||||
}
|
||||
|
||||
type ProgramListReq struct {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
ChannelId string `json:"channelId,optional"`
|
||||
Title string `json:"title,optional"`
|
||||
}
|
||||
|
||||
type ProgramReq struct {
|
||||
ChannelId string `json:"channelId"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description,optional"`
|
||||
Content string `json:"content,optional"`
|
||||
Cover string `json:"cover,optional"`
|
||||
AudioId string `json:"audioId,optional"`
|
||||
Tags string `json:"tags,optional"`
|
||||
}
|
||||
|
||||
type ProgramUpdateReq struct {
|
||||
Id string `json:"id"`
|
||||
ChannelId string `json:"channelId,optional"`
|
||||
Title string `json:"title,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
Content string `json:"content,optional"`
|
||||
Cover string `json:"cover,optional"`
|
||||
AudioId string `json:"audioId,optional"`
|
||||
Tags string `json:"tags,optional"`
|
||||
Status int `json:"status,optional"`
|
||||
}
|
||||
|
||||
type SubscribeReq struct {
|
||||
ChannelId string `json:"channelId"`
|
||||
PlanType string `json:"planType"`
|
||||
}
|
||||
|
||||
type TtsReq struct {
|
||||
Text string `json:"text"`
|
||||
SpeakerId string `json:"speakerId,optional"`
|
||||
}
|
||||
|
||||
type VipConfigListReq struct {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
}
|
||||
|
||||
type VoiceListReq struct {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
Gender string `json:"gender,optional"`
|
||||
}
|
||||
|
||||
type VoiceReq struct {
|
||||
SpeakerId string `json:"speakerId"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,optional"`
|
||||
Gender string `json:"gender,optional"`
|
||||
Icon string `json:"icon,optional"`
|
||||
AudioId string `json:"audioId,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
IsDefault int `json:"isDefault,optional"`
|
||||
}
|
||||
|
||||
type VoiceUpdateReq struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
Gender string `json:"gender,optional"`
|
||||
Icon string `json:"icon,optional"`
|
||||
AudioId string `json:"audioId,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
IsDefault int `json:"isDefault,optional"`
|
||||
Status int `json:"status,optional"`
|
||||
}
|
||||
Reference in New Issue
Block a user