init: init refactor

This commit is contained in:
Blizzard
2026-04-27 00:02:18 +08:00
commit e515f6a287
360 changed files with 30713 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
Name: radio-api
Host: 0.0.0.0
Port: 9005
Auth:
AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872
AccessExpire: 7200
# MySQL
DB:
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
# Redis
Cache:
- Host: 127.0.0.1:6379
Pass: sundynix
Type: node
# RPC 依赖
UserRpc:
Etcd:
Hosts:
- 192.168.100.127:2379
Key: user.rpc
FileRpc:
Etcd:
Hosts:
- 192.168.100.127:2379
Key: file.rpc
# TTS 火山引擎
Tts:
AppId: "9604175735"
ResourceId: "seed-tts-2.0"
AccessKey: "IMSrxDQgXWOwaJnuF-5G7uppRQutwBny"
# 微信支付
WechatPay:
MchId: "1735188493"
MchCertificateSerialNumber: "3725BFCA9CA3AF819AEC5D0CB7D3540BBC67F2CF"
MchApiV3Key: "a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6"
PrivateKeyPath: "/Users/blizzard/privateFolder/cert/apiclient_key.pem"
PublicKeyPath: "/Users/blizzard/privateFolder/cert/pub_key.pem"
NotifyUrl: "https://radio.sundynix.cn/api/wechatpay/notify"
+40
View File
@@ -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)
}
}
}
+291
View File
@@ -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)),
}
}
+180
View File
@@ -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"`
}
+377
View File
@@ -0,0 +1,377 @@
syntax = "v1"
info (
title: "电台业务服务API"
desc: "频道、节目、订阅、互动、支付、VIP、音色等HTTP接口"
author: "sundynix"
version: "v1.0.0"
)
type (
// ---------- 通用 ----------
IdReq {
Id string `json:"id"`
}
IdPathReq {
Id string `path:"id"`
}
IdsReq {
Ids []string `json:"ids"`
}
// ---------- 分类 ----------
CategoryReq {
Name string `json:"name"`
Icon string `json:"icon,optional"`
Sort int `json:"sort,optional"`
}
CategoryUpdateReq {
Id string `json:"id"`
Name string `json:"name,optional"`
Icon string `json:"icon,optional"`
Sort int `json:"sort,optional"`
}
CategoryListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
Name string `json:"name,optional"`
}
// ---------- 频道 ----------
ChannelReq {
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"`
}
ChannelUpdateReq {
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"`
}
ChannelListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
CategoryId string `json:"categoryId,optional"`
Name string `json:"name,optional"`
}
// ---------- 节目 ----------
ProgramReq {
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"`
}
ProgramUpdateReq {
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"`
}
ProgramListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
ChannelId string `json:"channelId,optional"`
Title string `json:"title,optional"`
}
// ---------- 音色 ----------
VoiceReq {
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"`
}
VoiceUpdateReq {
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"`
}
VoiceListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
Gender string `json:"gender,optional"`
}
// ---------- 订阅 ----------
SubscribeReq {
ChannelId string `json:"channelId"`
PlanType string `json:"planType"`
}
// ---------- 互动 ----------
LikeReq {
ProgramId string `json:"programId"`
}
FavoriteReq {
ProgramId string `json:"programId"`
}
CommentReq {
ProgramId string `json:"programId"`
Content string `json:"content"`
ParentId string `json:"parentId,optional"`
}
HistoryReq {
ProgramId string `json:"programId"`
Duration int `json:"duration,optional"`
}
HistoryListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
}
// ---------- 支付 ----------
CreatePayOrderReq {
ChannelId string `json:"channelId,optional"`
PlanType string `json:"planType"`
OrderType string `json:"orderType"`
}
// ---------- VIP ----------
VipConfigListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
}
// ---------- 数据分析 ----------
AnalyticsReq {
StartDate string `json:"startDate,optional"`
EndDate string `json:"endDate,optional"`
}
// ---------- TTS ----------
TtsReq {
Text string `json:"text"`
SpeakerId string `json:"speakerId,optional"`
}
)
// ========== 无需鉴权 ==========
@server (
prefix: /api/radio
group: callback
)
service radio-api {
@doc "微信支付回调"
@handler WechatPayCallback
post /callback/wechatpay
}
// ========== 需要鉴权 ==========
@server (
prefix: /api/radio
group: category
jwt: Auth
)
service radio-api {
@doc "创建分类"
@handler CreateCategory
post /category/create (CategoryReq)
@doc "更新分类"
@handler UpdateCategory
put /category/update (CategoryUpdateReq)
@doc "删除分类"
@handler DeleteCategory
delete /category/delete (IdsReq)
@doc "分类列表"
@handler GetCategoryList
post /category/list (CategoryListReq)
}
@server (
prefix: /api/radio
group: channel
jwt: Auth
)
service radio-api {
@doc "创建频道"
@handler CreateChannel
post /channel/create (ChannelReq)
@doc "更新频道"
@handler UpdateChannel
put /channel/update (ChannelUpdateReq)
@doc "删除频道"
@handler DeleteChannel
delete /channel/delete (IdsReq)
@doc "频道列表"
@handler GetChannelList
post /channel/list (ChannelListReq)
@doc "频道详情"
@handler GetChannelDetail
get /channel/:id (IdPathReq)
}
@server (
prefix: /api/radio
group: program
jwt: Auth
)
service radio-api {
@doc "创建节目"
@handler CreateProgram
post /program/create (ProgramReq)
@doc "更新节目"
@handler UpdateProgram
put /program/update (ProgramUpdateReq)
@doc "删除节目"
@handler DeleteProgram
delete /program/delete (IdsReq)
@doc "节目列表"
@handler GetProgramList
post /program/list (ProgramListReq)
@doc "节目详情"
@handler GetProgramDetail
get /program/:id (IdPathReq)
@doc "TTS生成音频"
@handler GenerateTts
post /program/tts (TtsReq)
}
@server (
prefix: /api/radio
group: voice
jwt: Auth
)
service radio-api {
@doc "创建音色"
@handler CreateVoice
post /voice/create (VoiceReq)
@doc "更新音色"
@handler UpdateVoice
put /voice/update (VoiceUpdateReq)
@doc "删除音色"
@handler DeleteVoice
delete /voice/delete (IdsReq)
@doc "音色列表"
@handler GetVoiceList
post /voice/list (VoiceListReq)
}
@server (
prefix: /api/radio
group: subscription
jwt: Auth
)
service radio-api {
@doc "我的订阅列表"
@handler GetMySubscriptions
get /subscription/list
}
@server (
prefix: /api/radio
group: interaction
jwt: Auth
)
service radio-api {
@doc "点赞/取消点赞"
@handler ToggleLike
post /interaction/like (LikeReq)
@doc "收藏/取消收藏"
@handler ToggleFavorite
post /interaction/favorite (FavoriteReq)
@doc "评论节目"
@handler CommentProgram
post /interaction/comment (CommentReq)
@doc "记录播放历史"
@handler RecordHistory
post /interaction/history (HistoryReq)
@doc "播放历史列表"
@handler GetHistoryList
post /interaction/history/list (HistoryListReq)
@doc "我的收藏列表"
@handler GetFavoriteList
post /interaction/favorite/list (HistoryListReq)
}
@server (
prefix: /api/radio
group: pay
jwt: Auth
)
service radio-api {
@doc "创建支付订单"
@handler CreatePayOrder
post /pay/create (CreatePayOrderReq)
}
@server (
prefix: /api/radio
group: vip
jwt: Auth
)
service radio-api {
@doc "VIP配置列表"
@handler GetVipConfigList
post /vip/list (VipConfigListReq)
@doc "我的VIP信息"
@handler GetMyVipInfo
get /vip/info
}
@server (
prefix: /api/radio
group: analytics
jwt: Auth
)
service radio-api {
@doc "数据概览"
@handler GetAnalyticsOverview
post /analytics/overview (AnalyticsReq)
@doc "频道数据"
@handler GetChannelAnalytics
post /analytics/channel (AnalyticsReq)
@doc "用户数据"
@handler GetUserAnalytics
post /analytics/user (AnalyticsReq)
}
+34
View File
@@ -0,0 +1,34 @@
// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package main
import (
"flag"
"fmt"
"sundynix-micro-go/app/radio/api/internal/config"
"sundynix-micro-go/app/radio/api/internal/handler"
"sundynix-micro-go/app/radio/api/internal/svc"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/rest"
)
var configFile = flag.String("f", "etc/radio-api.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
server := rest.MustNewServer(c.RestConf)
defer server.Stop()
ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()
}
+230
View File
@@ -0,0 +1,230 @@
package model
import (
"sundynix-micro-go/common/model"
"time"
)
// ========== 用户扩展表(radio业务特有字段) ==========
// SundynixRadioUserProfile 电台服务用户扩展表
type SundynixRadioUserProfile struct {
model.BaseModel
UserID string `gorm:"size:50;uniqueIndex;column:user_id" json:"userId"`
NickName string `gorm:"size:100;column:nick_name" json:"nickName"`
AvatarID string `gorm:"size:50;column:avatar_id" json:"avatarId"`
IsVip int `gorm:"default:0;column:is_vip" json:"isVip"`
VipExpireAt *time.Time `gorm:"column:vip_expire_at" json:"vipExpireAt"`
VipLevel int `gorm:"default:0;column:vip_level" json:"vipLevel"`
}
func (SundynixRadioUserProfile) TableName() string {
return "sundynix_radio_user_profile"
}
// ========== 分类 ==========
// SundynixRadioCategory 电台分类
type SundynixRadioCategory struct {
model.BaseModel
Name string `gorm:"size:50;column:name" json:"name"`
Icon string `gorm:"size:255;column:icon" json:"icon"`
Sort int `gorm:"default:0;column:sort" json:"sort"`
}
func (SundynixRadioCategory) TableName() string {
return "sundynix_radio_category"
}
// ========== 频道 ==========
// SundynixRadioChannel 电台频道
type SundynixRadioChannel struct {
model.BaseModel
CategoryID string `gorm:"size:50;index;column:category_id" json:"categoryId"`
Name string `gorm:"size:50;column:name" json:"name"`
Description string `gorm:"size:500;column:description" json:"description"`
IsFree int `gorm:"default:0;column:is_free" json:"isFree"`
IsVipOnly int `gorm:"default:0;column:is_vip_only" json:"isVipOnly"`
MonthlyPrice int `gorm:"default:0;column:monthly_price" json:"monthlyPrice"`
QuarterlyPrice int `gorm:"default:0;column:quarterly_price" json:"quarterlyPrice"`
AnnualPrice int `gorm:"default:0;column:annual_price" json:"annualPrice"`
Cover string `gorm:"size:100;column:cover" json:"cover"`
Tags string `gorm:"size:255;column:tags" json:"tags"`
Sort int `gorm:"default:0;column:sort" json:"sort"`
Status int `gorm:"default:1;column:status" json:"status"`
}
func (SundynixRadioChannel) TableName() string {
return "sundynix_radio_channel"
}
// ========== 节目 ==========
// SundynixRadioProgram 电台节目
type SundynixRadioProgram struct {
model.BaseModel
ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"`
Title string `gorm:"size:100;column:title" json:"title"`
Description string `gorm:"size:500;column:description" json:"description"`
Content string `gorm:"type:text;column:content" json:"content"`
Cover string `gorm:"size:100;column:cover" json:"cover"`
AudioID string `gorm:"size:50;column:audio_id" json:"audioId"`
AudioStatus int `gorm:"default:0;column:audio_status" json:"audioStatus"`
Duration int `gorm:"default:0;column:duration" json:"duration"`
Tags string `gorm:"size:255;column:tags" json:"tags"`
PlayCount int `gorm:"default:0;column:play_count" json:"playCount"`
LikeCount int `gorm:"default:0;column:like_count" json:"likeCount"`
Status int `gorm:"default:1;column:status" json:"status"`
}
func (SundynixRadioProgram) TableName() string {
return "sundynix_radio_program"
}
// ========== 音色 ==========
// SundynixRadioVoice 音色管理
type SundynixRadioVoice struct {
model.BaseModel
SpeakerID string `gorm:"size:50;uniqueIndex;column:speaker_id" json:"speakerId"`
Name string `gorm:"size:50;column:name" json:"name"`
Description string `gorm:"size:255;column:description" json:"description"`
Gender string `gorm:"size:10;column:gender" json:"gender"`
Icon string `gorm:"size:255;column:icon" json:"icon"`
AudioID string `gorm:"size:50;column:audio_id" json:"audioId"`
Sort int `gorm:"default:0;column:sort" json:"sort"`
Status int `gorm:"default:1;column:status" json:"status"`
IsDefault int `gorm:"default:0;column:is_default" json:"isDefault"`
UseCount int `gorm:"default:0;column:use_count" json:"useCount"`
}
func (SundynixRadioVoice) TableName() string {
return "sundynix_radio_voice"
}
// ========== 互动 ==========
// SundynixRadioLike 节目点赞
type SundynixRadioLike struct {
model.BaseModel
ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"`
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
}
func (SundynixRadioLike) TableName() string {
return "sundynix_radio_like"
}
// SundynixRadioFavorite 节目收藏
type SundynixRadioFavorite struct {
model.BaseModel
ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"`
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
}
func (SundynixRadioFavorite) TableName() string {
return "sundynix_radio_favorite"
}
// SundynixRadioComment 节目评论
type SundynixRadioComment struct {
model.BaseModel
ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"`
UserID string `gorm:"size:50;column:user_id" json:"userId"`
Content string `gorm:"size:500;column:content" json:"content"`
ParentID string `gorm:"size:50;column:parent_id" json:"parentId"`
}
func (SundynixRadioComment) TableName() string {
return "sundynix_radio_comment"
}
// SundynixRadioHistory 播放历史
type SundynixRadioHistory struct {
model.BaseModel
ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"`
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
Duration int `gorm:"default:0;column:duration" json:"duration"`
}
func (SundynixRadioHistory) TableName() string {
return "sundynix_radio_history"
}
// ========== 订阅/支付 ==========
// SundynixRadioSubscription 用户订阅
type SundynixRadioSubscription struct {
model.BaseModel
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"`
ExpiredAt time.Time `gorm:"index;column:expired_at" json:"expiredAt"`
Status int `gorm:"default:1;column:status" json:"status"`
}
func (SundynixRadioSubscription) TableName() string {
return "sundynix_radio_subscription"
}
// SundynixRadioSubscriptionOrder 订阅订单
type SundynixRadioSubscriptionOrder struct {
model.BaseModel
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
ChannelID string `gorm:"size:50;column:channel_id" json:"channelId"`
OrderNo string `gorm:"size:50;uniqueIndex;column:order_no" json:"orderNo"`
PlanType string `gorm:"size:20;column:plan_type" json:"planType"`
Amount int `gorm:"column:amount" json:"amount"`
Status int `gorm:"default:0;column:status" json:"status"`
PayType string `gorm:"size:20;column:pay_type" json:"payType"`
PrepayID string `gorm:"size:100;column:prepay_id" json:"prepayId"`
}
func (SundynixRadioSubscriptionOrder) TableName() string {
return "sundynix_radio_subscription_order"
}
// SundynixRadioPayNotify 支付回调记录
type SundynixRadioPayNotify struct {
model.BaseModel
OrderNo string `gorm:"size:50;column:order_no" json:"orderNo"`
TransactionID string `gorm:"size:50;column:transaction_id" json:"transactionId"`
TradeState string `gorm:"size:20;column:trade_state" json:"tradeState"`
RawData string `gorm:"type:text;column:raw_data" json:"rawData"`
}
func (SundynixRadioPayNotify) TableName() string {
return "sundynix_radio_pay_notify"
}
// ========== VIP配置 ==========
// SundynixRadioVipConfig VIP配置
type SundynixRadioVipConfig struct {
model.BaseModel
Name string `gorm:"size:50;column:name" json:"name"`
PlanType string `gorm:"size:20;column:plan_type" json:"planType"`
Price int `gorm:"column:price" json:"price"`
OriginalPrice int `gorm:"column:original_price" json:"originalPrice"`
Duration int `gorm:"column:duration" json:"duration"`
Desc string `gorm:"size:200;column:desc" json:"desc"`
Sort int `gorm:"default:0;column:sort" json:"sort"`
Status int `gorm:"default:1;column:status" json:"status"`
}
func (SundynixRadioVipConfig) TableName() string {
return "sundynix_radio_vip_config"
}
// SundynixRadioListenLog 收听日志(数据分析用)
type SundynixRadioListenLog struct {
model.BaseModel
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"`
ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"`
Duration int `gorm:"column:duration" json:"duration"`
}
func (SundynixRadioListenLog) TableName() string {
return "sundynix_radio_listen_log"
}
+6
View File
@@ -0,0 +1,6 @@
Name: radio.rpc
ListenOn: 0.0.0.0:8080
Etcd:
Hosts:
- 127.0.0.1:2379
Key: radio.rpc
+7
View File
@@ -0,0 +1,7 @@
package config
import "github.com/zeromicro/go-zero/zrpc"
type Config struct {
zrpc.RpcServerConf
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type CommentProgramLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCommentProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentProgramLogic {
return &CommentProgramLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *CommentProgramLogic) CommentProgram(in *radio.CommentReq) (*radio.CommentResp, error) {
// todo: add your logic here and delete this line
return &radio.CommentResp{}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateCategoryLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateCategoryLogic {
return &CreateCategoryLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 分类
func (l *CreateCategoryLogic) CreateCategory(in *radio.CreateCategoryReq) (*radio.CreateCategoryResp, error) {
// todo: add your logic here and delete this line
return &radio.CreateCategoryResp{}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateChannelLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChannelLogic {
return &CreateChannelLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 频道
func (l *CreateChannelLogic) CreateChannel(in *radio.CreateChannelReq) (*radio.CreateChannelResp, error) {
// todo: add your logic here and delete this line
return &radio.CreateChannelResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type CreatePayOrderLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreatePayOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePayOrderLogic {
return &CreatePayOrderLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *CreatePayOrderLogic) CreatePayOrder(in *radio.CreatePayOrderReq) (*radio.CreatePayOrderResp, error) {
// todo: add your logic here and delete this line
return &radio.CreatePayOrderResp{}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateProgramLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProgramLogic {
return &CreateProgramLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 节目
func (l *CreateProgramLogic) CreateProgram(in *radio.CreateProgramReq) (*radio.CreateProgramResp, error) {
// todo: add your logic here and delete this line
return &radio.CreateProgramResp{}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateVoiceLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVoiceLogic {
return &CreateVoiceLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 音色
func (l *CreateVoiceLogic) CreateVoice(in *radio.CreateVoiceReq) (*radio.CreateVoiceResp, error) {
// todo: add your logic here and delete this line
return &radio.CreateVoiceResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteCategoryLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCategoryLogic {
return &DeleteCategoryLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *DeleteCategoryLogic) DeleteCategory(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
// todo: add your logic here and delete this line
return &radio.DeleteResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteChannelLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteChannelLogic {
return &DeleteChannelLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *DeleteChannelLogic) DeleteChannel(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
// todo: add your logic here and delete this line
return &radio.DeleteResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteProgramLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProgramLogic {
return &DeleteProgramLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *DeleteProgramLogic) DeleteProgram(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
// todo: add your logic here and delete this line
return &radio.DeleteResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteVoiceLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVoiceLogic {
return &DeleteVoiceLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *DeleteVoiceLogic) DeleteVoice(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
// todo: add your logic here and delete this line
return &radio.DeleteResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetCategoryListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryListLogic {
return &GetCategoryListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetCategoryListLogic) GetCategoryList(in *radio.GetCategoryListReq) (*radio.GetCategoryListResp, error) {
// todo: add your logic here and delete this line
return &radio.GetCategoryListResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetChannelDetailLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetChannelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelDetailLogic {
return &GetChannelDetailLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetChannelDetailLogic) GetChannelDetail(in *radio.GetChannelDetailReq) (*radio.GetChannelDetailResp, error) {
// todo: add your logic here and delete this line
return &radio.GetChannelDetailResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetChannelListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetChannelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelListLogic {
return &GetChannelListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetChannelListLogic) GetChannelList(in *radio.GetChannelListReq) (*radio.GetChannelListResp, error) {
// todo: add your logic here and delete this line
return &radio.GetChannelListResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetFavoriteListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetFavoriteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFavoriteListLogic {
return &GetFavoriteListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetFavoriteListLogic) GetFavoriteList(in *radio.GetFavoriteListReq) (*radio.GetFavoriteListResp, error) {
// todo: add your logic here and delete this line
return &radio.GetFavoriteListResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetHistoryListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHistoryListLogic {
return &GetHistoryListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetHistoryListLogic) GetHistoryList(in *radio.GetHistoryListReq) (*radio.GetHistoryListResp, error) {
// todo: add your logic here and delete this line
return &radio.GetHistoryListResp{}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetMySubscriptionsLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetMySubscriptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMySubscriptionsLogic {
return &GetMySubscriptionsLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 订阅
func (l *GetMySubscriptionsLogic) GetMySubscriptions(in *radio.GetMySubscriptionsReq) (*radio.GetMySubscriptionsResp, error) {
// todo: add your logic here and delete this line
return &radio.GetMySubscriptionsResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetMyVipInfoLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetMyVipInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyVipInfoLogic {
return &GetMyVipInfoLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetMyVipInfoLogic) GetMyVipInfo(in *radio.GetMyVipInfoReq) (*radio.GetMyVipInfoResp, error) {
// todo: add your logic here and delete this line
return &radio.GetMyVipInfoResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetProgramDetailLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetProgramDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramDetailLogic {
return &GetProgramDetailLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetProgramDetailLogic) GetProgramDetail(in *radio.GetProgramDetailReq) (*radio.GetProgramDetailResp, error) {
// todo: add your logic here and delete this line
return &radio.GetProgramDetailResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetProgramListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetProgramListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramListLogic {
return &GetProgramListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetProgramListLogic) GetProgramList(in *radio.GetProgramListReq) (*radio.GetProgramListResp, error) {
// todo: add your logic here and delete this line
return &radio.GetProgramListResp{}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetRadioUserProfileLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetRadioUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRadioUserProfileLogic {
return &GetRadioUserProfileLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 用户
func (l *GetRadioUserProfileLogic) GetRadioUserProfile(in *radio.GetRadioUserProfileReq) (*radio.GetRadioUserProfileResp, error) {
// todo: add your logic here and delete this line
return &radio.GetRadioUserProfileResp{}, nil
}
@@ -0,0 +1,31 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetVipConfigListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetVipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVipConfigListLogic {
return &GetVipConfigListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// VIP
func (l *GetVipConfigListLogic) GetVipConfigList(in *radio.GetVipConfigListReq) (*radio.GetVipConfigListResp, error) {
// todo: add your logic here and delete this line
return &radio.GetVipConfigListResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type GetVoiceListLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetVoiceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVoiceListLogic {
return &GetVoiceListLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetVoiceListLogic) GetVoiceList(in *radio.GetVoiceListReq) (*radio.GetVoiceListResp, error) {
// todo: add your logic here and delete this line
return &radio.GetVoiceListResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type RecordHistoryLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewRecordHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecordHistoryLogic {
return &RecordHistoryLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *RecordHistoryLogic) RecordHistory(in *radio.RecordHistoryReq) (*radio.RecordHistoryResp, error) {
// todo: add your logic here and delete this line
return &radio.RecordHistoryResp{}, nil
}
@@ -0,0 +1,30 @@
package logic
import (
"context"
"sundynix-micro-go/app/radio/rpc/internal/svc"
"sundynix-micro-go/app/radio/rpc/radio"
"github.com/zeromicro/go-zero/core/logx"
)
type ToggleFavoriteLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewToggleFavoriteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleFavoriteLogic {
return &ToggleFavoriteLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *ToggleFavoriteLogic) ToggleFavorite(in *radio.ToggleFavoriteReq) (*radio.ToggleFavoriteResp, error) {
// todo: add your logic here and delete this line
return &radio.ToggleFavoriteResp{}, nil
}

Some files were not shown because too many files have changed in this diff Show More