feat: 初次启动
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
Name: file-api
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
Host: 0.0.0.0
|
||||
Port: 9002
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
Name: file.rpc
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
ListenOn: 0.0.0.0:9102
|
||||
Etcd:
|
||||
Hosts:
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
Name: gateway
|
||||
Host: 0.0.0.0
|
||||
Port: 8888
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
Mode: console
|
||||
|
||||
# 跨域配置
|
||||
Cors:
|
||||
Enable: true
|
||||
AllowOrigins:
|
||||
- "*"
|
||||
AllowMethods:
|
||||
- GET
|
||||
- POST
|
||||
- PUT
|
||||
- DELETE
|
||||
- OPTIONS
|
||||
AllowHeaders:
|
||||
- Content-Type
|
||||
- Authorization
|
||||
- X-Requested-With
|
||||
|
||||
# 上游服务路由表
|
||||
Upstreams:
|
||||
- Prefix: /api/user
|
||||
Target: http://127.0.0.1:9001
|
||||
- Prefix: /api/file
|
||||
Target: http://127.0.0.1:9002
|
||||
- Prefix: /api/sys
|
||||
Target: http://127.0.0.1:9003
|
||||
- Prefix: /api/plant
|
||||
Target: http://127.0.0.1:9004
|
||||
- Prefix: /api/radio
|
||||
Target: http://127.0.0.1:9005
|
||||
@@ -0,0 +1,58 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"sundynix-micro-go/app/gateway/internal/config"
|
||||
"sundynix-micro-go/app/gateway/internal/handler"
|
||||
"sundynix-micro-go/app/gateway/internal/middleware"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/gateway.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
|
||||
// 构建反向代理路由器
|
||||
proxyRouter := handler.NewProxyRouter(c.Upstreams)
|
||||
|
||||
// 构建请求处理链
|
||||
var finalHandler http.Handler = proxyRouter
|
||||
|
||||
// 注入 CORS 中间件
|
||||
if c.Cors.Enable {
|
||||
corsMiddleware := middleware.NewCorsMiddleware(c.Cors.AllowOrigins, c.Cors.AllowMethods, c.Cors.AllowHeaders)
|
||||
finalHandler = http.HandlerFunc(corsMiddleware.Handle(func(w http.ResponseWriter, r *http.Request) {
|
||||
proxyRouter.ServeHTTP(w, r)
|
||||
}))
|
||||
}
|
||||
|
||||
// 健康检查
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
fmt.Fprintf(w, `{"code":200,"msg":"gateway is healthy","upstreams":%d}`, len(c.Upstreams))
|
||||
})
|
||||
mux.Handle("/", finalHandler)
|
||||
|
||||
addr := fmt.Sprintf("%s:%d", c.Host, c.Port)
|
||||
logx.Infof("===== Sundynix Gateway 启动 =====")
|
||||
logx.Infof("监听地址: %s", addr)
|
||||
logx.Infof("路由数量: %d", len(c.Upstreams))
|
||||
for _, u := range c.Upstreams {
|
||||
logx.Infof(" %s -> %s", u.Prefix, u.Target)
|
||||
}
|
||||
logx.Infof("================================")
|
||||
|
||||
if err := http.ListenAndServe(addr, mux); err != nil {
|
||||
logx.Errorf("网关启动失败: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/rest"
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
|
||||
Cors struct {
|
||||
Enable bool
|
||||
AllowOrigins []string
|
||||
AllowMethods []string
|
||||
AllowHeaders []string
|
||||
}
|
||||
|
||||
Upstreams []Upstream
|
||||
}
|
||||
|
||||
type Upstream struct {
|
||||
Prefix string // URL 前缀,如 /api/user
|
||||
Target string // 后端地址,如 http://127.0.0.1:9001
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"sundynix-micro-go/app/gateway/internal/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
// ProxyRouter 反向代理路由器
|
||||
type ProxyRouter struct {
|
||||
routes []*route
|
||||
}
|
||||
|
||||
type route struct {
|
||||
prefix string
|
||||
proxy *httputil.ReverseProxy
|
||||
target string
|
||||
}
|
||||
|
||||
// NewProxyRouter 根据配置构建路由表
|
||||
func NewProxyRouter(upstreams []config.Upstream) *ProxyRouter {
|
||||
router := &ProxyRouter{}
|
||||
|
||||
for _, u := range upstreams {
|
||||
targetURL, err := url.Parse(u.Target)
|
||||
if err != nil {
|
||||
logx.Errorf("解析上游地址失败 [%s]: %v", u.Target, err)
|
||||
continue
|
||||
}
|
||||
|
||||
target := targetURL // 显式捕获循环变量
|
||||
proxy := &httputil.ReverseProxy{
|
||||
Rewrite: func(pr *httputil.ProxyRequest) {
|
||||
pr.SetXForwarded()
|
||||
pr.Out.URL.Scheme = target.Scheme
|
||||
pr.Out.URL.Host = target.Host
|
||||
pr.Out.Host = target.Host
|
||||
// 路径透传:前端请求 /api/user/info -> 转发到 user-api 的 /api/user/info
|
||||
// 不剥前缀,后端API的路由本身就包含 /api/user 前缀
|
||||
},
|
||||
}
|
||||
|
||||
// 自定义 Transport:超时控制
|
||||
proxy.Transport = &http.Transport{
|
||||
MaxIdleConns: 100,
|
||||
MaxIdleConnsPerHost: 20,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
}
|
||||
|
||||
// 错误处理
|
||||
prefix := u.Prefix
|
||||
targetAddr := u.Target
|
||||
proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) {
|
||||
logx.Errorf("代理请求失败 [%s%s -> %s]: %v", prefix, r.URL.Path, targetAddr, err)
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(http.StatusBadGateway)
|
||||
fmt.Fprintf(w, `{"code":502,"msg":"上游服务不可用: %s"}`, prefix)
|
||||
}
|
||||
|
||||
router.routes = append(router.routes, &route{
|
||||
prefix: u.Prefix,
|
||||
proxy: proxy,
|
||||
target: u.Target,
|
||||
})
|
||||
|
||||
logx.Infof("路由注册: %s -> %s", u.Prefix, u.Target)
|
||||
}
|
||||
|
||||
return router
|
||||
}
|
||||
|
||||
// ServeHTTP 根据 URL 前缀匹配路由并转发
|
||||
func (pr *ProxyRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
path := r.URL.Path
|
||||
|
||||
for _, rt := range pr.routes {
|
||||
if strings.HasPrefix(path, rt.prefix) {
|
||||
logx.Infof("[Gateway] %s %s -> %s", r.Method, path, rt.target)
|
||||
rt.proxy.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 没有匹配的路由
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
fmt.Fprintf(w, `{"code":404,"msg":"路由未找到: %s"}`, path)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CorsMiddleware 跨域中间件
|
||||
type CorsMiddleware struct {
|
||||
allowOrigins []string
|
||||
allowMethods []string
|
||||
allowHeaders []string
|
||||
}
|
||||
|
||||
func NewCorsMiddleware(origins, methods, headers []string) *CorsMiddleware {
|
||||
return &CorsMiddleware{
|
||||
allowOrigins: origins,
|
||||
allowMethods: methods,
|
||||
allowHeaders: headers,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *CorsMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
origin := r.Header.Get("Origin")
|
||||
if origin == "" {
|
||||
next(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
allowed := false
|
||||
for _, o := range m.allowOrigins {
|
||||
if o == "*" || o == origin {
|
||||
allowed = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if allowed {
|
||||
w.Header().Set("Access-Control-Allow-Origin", origin)
|
||||
w.Header().Set("Access-Control-Allow-Methods", strings.Join(m.allowMethods, ", "))
|
||||
w.Header().Set("Access-Control-Allow-Headers", strings.Join(m.allowHeaders, ", "))
|
||||
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||
w.Header().Set("Access-Control-Max-Age", "3600")
|
||||
}
|
||||
|
||||
// 预检请求直接返回
|
||||
if r.Method == http.MethodOptions {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
|
||||
next(w, r)
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,20 @@
|
||||
Name: plant-api
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
Host: 0.0.0.0
|
||||
Port: 9004
|
||||
|
||||
Auth:
|
||||
AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872
|
||||
AccessExpire: 7200
|
||||
AccessSecret: sundynix-jwt-secret-2024
|
||||
AccessExpire: 604800
|
||||
|
||||
# MySQL
|
||||
DB:
|
||||
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
|
||||
PlantRpc:
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 192.168.100.127:2379
|
||||
Key: plant.rpc
|
||||
|
||||
# Redis
|
||||
Cache:
|
||||
- Host: 127.0.0.1:6379
|
||||
Pass: sundynix
|
||||
Type: node
|
||||
|
||||
# RPC 依赖
|
||||
UserRpc:
|
||||
Etcd:
|
||||
Hosts:
|
||||
@@ -28,17 +26,3 @@ FileRpc:
|
||||
Hosts:
|
||||
- 192.168.100.127:2379
|
||||
Key: file.rpc
|
||||
|
||||
# 百度植物识别
|
||||
BaiduImgClassify:
|
||||
ApiKey: hpBfjwy8ifv3qswYGYjUCNKN
|
||||
SecretKey: i5aXZdM4XZVuDroBslL0f3uIuwbAyXFS
|
||||
|
||||
# 微信支付
|
||||
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://prod.sundynix.cn/api/wechatpay/notify"
|
||||
|
||||
@@ -14,26 +14,7 @@ type Config struct {
|
||||
AccessSecret string
|
||||
AccessExpire int64
|
||||
}
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
Cache []struct {
|
||||
Host string
|
||||
Pass string
|
||||
Type string
|
||||
}
|
||||
PlantRpc zrpc.RpcClientConf
|
||||
UserRpc zrpc.RpcClientConf
|
||||
FileRpc zrpc.RpcClientConf
|
||||
BaiduImgClassify struct {
|
||||
ApiKey string
|
||||
SecretKey string
|
||||
}
|
||||
WechatPay struct {
|
||||
MchId string
|
||||
MchCertificateSerialNumber string
|
||||
MchApiV3Key string
|
||||
PrivateKeyPath string
|
||||
PublicKeyPath string
|
||||
NotifyUrl string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
@@ -7,7 +6,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type AddCarePlanLogic struct {
|
||||
@@ -22,12 +21,9 @@ func NewAddCarePlanLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCa
|
||||
|
||||
func (l *AddCarePlanLogic) AddCarePlan(req *types.CarePlanReq) error {
|
||||
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
|
||||
plan := plantModel.SundynixCarePlan{
|
||||
UserID: userId, PlantID: req.PlantId, Name: req.Name,
|
||||
TargetAction: req.TargetAction, Period: req.Period, Icon: req.Icon,
|
||||
}
|
||||
if err := l.svcCtx.DB.Create(&plan).Error; err != nil {
|
||||
return fmt.Errorf("创建养护计划失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.PlantRpc.AddCarePlan(l.ctx, &plant.AddCarePlanReq{
|
||||
UserId: userId, PlantId: req.PlantId, Name: req.Name, Icon: req.Icon,
|
||||
TargetAction: req.TargetAction, Period: int32(req.Period),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
@@ -7,7 +6,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type AddCareRecordLogic struct {
|
||||
@@ -22,12 +21,8 @@ func NewAddCareRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Add
|
||||
|
||||
func (l *AddCareRecordLogic) AddCareRecord(req *types.CareRecordReq) error {
|
||||
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
|
||||
record := plantModel.SundynixCareRecord{
|
||||
UserID: userId, PlantID: req.PlantId, PlanID: req.PlanId,
|
||||
Name: req.Action, Remark: req.Note,
|
||||
}
|
||||
if err := l.svcCtx.DB.Create(&record).Error; err != nil {
|
||||
return fmt.Errorf("创建养护记录失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.PlantRpc.AddCareRecord(l.ctx, &plant.AddCareRecordReq{
|
||||
UserId: userId, PlantId: req.PlantId, PlanId: req.PlanId, Action: req.Action, Note: req.Note,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
@@ -7,7 +6,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type AddGrowthRecordLogic struct {
|
||||
@@ -22,11 +21,8 @@ func NewAddGrowthRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *A
|
||||
|
||||
func (l *AddGrowthRecordLogic) AddGrowthRecord(req *types.GrowthRecordReq) error {
|
||||
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
|
||||
record := plantModel.SundynixGrowthRecord{
|
||||
PlantID: req.PlantId, UserID: userId, Content: req.Content,
|
||||
}
|
||||
if err := l.svcCtx.DB.Create(&record).Error; err != nil {
|
||||
return fmt.Errorf("创建成长记录失败")
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.PlantRpc.AddGrowthRecord(l.ctx, &plant.AddGrowthRecordReq{
|
||||
UserId: userId, PlantId: req.PlantId, Content: req.Content, ImgIds: req.ImgIds,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
@@ -7,8 +6,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"time"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type CreatePlantLogic struct {
|
||||
@@ -23,20 +21,10 @@ func NewCreatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
|
||||
|
||||
func (l *CreatePlantLogic) CreatePlant(req *types.CreatePlantReq) error {
|
||||
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
|
||||
plantTime, _ := time.Parse("2006-01-02", req.PlantTime)
|
||||
plant := plantModel.SundynixMyPlant{
|
||||
UserID: userId, Name: req.Name, PlantTime: plantTime, Placement: req.Placement,
|
||||
_, err := l.svcCtx.PlantRpc.CreatePlant(l.ctx, &plant.CreatePlantReq{
|
||||
UserId: userId, Name: req.Name, PlantTime: req.PlantTime, Placement: req.Placement,
|
||||
PotMaterial: req.PotMaterial, PotSize: req.PotSize, Sunlight: req.Sunlight,
|
||||
PlantingMaterial: req.PlantingMaterial, Status: 1,
|
||||
}
|
||||
if err := l.svcCtx.DB.Create(&plant).Error; err != nil {
|
||||
l.Errorf("创建植物失败: %v", err)
|
||||
return fmt.Errorf("创建植物失败")
|
||||
}
|
||||
if len(req.ImgIds) > 0 {
|
||||
for _, imgID := range req.ImgIds {
|
||||
l.svcCtx.DB.Create(&plantModel.SundynixMyPlantOss{MyPlantID: plant.ID, OssID: imgID})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
PlantingMaterial: req.PlantingMaterial, ImgIds: req.ImgIds,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type DeletePlantLogic struct {
|
||||
@@ -21,13 +19,6 @@ func NewDeletePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
|
||||
}
|
||||
|
||||
func (l *DeletePlantLogic) DeletePlant(req *types.IdsReq) error {
|
||||
if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&plantModel.SundynixMyPlant{}).Error; err != nil {
|
||||
return fmt.Errorf("删除植物失败")
|
||||
}
|
||||
// 清理关联数据
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCarePlan{})
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCareRecord{})
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCareTask{})
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixGrowthRecord{})
|
||||
return nil
|
||||
_, err := l.svcCtx.PlantRpc.DeletePlant(l.ctx, &plant.IdsReq{Ids: req.Ids})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
@@ -7,7 +6,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type GetMyPlantListLogic struct {
|
||||
@@ -22,22 +21,11 @@ func NewGetMyPlantListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
|
||||
func (l *GetMyPlantListLogic) GetMyPlantList(req *types.PlantListReq) (resp interface{}, err error) {
|
||||
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
|
||||
var plants []plantModel.SundynixMyPlant
|
||||
var total int64
|
||||
db := l.svcCtx.DB.Model(&plantModel.SundynixMyPlant{}).Where("user_id = ?", userId)
|
||||
if req.Name != "" {
|
||||
db = db.Where("name LIKE ?", "%"+req.Name+"%")
|
||||
result, err := l.svcCtx.PlantRpc.GetPlantList(l.ctx, &plant.PlantListReq{
|
||||
UserId: userId, Current: int32(req.Current), PageSize: int32(req.PageSize), Name: req.Name,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
db.Count(&total)
|
||||
current, pageSize := req.Current, req.PageSize
|
||||
if current <= 0 {
|
||||
current = 1
|
||||
}
|
||||
if pageSize <= 0 {
|
||||
pageSize = 10
|
||||
}
|
||||
if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("created_at DESC").Find(&plants).Error; err != nil {
|
||||
return nil, fmt.Errorf("查询植物列表失败")
|
||||
}
|
||||
return map[string]interface{}{"list": plants, "total": total, "current": current, "size": pageSize}, nil
|
||||
return map[string]interface{}{"list": result.List, "total": result.Total}, nil
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type GetPlantDetailLogic struct {
|
||||
@@ -22,24 +19,9 @@ func NewGetPlantDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
}
|
||||
|
||||
func (l *GetPlantDetailLogic) GetPlantDetail(req *types.IdPathReq) (resp interface{}, err error) {
|
||||
var plant plantModel.SundynixMyPlant
|
||||
if err := l.svcCtx.DB.Where("id = ?", req.Id).First(&plant).Error; err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return nil, fmt.Errorf("植物不存在")
|
||||
result, err := l.svcCtx.PlantRpc.GetPlantDetail(l.ctx, &plant.IdReq{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, fmt.Errorf("查询植物失败")
|
||||
}
|
||||
// 查询关联图片ID
|
||||
var ossIds []string
|
||||
l.svcCtx.DB.Model(&plantModel.SundynixMyPlantOss{}).Where("sundynix_my_plant_id = ?", plant.ID).Pluck("sundynix_oss_id", &ossIds)
|
||||
// 查询养护计划
|
||||
var plans []plantModel.SundynixCarePlan
|
||||
l.svcCtx.DB.Where("plant_id = ?", plant.ID).Find(&plans)
|
||||
// 查询成长记录
|
||||
var records []plantModel.SundynixGrowthRecord
|
||||
l.svcCtx.DB.Where("plant_id = ?", plant.ID).Order("created_at DESC").Limit(10).Find(&records)
|
||||
|
||||
return map[string]interface{}{
|
||||
"plant": plant, "imgIds": ossIds, "carePlans": plans, "growthRecords": records,
|
||||
}, nil
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type UpdatePlantLogic struct {
|
||||
@@ -21,32 +19,10 @@ func NewUpdatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Updat
|
||||
}
|
||||
|
||||
func (l *UpdatePlantLogic) UpdatePlant(req *types.UpdatePlantReq) error {
|
||||
updates := map[string]interface{}{}
|
||||
if req.Name != "" {
|
||||
updates["name"] = req.Name
|
||||
}
|
||||
if req.Status > 0 {
|
||||
updates["status"] = req.Status
|
||||
}
|
||||
if req.Placement != "" {
|
||||
updates["placement"] = req.Placement
|
||||
}
|
||||
if req.PotMaterial != "" {
|
||||
updates["pot_material"] = req.PotMaterial
|
||||
}
|
||||
if req.PotSize != "" {
|
||||
updates["pot_size"] = req.PotSize
|
||||
}
|
||||
if req.Sunlight != "" {
|
||||
updates["sunlight"] = req.Sunlight
|
||||
}
|
||||
if req.PlantingMaterial != "" {
|
||||
updates["planting_material"] = req.PlantingMaterial
|
||||
}
|
||||
if len(updates) > 0 {
|
||||
if err := l.svcCtx.DB.Model(&plantModel.SundynixMyPlant{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil {
|
||||
return fmt.Errorf("更新植物失败")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
_, err := l.svcCtx.PlantRpc.UpdatePlant(l.ctx, &plant.UpdatePlantReq{
|
||||
Id: req.Id, Name: req.Name, Status: int32(req.Status), Placement: req.Placement,
|
||||
PotMaterial: req.PotMaterial, PotSize: req.PotSize, Sunlight: req.Sunlight,
|
||||
PlantingMaterial: req.PlantingMaterial, ImgIds: req.ImgIds,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -6,57 +6,23 @@ package svc
|
||||
import (
|
||||
"sundynix-micro-go/app/file/rpc/fileservice"
|
||||
"sundynix-micro-go/app/plant/api/internal/config"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plantservice"
|
||||
"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
|
||||
PlantRpc plantservice.PlantService
|
||||
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(
|
||||
&plantModel.SundynixPlantUserProfile{},
|
||||
&plantModel.SundynixMyPlant{},
|
||||
&plantModel.SundynixCarePlan{},
|
||||
&plantModel.SundynixCareRecord{},
|
||||
&plantModel.SundynixCareTask{},
|
||||
&plantModel.SundynixGrowthRecord{},
|
||||
&plantModel.SundynixWiki{},
|
||||
&plantModel.SundynixWikiClass{},
|
||||
&plantModel.SundynixPost{},
|
||||
&plantModel.SundynixPostComment{},
|
||||
&plantModel.SundynixPostLike{},
|
||||
&plantModel.SundynixPostTopic{},
|
||||
&plantModel.SundynixUserStar{},
|
||||
&plantModel.SundynixExchangeItem{},
|
||||
&plantModel.SundynixExchangeOrder{},
|
||||
&plantModel.SundynixLevelConfig{},
|
||||
&plantModel.SundynixBadgeConfig{},
|
||||
&plantModel.SundynixUserBadge{},
|
||||
&plantModel.SundynixAiChatHistory{},
|
||||
); err != nil {
|
||||
logx.Errorf("数据库迁移失败: %v", err)
|
||||
}
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
DB: db,
|
||||
PlantRpc: plantservice.NewPlantService(zrpc.MustNewClient(c.PlantRpc)),
|
||||
UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)),
|
||||
FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
Name: plant.rpc
|
||||
ListenOn: 0.0.0.0:8080
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
ListenOn: 0.0.0.0:9014
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 127.0.0.1:2379
|
||||
- 192.168.100.127:2379
|
||||
Key: plant.rpc
|
||||
|
||||
DB:
|
||||
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
|
||||
|
||||
@@ -4,4 +4,7 @@ import "github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewAddCarePlanLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCa
|
||||
}
|
||||
|
||||
// 养护
|
||||
func (l *AddCarePlanLogic) AddCarePlan(in *plant.AddCarePlanReq) (*plant.AddCarePlanResp, error) {
|
||||
func (l *AddCarePlanLogic) AddCarePlan(in *plant.AddCarePlanReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.AddCarePlanResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewAddCareRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Add
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AddCareRecordLogic) AddCareRecord(in *plant.AddCareRecordReq) (*plant.AddCareRecordResp, error) {
|
||||
func (l *AddCareRecordLogic) AddCareRecord(in *plant.AddCareRecordReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.AddCareRecordResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewAddGrowthRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *A
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AddGrowthRecordLogic) AddGrowthRecord(in *plant.AddGrowthRecordReq) (*plant.AddGrowthRecordResp, error) {
|
||||
func (l *AddGrowthRecordLogic) AddGrowthRecord(in *plant.AddGrowthRecordReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.AddGrowthRecordResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewCommentPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Comme
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CommentPostLogic) CommentPost(in *plant.CommentPostReq) (*plant.CommentPostResp, error) {
|
||||
func (l *CommentPostLogic) CommentPost(in *plant.CommentPostReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.CommentPostResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewCreateExchangeOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateExchangeOrderLogic) CreateExchangeOrder(in *plant.CreateExchangeOrderReq) (*plant.CreateExchangeOrderResp, error) {
|
||||
func (l *CreateExchangeOrderLogic) CreateExchangeOrder(in *plant.CreateExchangeOrderReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.CreateExchangeOrderResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ func NewCreatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
|
||||
}
|
||||
}
|
||||
|
||||
// 植物
|
||||
func (l *CreatePlantLogic) CreatePlant(in *plant.CreatePlantReq) (*plant.CreatePlantResp, error) {
|
||||
// 我的植物
|
||||
func (l *CreatePlantLogic) CreatePlant(in *plant.CreatePlantReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.CreatePlantResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewCreatePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
|
||||
}
|
||||
|
||||
// 社区
|
||||
func (l *CreatePostLogic) CreatePost(in *plant.CreatePostReq) (*plant.CreatePostResp, error) {
|
||||
func (l *CreatePostLogic) CreatePost(in *plant.CreatePostReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.CreatePostResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewCreateTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateTopicLogic) CreateTopic(in *plant.CreateTopicReq) (*plant.CreateTopicResp, error) {
|
||||
func (l *CreateTopicLogic) CreateTopic(in *plant.CreateTopicReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.CreateTopicResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewCreateWikiClassLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateWikiClassLogic) CreateWikiClass(in *plant.CreateWikiClassReq) (*plant.CreateWikiClassResp, error) {
|
||||
func (l *CreateWikiClassLogic) CreateWikiClass(in *plant.CreateWikiClassReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.CreateWikiClassResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewDeletePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeletePlantLogic) DeletePlant(in *plant.DeletePlantReq) (*plant.DeletePlantResp, error) {
|
||||
func (l *DeletePlantLogic) DeletePlant(in *plant.IdsReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.DeletePlantResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewDeletePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeletePostLogic) DeletePost(in *plant.DeletePostReq) (*plant.DeletePostResp, error) {
|
||||
func (l *DeletePostLogic) DeletePost(in *plant.IdsReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.DeletePostResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewDeleteTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteTopicLogic) DeleteTopic(in *plant.DeleteTopicReq) (*plant.DeleteTopicResp, error) {
|
||||
func (l *DeleteTopicLogic) DeleteTopic(in *plant.IdsReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.DeleteTopicResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetBadgeConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetBadgeConfigListLogic) GetBadgeConfigList(in *plant.GetBadgeConfigListReq) (*plant.GetBadgeConfigListResp, error) {
|
||||
func (l *GetBadgeConfigListLogic) GetBadgeConfigList(in *plant.BadgeConfigListReq) (*plant.BadgeConfigListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetBadgeConfigListResp{}, nil
|
||||
return &plant.BadgeConfigListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewGetExchangeItemListLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 兑换
|
||||
func (l *GetExchangeItemListLogic) GetExchangeItemList(in *plant.GetExchangeItemListReq) (*plant.GetExchangeItemListResp, error) {
|
||||
func (l *GetExchangeItemListLogic) GetExchangeItemList(in *plant.ExchangeItemListReq) (*plant.ExchangeItemListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetExchangeItemListResp{}, nil
|
||||
return &plant.ExchangeItemListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewGetLevelConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
|
||||
// 配置
|
||||
func (l *GetLevelConfigListLogic) GetLevelConfigList(in *plant.GetLevelConfigListReq) (*plant.GetLevelConfigListResp, error) {
|
||||
func (l *GetLevelConfigListLogic) GetLevelConfigList(in *plant.PageReq) (*plant.LevelConfigListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetLevelConfigListResp{}, nil
|
||||
return &plant.LevelConfigListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetPlantDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetPlantDetailLogic) GetPlantDetail(in *plant.GetPlantDetailReq) (*plant.GetPlantDetailResp, error) {
|
||||
func (l *GetPlantDetailLogic) GetPlantDetail(in *plant.IdReq) (*plant.PlantDetailResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetPlantDetailResp{}, nil
|
||||
return &plant.PlantDetailResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetPlantListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetP
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetPlantListLogic) GetPlantList(in *plant.GetPlantListReq) (*plant.GetPlantListResp, error) {
|
||||
func (l *GetPlantListLogic) GetPlantList(in *plant.PlantListReq) (*plant.PlantListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetPlantListResp{}, nil
|
||||
return &plant.PlantListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetPostDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetPostDetailLogic) GetPostDetail(in *plant.GetPostDetailReq) (*plant.GetPostDetailResp, error) {
|
||||
func (l *GetPostDetailLogic) GetPostDetail(in *plant.IdReq) (*plant.PostDetailResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetPostDetailResp{}, nil
|
||||
return &plant.PostDetailResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetPostListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPo
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetPostListLogic) GetPostList(in *plant.GetPostListReq) (*plant.GetPostListResp, error) {
|
||||
func (l *GetPostListLogic) GetPostList(in *plant.PostListReq) (*plant.PostListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetPostListResp{}, nil
|
||||
return &plant.PostListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewGetTopicListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetT
|
||||
}
|
||||
|
||||
// 话题
|
||||
func (l *GetTopicListLogic) GetTopicList(in *plant.Empty) (*plant.GetTopicListResp, error) {
|
||||
func (l *GetTopicListLogic) GetTopicList(in *plant.IdReq) (*plant.TopicListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetTopicListResp{}, nil
|
||||
return &plant.TopicListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewGetUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
}
|
||||
|
||||
// 用户Profile
|
||||
func (l *GetUserProfileLogic) GetUserProfile(in *plant.GetUserProfileReq) (*plant.GetUserProfileResp, error) {
|
||||
func (l *GetUserProfileLogic) GetUserProfile(in *plant.GetProfileReq) (*plant.PlantUserProfile, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetUserProfileResp{}, nil
|
||||
return &plant.PlantUserProfile{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetWikiClassListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetWikiClassListLogic) GetWikiClassList(in *plant.Empty) (*plant.GetWikiClassListResp, error) {
|
||||
func (l *GetWikiClassListLogic) GetWikiClassList(in *plant.IdReq) (*plant.WikiClassListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetWikiClassListResp{}, nil
|
||||
return &plant.WikiClassListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetWikiDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetWikiDetailLogic) GetWikiDetail(in *plant.GetWikiDetailReq) (*plant.GetWikiDetailResp, error) {
|
||||
func (l *GetWikiDetailLogic) GetWikiDetail(in *plant.IdReq) (*plant.WikiDetailResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetWikiDetailResp{}, nil
|
||||
return &plant.WikiDetailResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewGetWikiListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWi
|
||||
}
|
||||
|
||||
// 百科
|
||||
func (l *GetWikiListLogic) GetWikiList(in *plant.GetWikiListReq) (*plant.GetWikiListResp, error) {
|
||||
func (l *GetWikiListLogic) GetWikiList(in *plant.WikiListReq) (*plant.WikiListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.GetWikiListResp{}, nil
|
||||
return &plant.WikiListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"sundynix-micro-go/app/plant/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type IncrUserCounterLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewIncrUserCounterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IncrUserCounterLogic {
|
||||
return &IncrUserCounterLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *IncrUserCounterLogic) IncrUserCounter(in *plant.IncrUserCounterReq) (*plant.IncrUserCounterResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.IncrUserCounterResp{}, nil
|
||||
}
|
||||
@@ -23,8 +23,8 @@ func NewLikePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikePost
|
||||
}
|
||||
}
|
||||
|
||||
func (l *LikePostLogic) LikePost(in *plant.LikePostReq) (*plant.LikePostResp, error) {
|
||||
func (l *LikePostLogic) LikePost(in *plant.LikePostReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.LikePostResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
+5
-5
@@ -9,22 +9,22 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ToggleStarLogic struct {
|
||||
type ToggleWikiStarLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewToggleStarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleStarLogic {
|
||||
return &ToggleStarLogic{
|
||||
func NewToggleWikiStarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleWikiStarLogic {
|
||||
return &ToggleWikiStarLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ToggleStarLogic) ToggleStar(in *plant.ToggleStarReq) (*plant.ToggleStarResp, error) {
|
||||
func (l *ToggleWikiStarLogic) ToggleWikiStar(in *plant.ToggleStarReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.ToggleStarResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
@@ -23,8 +23,8 @@ func NewUpdatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Updat
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdatePlantLogic) UpdatePlant(in *plant.UpdatePlantReq) (*plant.UpdatePlantResp, error) {
|
||||
func (l *UpdatePlantLogic) UpdatePlant(in *plant.UpdatePlantReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.UpdatePlantResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewUpdateUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateUserProfileLogic) UpdateUserProfile(in *plant.UpdateUserProfileReq) (*plant.UpdateUserProfileResp, error) {
|
||||
func (l *UpdateUserProfileLogic) UpdateUserProfile(in *plant.UpdateProfileReq) (*plant.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &plant.UpdateUserProfileResp{}, nil
|
||||
return &plant.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,154 +24,149 @@ func NewPlantServiceServer(svcCtx *svc.ServiceContext) *PlantServiceServer {
|
||||
}
|
||||
|
||||
// 用户Profile
|
||||
func (s *PlantServiceServer) GetUserProfile(ctx context.Context, in *plant.GetUserProfileReq) (*plant.GetUserProfileResp, error) {
|
||||
func (s *PlantServiceServer) GetUserProfile(ctx context.Context, in *plant.GetProfileReq) (*plant.PlantUserProfile, error) {
|
||||
l := logic.NewGetUserProfileLogic(ctx, s.svcCtx)
|
||||
return l.GetUserProfile(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) UpdateUserProfile(ctx context.Context, in *plant.UpdateUserProfileReq) (*plant.UpdateUserProfileResp, error) {
|
||||
func (s *PlantServiceServer) UpdateUserProfile(ctx context.Context, in *plant.UpdateProfileReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewUpdateUserProfileLogic(ctx, s.svcCtx)
|
||||
return l.UpdateUserProfile(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) IncrUserCounter(ctx context.Context, in *plant.IncrUserCounterReq) (*plant.IncrUserCounterResp, error) {
|
||||
l := logic.NewIncrUserCounterLogic(ctx, s.svcCtx)
|
||||
return l.IncrUserCounter(in)
|
||||
}
|
||||
|
||||
// 植物
|
||||
func (s *PlantServiceServer) CreatePlant(ctx context.Context, in *plant.CreatePlantReq) (*plant.CreatePlantResp, error) {
|
||||
// 我的植物
|
||||
func (s *PlantServiceServer) CreatePlant(ctx context.Context, in *plant.CreatePlantReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewCreatePlantLogic(ctx, s.svcCtx)
|
||||
return l.CreatePlant(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) UpdatePlant(ctx context.Context, in *plant.UpdatePlantReq) (*plant.UpdatePlantResp, error) {
|
||||
func (s *PlantServiceServer) UpdatePlant(ctx context.Context, in *plant.UpdatePlantReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewUpdatePlantLogic(ctx, s.svcCtx)
|
||||
return l.UpdatePlant(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) DeletePlant(ctx context.Context, in *plant.DeletePlantReq) (*plant.DeletePlantResp, error) {
|
||||
func (s *PlantServiceServer) DeletePlant(ctx context.Context, in *plant.IdsReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewDeletePlantLogic(ctx, s.svcCtx)
|
||||
return l.DeletePlant(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetPlantList(ctx context.Context, in *plant.GetPlantListReq) (*plant.GetPlantListResp, error) {
|
||||
func (s *PlantServiceServer) GetPlantList(ctx context.Context, in *plant.PlantListReq) (*plant.PlantListResp, error) {
|
||||
l := logic.NewGetPlantListLogic(ctx, s.svcCtx)
|
||||
return l.GetPlantList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetPlantDetail(ctx context.Context, in *plant.GetPlantDetailReq) (*plant.GetPlantDetailResp, error) {
|
||||
func (s *PlantServiceServer) GetPlantDetail(ctx context.Context, in *plant.IdReq) (*plant.PlantDetailResp, error) {
|
||||
l := logic.NewGetPlantDetailLogic(ctx, s.svcCtx)
|
||||
return l.GetPlantDetail(in)
|
||||
}
|
||||
|
||||
// 养护
|
||||
func (s *PlantServiceServer) AddCarePlan(ctx context.Context, in *plant.AddCarePlanReq) (*plant.AddCarePlanResp, error) {
|
||||
func (s *PlantServiceServer) AddCarePlan(ctx context.Context, in *plant.AddCarePlanReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewAddCarePlanLogic(ctx, s.svcCtx)
|
||||
return l.AddCarePlan(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) AddCareRecord(ctx context.Context, in *plant.AddCareRecordReq) (*plant.AddCareRecordResp, error) {
|
||||
func (s *PlantServiceServer) AddCareRecord(ctx context.Context, in *plant.AddCareRecordReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewAddCareRecordLogic(ctx, s.svcCtx)
|
||||
return l.AddCareRecord(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) AddGrowthRecord(ctx context.Context, in *plant.AddGrowthRecordReq) (*plant.AddGrowthRecordResp, error) {
|
||||
func (s *PlantServiceServer) AddGrowthRecord(ctx context.Context, in *plant.AddGrowthRecordReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewAddGrowthRecordLogic(ctx, s.svcCtx)
|
||||
return l.AddGrowthRecord(in)
|
||||
}
|
||||
|
||||
// 百科
|
||||
func (s *PlantServiceServer) GetWikiList(ctx context.Context, in *plant.GetWikiListReq) (*plant.GetWikiListResp, error) {
|
||||
func (s *PlantServiceServer) GetWikiList(ctx context.Context, in *plant.WikiListReq) (*plant.WikiListResp, error) {
|
||||
l := logic.NewGetWikiListLogic(ctx, s.svcCtx)
|
||||
return l.GetWikiList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetWikiDetail(ctx context.Context, in *plant.GetWikiDetailReq) (*plant.GetWikiDetailResp, error) {
|
||||
func (s *PlantServiceServer) GetWikiDetail(ctx context.Context, in *plant.IdReq) (*plant.WikiDetailResp, error) {
|
||||
l := logic.NewGetWikiDetailLogic(ctx, s.svcCtx)
|
||||
return l.GetWikiDetail(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetWikiClassList(ctx context.Context, in *plant.Empty) (*plant.GetWikiClassListResp, error) {
|
||||
func (s *PlantServiceServer) GetWikiClassList(ctx context.Context, in *plant.IdReq) (*plant.WikiClassListResp, error) {
|
||||
l := logic.NewGetWikiClassListLogic(ctx, s.svcCtx)
|
||||
return l.GetWikiClassList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) CreateWikiClass(ctx context.Context, in *plant.CreateWikiClassReq) (*plant.CreateWikiClassResp, error) {
|
||||
func (s *PlantServiceServer) CreateWikiClass(ctx context.Context, in *plant.CreateWikiClassReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewCreateWikiClassLogic(ctx, s.svcCtx)
|
||||
return l.CreateWikiClass(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) ToggleStar(ctx context.Context, in *plant.ToggleStarReq) (*plant.ToggleStarResp, error) {
|
||||
l := logic.NewToggleStarLogic(ctx, s.svcCtx)
|
||||
return l.ToggleStar(in)
|
||||
func (s *PlantServiceServer) ToggleWikiStar(ctx context.Context, in *plant.ToggleStarReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewToggleWikiStarLogic(ctx, s.svcCtx)
|
||||
return l.ToggleWikiStar(in)
|
||||
}
|
||||
|
||||
// 社区
|
||||
func (s *PlantServiceServer) CreatePost(ctx context.Context, in *plant.CreatePostReq) (*plant.CreatePostResp, error) {
|
||||
func (s *PlantServiceServer) CreatePost(ctx context.Context, in *plant.CreatePostReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewCreatePostLogic(ctx, s.svcCtx)
|
||||
return l.CreatePost(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetPostList(ctx context.Context, in *plant.GetPostListReq) (*plant.GetPostListResp, error) {
|
||||
l := logic.NewGetPostListLogic(ctx, s.svcCtx)
|
||||
return l.GetPostList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetPostDetail(ctx context.Context, in *plant.GetPostDetailReq) (*plant.GetPostDetailResp, error) {
|
||||
l := logic.NewGetPostDetailLogic(ctx, s.svcCtx)
|
||||
return l.GetPostDetail(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) DeletePost(ctx context.Context, in *plant.DeletePostReq) (*plant.DeletePostResp, error) {
|
||||
func (s *PlantServiceServer) DeletePost(ctx context.Context, in *plant.IdsReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewDeletePostLogic(ctx, s.svcCtx)
|
||||
return l.DeletePost(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) CommentPost(ctx context.Context, in *plant.CommentPostReq) (*plant.CommentPostResp, error) {
|
||||
func (s *PlantServiceServer) GetPostList(ctx context.Context, in *plant.PostListReq) (*plant.PostListResp, error) {
|
||||
l := logic.NewGetPostListLogic(ctx, s.svcCtx)
|
||||
return l.GetPostList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetPostDetail(ctx context.Context, in *plant.IdReq) (*plant.PostDetailResp, error) {
|
||||
l := logic.NewGetPostDetailLogic(ctx, s.svcCtx)
|
||||
return l.GetPostDetail(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) CommentPost(ctx context.Context, in *plant.CommentPostReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewCommentPostLogic(ctx, s.svcCtx)
|
||||
return l.CommentPost(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) LikePost(ctx context.Context, in *plant.LikePostReq) (*plant.LikePostResp, error) {
|
||||
func (s *PlantServiceServer) LikePost(ctx context.Context, in *plant.LikePostReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewLikePostLogic(ctx, s.svcCtx)
|
||||
return l.LikePost(in)
|
||||
}
|
||||
|
||||
// 话题
|
||||
func (s *PlantServiceServer) GetTopicList(ctx context.Context, in *plant.Empty) (*plant.GetTopicListResp, error) {
|
||||
func (s *PlantServiceServer) GetTopicList(ctx context.Context, in *plant.IdReq) (*plant.TopicListResp, error) {
|
||||
l := logic.NewGetTopicListLogic(ctx, s.svcCtx)
|
||||
return l.GetTopicList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) CreateTopic(ctx context.Context, in *plant.CreateTopicReq) (*plant.CreateTopicResp, error) {
|
||||
func (s *PlantServiceServer) CreateTopic(ctx context.Context, in *plant.CreateTopicReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewCreateTopicLogic(ctx, s.svcCtx)
|
||||
return l.CreateTopic(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) DeleteTopic(ctx context.Context, in *plant.DeleteTopicReq) (*plant.DeleteTopicResp, error) {
|
||||
func (s *PlantServiceServer) DeleteTopic(ctx context.Context, in *plant.IdsReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewDeleteTopicLogic(ctx, s.svcCtx)
|
||||
return l.DeleteTopic(in)
|
||||
}
|
||||
|
||||
// 配置
|
||||
func (s *PlantServiceServer) GetLevelConfigList(ctx context.Context, in *plant.GetLevelConfigListReq) (*plant.GetLevelConfigListResp, error) {
|
||||
l := logic.NewGetLevelConfigListLogic(ctx, s.svcCtx)
|
||||
return l.GetLevelConfigList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetBadgeConfigList(ctx context.Context, in *plant.GetBadgeConfigListReq) (*plant.GetBadgeConfigListResp, error) {
|
||||
l := logic.NewGetBadgeConfigListLogic(ctx, s.svcCtx)
|
||||
return l.GetBadgeConfigList(in)
|
||||
}
|
||||
|
||||
// 兑换
|
||||
func (s *PlantServiceServer) GetExchangeItemList(ctx context.Context, in *plant.GetExchangeItemListReq) (*plant.GetExchangeItemListResp, error) {
|
||||
func (s *PlantServiceServer) GetExchangeItemList(ctx context.Context, in *plant.ExchangeItemListReq) (*plant.ExchangeItemListResp, error) {
|
||||
l := logic.NewGetExchangeItemListLogic(ctx, s.svcCtx)
|
||||
return l.GetExchangeItemList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) CreateExchangeOrder(ctx context.Context, in *plant.CreateExchangeOrderReq) (*plant.CreateExchangeOrderResp, error) {
|
||||
func (s *PlantServiceServer) CreateExchangeOrder(ctx context.Context, in *plant.CreateExchangeOrderReq) (*plant.CommonResp, error) {
|
||||
l := logic.NewCreateExchangeOrderLogic(ctx, s.svcCtx)
|
||||
return l.CreateExchangeOrder(in)
|
||||
}
|
||||
|
||||
// 配置
|
||||
func (s *PlantServiceServer) GetLevelConfigList(ctx context.Context, in *plant.PageReq) (*plant.LevelConfigListResp, error) {
|
||||
l := logic.NewGetLevelConfigListLogic(ctx, s.svcCtx)
|
||||
return l.GetLevelConfigList(in)
|
||||
}
|
||||
|
||||
func (s *PlantServiceServer) GetBadgeConfigList(ctx context.Context, in *plant.BadgeConfigListReq) (*plant.BadgeConfigListResp, error) {
|
||||
l := logic.NewGetBadgeConfigListLogic(ctx, s.svcCtx)
|
||||
return l.GetBadgeConfigList(in)
|
||||
}
|
||||
|
||||
@@ -1,13 +1,49 @@
|
||||
package svc
|
||||
|
||||
import "sundynix-micro-go/app/plant/rpc/internal/config"
|
||||
import (
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/internal/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{})
|
||||
if err != nil {
|
||||
logx.Errorf("连接数据库失败: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := db.AutoMigrate(
|
||||
&plantModel.SundynixPlantUserProfile{},
|
||||
&plantModel.SundynixMyPlant{},
|
||||
&plantModel.SundynixCarePlan{},
|
||||
&plantModel.SundynixCareRecord{},
|
||||
&plantModel.SundynixCareTask{},
|
||||
&plantModel.SundynixGrowthRecord{},
|
||||
&plantModel.SundynixWiki{},
|
||||
&plantModel.SundynixWikiClass{},
|
||||
&plantModel.SundynixPost{},
|
||||
&plantModel.SundynixPostComment{},
|
||||
&plantModel.SundynixPostLike{},
|
||||
&plantModel.SundynixPostTopic{},
|
||||
&plantModel.SundynixUserStar{},
|
||||
&plantModel.SundynixExchangeItem{},
|
||||
&plantModel.SundynixExchangeOrder{},
|
||||
&plantModel.SundynixLevelConfig{},
|
||||
&plantModel.SundynixBadgeConfig{},
|
||||
&plantModel.SundynixUserBadge{},
|
||||
&plantModel.SundynixAiChatHistory{},
|
||||
); err != nil {
|
||||
logx.Errorf("数据库迁移失败: %v", err)
|
||||
}
|
||||
|
||||
return &ServiceContext{Config: c, DB: db}
|
||||
}
|
||||
|
||||
+180
-103
@@ -4,8 +4,29 @@ package plant;
|
||||
|
||||
option go_package = "./plant";
|
||||
|
||||
// ========== 通用 ==========
|
||||
|
||||
message CommonResp {
|
||||
int64 code = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
|
||||
message IdReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message IdsReq {
|
||||
repeated string ids = 1;
|
||||
}
|
||||
|
||||
message PageReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
}
|
||||
|
||||
// ========== 用户Profile ==========
|
||||
message UserProfile {
|
||||
|
||||
message PlantUserProfile {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string nickName = 3;
|
||||
@@ -23,22 +44,18 @@ message UserProfile {
|
||||
int64 photoCount = 15;
|
||||
}
|
||||
|
||||
message GetUserProfileReq { string userId = 1; }
|
||||
message GetUserProfileResp { UserProfile profile = 1; }
|
||||
message UpdateUserProfileReq {
|
||||
message GetProfileReq {
|
||||
string userId = 1;
|
||||
}
|
||||
|
||||
message UpdateProfileReq {
|
||||
string userId = 1;
|
||||
string nickName = 2;
|
||||
string avatarId = 3;
|
||||
}
|
||||
message UpdateUserProfileResp {}
|
||||
message IncrUserCounterReq {
|
||||
string userId = 1;
|
||||
string field = 2; // care_count, water_count, etc.
|
||||
int64 delta = 3;
|
||||
}
|
||||
message IncrUserCounterResp {}
|
||||
|
||||
// ========== 我的植物 ==========
|
||||
|
||||
message PlantInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
@@ -65,7 +82,6 @@ message CreatePlantReq {
|
||||
string plantingMaterial = 8;
|
||||
repeated string imgIds = 9;
|
||||
}
|
||||
message CreatePlantResp { string id = 1; }
|
||||
|
||||
message UpdatePlantReq {
|
||||
string id = 1;
|
||||
@@ -76,35 +92,36 @@ message UpdatePlantReq {
|
||||
string potSize = 6;
|
||||
string sunlight = 7;
|
||||
string plantingMaterial = 8;
|
||||
repeated string imgIds = 9;
|
||||
}
|
||||
message UpdatePlantResp {}
|
||||
|
||||
message DeletePlantReq { repeated string ids = 1; }
|
||||
message DeletePlantResp {}
|
||||
|
||||
message GetPlantListReq {
|
||||
message PlantListReq {
|
||||
string userId = 1;
|
||||
int32 current = 2;
|
||||
int32 pageSize = 3;
|
||||
string name = 4;
|
||||
}
|
||||
message GetPlantListResp {
|
||||
|
||||
message PlantListResp {
|
||||
repeated PlantInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetPlantDetailReq { string id = 1; }
|
||||
message GetPlantDetailResp { PlantInfo plant = 1; }
|
||||
message PlantDetailResp {
|
||||
PlantInfo plant = 1;
|
||||
repeated CarePlanInfo carePlans = 2;
|
||||
repeated GrowthRecordInfo growthRecords = 3;
|
||||
}
|
||||
|
||||
// ========== 养护计划 ==========
|
||||
|
||||
// ========== 养护 ==========
|
||||
message CarePlanInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string plantId = 3;
|
||||
string name = 4;
|
||||
string icon = 5;
|
||||
string targetAction = 6;
|
||||
int32 period = 7;
|
||||
string plantId = 2;
|
||||
string name = 3;
|
||||
string icon = 4;
|
||||
string targetAction = 5;
|
||||
int32 period = 6;
|
||||
}
|
||||
|
||||
message AddCarePlanReq {
|
||||
@@ -115,7 +132,8 @@ message AddCarePlanReq {
|
||||
string targetAction = 5;
|
||||
int32 period = 6;
|
||||
}
|
||||
message AddCarePlanResp { string id = 1; }
|
||||
|
||||
// ========== 养护记录 ==========
|
||||
|
||||
message AddCareRecordReq {
|
||||
string userId = 1;
|
||||
@@ -124,7 +142,15 @@ message AddCareRecordReq {
|
||||
string action = 4;
|
||||
string note = 5;
|
||||
}
|
||||
message AddCareRecordResp {}
|
||||
|
||||
// ========== 成长记录 ==========
|
||||
|
||||
message GrowthRecordInfo {
|
||||
string id = 1;
|
||||
string plantId = 2;
|
||||
string content = 3;
|
||||
int64 createdAt = 4;
|
||||
}
|
||||
|
||||
message AddGrowthRecordReq {
|
||||
string userId = 1;
|
||||
@@ -132,9 +158,9 @@ message AddGrowthRecordReq {
|
||||
string content = 3;
|
||||
repeated string imgIds = 4;
|
||||
}
|
||||
message AddGrowthRecordResp {}
|
||||
|
||||
// ========== 百科 ==========
|
||||
|
||||
message WikiInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
@@ -143,41 +169,52 @@ message WikiInfo {
|
||||
string genus = 5;
|
||||
int32 difficulty = 6;
|
||||
int32 isHot = 7;
|
||||
int64 createdAt = 8;
|
||||
string growthHabit = 8;
|
||||
string lightIntensity = 9;
|
||||
string optimalTempPeriod = 10;
|
||||
int64 createdAt = 11;
|
||||
}
|
||||
|
||||
message GetWikiListReq {
|
||||
message WikiListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string name = 3;
|
||||
string classId = 4;
|
||||
int32 isHot = 5;
|
||||
}
|
||||
message GetWikiListResp {
|
||||
|
||||
message WikiListResp {
|
||||
repeated WikiInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetWikiDetailReq { string id = 1; }
|
||||
message GetWikiDetailResp { WikiInfo wiki = 1; }
|
||||
message WikiDetailResp {
|
||||
WikiInfo wiki = 1;
|
||||
}
|
||||
|
||||
message WikiClassInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string ossId = 3;
|
||||
}
|
||||
message GetWikiClassListResp { repeated WikiClassInfo list = 1; }
|
||||
message CreateWikiClassReq { string name = 1; string ossId = 2; }
|
||||
message CreateWikiClassResp { string id = 1; }
|
||||
|
||||
message WikiClassListResp {
|
||||
repeated WikiClassInfo list = 1;
|
||||
}
|
||||
|
||||
message CreateWikiClassReq {
|
||||
string name = 1;
|
||||
string icon = 2;
|
||||
}
|
||||
|
||||
message ToggleStarReq {
|
||||
string userId = 1;
|
||||
string targetId = 2;
|
||||
string type = 3;
|
||||
}
|
||||
message ToggleStarResp { bool starred = 1; }
|
||||
|
||||
// ========== 社区 ==========
|
||||
// ========== 社区帖子 ==========
|
||||
|
||||
message PostInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
@@ -199,24 +236,32 @@ message CreatePostReq {
|
||||
repeated string imgIds = 5;
|
||||
string topicId = 6;
|
||||
}
|
||||
message CreatePostResp { string id = 1; }
|
||||
|
||||
message GetPostListReq {
|
||||
message PostListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string keyword = 3;
|
||||
string topicId = 4;
|
||||
string userId = 5;
|
||||
}
|
||||
message GetPostListResp {
|
||||
|
||||
message PostListResp {
|
||||
repeated PostInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetPostDetailReq { string id = 1; }
|
||||
message GetPostDetailResp { PostInfo post = 1; }
|
||||
message PostDetailResp {
|
||||
PostInfo post = 1;
|
||||
repeated PostCommentInfo comments = 2;
|
||||
}
|
||||
|
||||
message DeletePostReq { repeated string ids = 1; }
|
||||
message DeletePostResp {}
|
||||
message PostCommentInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string content = 3;
|
||||
string parentId = 4;
|
||||
int64 createdAt = 5;
|
||||
}
|
||||
|
||||
message CommentPostReq {
|
||||
string userId = 1;
|
||||
@@ -224,27 +269,58 @@ message CommentPostReq {
|
||||
string content = 3;
|
||||
string parentId = 4;
|
||||
}
|
||||
message CommentPostResp {}
|
||||
|
||||
message LikePostReq {
|
||||
string userId = 1;
|
||||
string postId = 2;
|
||||
}
|
||||
message LikePostResp { bool liked = 1; }
|
||||
|
||||
// ========== 话题 ==========
|
||||
|
||||
message TopicInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 postCount = 3;
|
||||
}
|
||||
message GetTopicListResp { repeated TopicInfo list = 1; }
|
||||
message CreateTopicReq { string name = 1; }
|
||||
message CreateTopicResp { string id = 1; }
|
||||
message DeleteTopicReq { repeated string ids = 1; }
|
||||
message DeleteTopicResp {}
|
||||
|
||||
message TopicListResp {
|
||||
repeated TopicInfo list = 1;
|
||||
}
|
||||
|
||||
message CreateTopicReq {
|
||||
string name = 1;
|
||||
string icon = 2;
|
||||
string desc = 3;
|
||||
}
|
||||
|
||||
// ========== 兑换商城 ==========
|
||||
|
||||
message ExchangeItemInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string desc = 3;
|
||||
string imgId = 4;
|
||||
int64 cost = 5;
|
||||
int32 stock = 6;
|
||||
}
|
||||
|
||||
message ExchangeItemListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
}
|
||||
|
||||
message ExchangeItemListResp {
|
||||
repeated ExchangeItemInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message CreateExchangeOrderReq {
|
||||
string userId = 1;
|
||||
string itemId = 2;
|
||||
}
|
||||
|
||||
// ========== 配置 ==========
|
||||
|
||||
message LevelConfigInfo {
|
||||
string id = 1;
|
||||
int32 level = 2;
|
||||
@@ -252,8 +328,10 @@ message LevelConfigInfo {
|
||||
int64 minSunlight = 4;
|
||||
string perks = 5;
|
||||
}
|
||||
message GetLevelConfigListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetLevelConfigListResp { repeated LevelConfigInfo list = 1; int64 total = 2; }
|
||||
|
||||
message LevelConfigListResp {
|
||||
repeated LevelConfigInfo list = 1;
|
||||
}
|
||||
|
||||
message BadgeConfigInfo {
|
||||
string id = 1;
|
||||
@@ -266,63 +344,62 @@ message BadgeConfigInfo {
|
||||
int64 threshold = 8;
|
||||
int64 rewardSunlight = 9;
|
||||
}
|
||||
message GetBadgeConfigListReq { int32 current = 1; int32 pageSize = 2; string dimension = 3; }
|
||||
message GetBadgeConfigListResp { repeated BadgeConfigInfo list = 1; int64 total = 2; }
|
||||
|
||||
// ========== 兑换 ==========
|
||||
message ExchangeItemInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string desc = 3;
|
||||
int64 cost = 4;
|
||||
int32 stock = 5;
|
||||
message BadgeConfigListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string dimension = 3;
|
||||
}
|
||||
message GetExchangeItemListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetExchangeItemListResp { repeated ExchangeItemInfo list = 1; int64 total = 2; }
|
||||
|
||||
message CreateExchangeOrderReq { string userId = 1; string itemId = 2; }
|
||||
message CreateExchangeOrderResp { string id = 1; }
|
||||
|
||||
// ========== 通用 ==========
|
||||
message Empty {}
|
||||
message BadgeConfigListResp {
|
||||
repeated BadgeConfigInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
// ========== 服务定义 ==========
|
||||
|
||||
service PlantService {
|
||||
// 用户Profile
|
||||
rpc GetUserProfile(GetUserProfileReq) returns (GetUserProfileResp);
|
||||
rpc UpdateUserProfile(UpdateUserProfileReq) returns (UpdateUserProfileResp);
|
||||
rpc IncrUserCounter(IncrUserCounterReq) returns (IncrUserCounterResp);
|
||||
// 植物
|
||||
rpc CreatePlant(CreatePlantReq) returns (CreatePlantResp);
|
||||
rpc UpdatePlant(UpdatePlantReq) returns (UpdatePlantResp);
|
||||
rpc DeletePlant(DeletePlantReq) returns (DeletePlantResp);
|
||||
rpc GetPlantList(GetPlantListReq) returns (GetPlantListResp);
|
||||
rpc GetPlantDetail(GetPlantDetailReq) returns (GetPlantDetailResp);
|
||||
rpc GetUserProfile(GetProfileReq) returns (PlantUserProfile);
|
||||
rpc UpdateUserProfile(UpdateProfileReq) returns (CommonResp);
|
||||
|
||||
// 我的植物
|
||||
rpc CreatePlant(CreatePlantReq) returns (CommonResp);
|
||||
rpc UpdatePlant(UpdatePlantReq) returns (CommonResp);
|
||||
rpc DeletePlant(IdsReq) returns (CommonResp);
|
||||
rpc GetPlantList(PlantListReq) returns (PlantListResp);
|
||||
rpc GetPlantDetail(IdReq) returns (PlantDetailResp);
|
||||
|
||||
// 养护
|
||||
rpc AddCarePlan(AddCarePlanReq) returns (AddCarePlanResp);
|
||||
rpc AddCareRecord(AddCareRecordReq) returns (AddCareRecordResp);
|
||||
rpc AddGrowthRecord(AddGrowthRecordReq) returns (AddGrowthRecordResp);
|
||||
rpc AddCarePlan(AddCarePlanReq) returns (CommonResp);
|
||||
rpc AddCareRecord(AddCareRecordReq) returns (CommonResp);
|
||||
rpc AddGrowthRecord(AddGrowthRecordReq) returns (CommonResp);
|
||||
|
||||
// 百科
|
||||
rpc GetWikiList(GetWikiListReq) returns (GetWikiListResp);
|
||||
rpc GetWikiDetail(GetWikiDetailReq) returns (GetWikiDetailResp);
|
||||
rpc GetWikiClassList(Empty) returns (GetWikiClassListResp);
|
||||
rpc CreateWikiClass(CreateWikiClassReq) returns (CreateWikiClassResp);
|
||||
rpc ToggleStar(ToggleStarReq) returns (ToggleStarResp);
|
||||
rpc GetWikiList(WikiListReq) returns (WikiListResp);
|
||||
rpc GetWikiDetail(IdReq) returns (WikiDetailResp);
|
||||
rpc GetWikiClassList(IdReq) returns (WikiClassListResp);
|
||||
rpc CreateWikiClass(CreateWikiClassReq) returns (CommonResp);
|
||||
rpc ToggleWikiStar(ToggleStarReq) returns (CommonResp);
|
||||
|
||||
// 社区
|
||||
rpc CreatePost(CreatePostReq) returns (CreatePostResp);
|
||||
rpc GetPostList(GetPostListReq) returns (GetPostListResp);
|
||||
rpc GetPostDetail(GetPostDetailReq) returns (GetPostDetailResp);
|
||||
rpc DeletePost(DeletePostReq) returns (DeletePostResp);
|
||||
rpc CommentPost(CommentPostReq) returns (CommentPostResp);
|
||||
rpc LikePost(LikePostReq) returns (LikePostResp);
|
||||
rpc CreatePost(CreatePostReq) returns (CommonResp);
|
||||
rpc DeletePost(IdsReq) returns (CommonResp);
|
||||
rpc GetPostList(PostListReq) returns (PostListResp);
|
||||
rpc GetPostDetail(IdReq) returns (PostDetailResp);
|
||||
rpc CommentPost(CommentPostReq) returns (CommonResp);
|
||||
rpc LikePost(LikePostReq) returns (CommonResp);
|
||||
|
||||
// 话题
|
||||
rpc GetTopicList(Empty) returns (GetTopicListResp);
|
||||
rpc CreateTopic(CreateTopicReq) returns (CreateTopicResp);
|
||||
rpc DeleteTopic(DeleteTopicReq) returns (DeleteTopicResp);
|
||||
// 配置
|
||||
rpc GetLevelConfigList(GetLevelConfigListReq) returns (GetLevelConfigListResp);
|
||||
rpc GetBadgeConfigList(GetBadgeConfigListReq) returns (GetBadgeConfigListResp);
|
||||
rpc GetTopicList(IdReq) returns (TopicListResp);
|
||||
rpc CreateTopic(CreateTopicReq) returns (CommonResp);
|
||||
rpc DeleteTopic(IdsReq) returns (CommonResp);
|
||||
|
||||
// 兑换
|
||||
rpc GetExchangeItemList(GetExchangeItemListReq) returns (GetExchangeItemListResp);
|
||||
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CreateExchangeOrderResp);
|
||||
rpc GetExchangeItemList(ExchangeItemListReq) returns (ExchangeItemListResp);
|
||||
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CommonResp);
|
||||
|
||||
// 配置
|
||||
rpc GetLevelConfigList(PageReq) returns (LevelConfigListResp);
|
||||
rpc GetBadgeConfigList(BadgeConfigListReq) returns (BadgeConfigListResp);
|
||||
}
|
||||
|
||||
+1062
-1833
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -15,111 +15,89 @@ import (
|
||||
|
||||
type (
|
||||
AddCarePlanReq = plant.AddCarePlanReq
|
||||
AddCarePlanResp = plant.AddCarePlanResp
|
||||
AddCareRecordReq = plant.AddCareRecordReq
|
||||
AddCareRecordResp = plant.AddCareRecordResp
|
||||
AddGrowthRecordReq = plant.AddGrowthRecordReq
|
||||
AddGrowthRecordResp = plant.AddGrowthRecordResp
|
||||
BadgeConfigInfo = plant.BadgeConfigInfo
|
||||
BadgeConfigListReq = plant.BadgeConfigListReq
|
||||
BadgeConfigListResp = plant.BadgeConfigListResp
|
||||
CarePlanInfo = plant.CarePlanInfo
|
||||
CommentPostReq = plant.CommentPostReq
|
||||
CommentPostResp = plant.CommentPostResp
|
||||
CommonResp = plant.CommonResp
|
||||
CreateExchangeOrderReq = plant.CreateExchangeOrderReq
|
||||
CreateExchangeOrderResp = plant.CreateExchangeOrderResp
|
||||
CreatePlantReq = plant.CreatePlantReq
|
||||
CreatePlantResp = plant.CreatePlantResp
|
||||
CreatePostReq = plant.CreatePostReq
|
||||
CreatePostResp = plant.CreatePostResp
|
||||
CreateTopicReq = plant.CreateTopicReq
|
||||
CreateTopicResp = plant.CreateTopicResp
|
||||
CreateWikiClassReq = plant.CreateWikiClassReq
|
||||
CreateWikiClassResp = plant.CreateWikiClassResp
|
||||
DeletePlantReq = plant.DeletePlantReq
|
||||
DeletePlantResp = plant.DeletePlantResp
|
||||
DeletePostReq = plant.DeletePostReq
|
||||
DeletePostResp = plant.DeletePostResp
|
||||
DeleteTopicReq = plant.DeleteTopicReq
|
||||
DeleteTopicResp = plant.DeleteTopicResp
|
||||
Empty = plant.Empty
|
||||
ExchangeItemInfo = plant.ExchangeItemInfo
|
||||
GetBadgeConfigListReq = plant.GetBadgeConfigListReq
|
||||
GetBadgeConfigListResp = plant.GetBadgeConfigListResp
|
||||
GetExchangeItemListReq = plant.GetExchangeItemListReq
|
||||
GetExchangeItemListResp = plant.GetExchangeItemListResp
|
||||
GetLevelConfigListReq = plant.GetLevelConfigListReq
|
||||
GetLevelConfigListResp = plant.GetLevelConfigListResp
|
||||
GetPlantDetailReq = plant.GetPlantDetailReq
|
||||
GetPlantDetailResp = plant.GetPlantDetailResp
|
||||
GetPlantListReq = plant.GetPlantListReq
|
||||
GetPlantListResp = plant.GetPlantListResp
|
||||
GetPostDetailReq = plant.GetPostDetailReq
|
||||
GetPostDetailResp = plant.GetPostDetailResp
|
||||
GetPostListReq = plant.GetPostListReq
|
||||
GetPostListResp = plant.GetPostListResp
|
||||
GetTopicListResp = plant.GetTopicListResp
|
||||
GetUserProfileReq = plant.GetUserProfileReq
|
||||
GetUserProfileResp = plant.GetUserProfileResp
|
||||
GetWikiClassListResp = plant.GetWikiClassListResp
|
||||
GetWikiDetailReq = plant.GetWikiDetailReq
|
||||
GetWikiDetailResp = plant.GetWikiDetailResp
|
||||
GetWikiListReq = plant.GetWikiListReq
|
||||
GetWikiListResp = plant.GetWikiListResp
|
||||
IncrUserCounterReq = plant.IncrUserCounterReq
|
||||
IncrUserCounterResp = plant.IncrUserCounterResp
|
||||
ExchangeItemListReq = plant.ExchangeItemListReq
|
||||
ExchangeItemListResp = plant.ExchangeItemListResp
|
||||
GetProfileReq = plant.GetProfileReq
|
||||
GrowthRecordInfo = plant.GrowthRecordInfo
|
||||
IdReq = plant.IdReq
|
||||
IdsReq = plant.IdsReq
|
||||
LevelConfigInfo = plant.LevelConfigInfo
|
||||
LevelConfigListResp = plant.LevelConfigListResp
|
||||
LikePostReq = plant.LikePostReq
|
||||
LikePostResp = plant.LikePostResp
|
||||
PageReq = plant.PageReq
|
||||
PlantDetailResp = plant.PlantDetailResp
|
||||
PlantInfo = plant.PlantInfo
|
||||
PlantListReq = plant.PlantListReq
|
||||
PlantListResp = plant.PlantListResp
|
||||
PlantUserProfile = plant.PlantUserProfile
|
||||
PostCommentInfo = plant.PostCommentInfo
|
||||
PostDetailResp = plant.PostDetailResp
|
||||
PostInfo = plant.PostInfo
|
||||
PostListReq = plant.PostListReq
|
||||
PostListResp = plant.PostListResp
|
||||
ToggleStarReq = plant.ToggleStarReq
|
||||
ToggleStarResp = plant.ToggleStarResp
|
||||
TopicInfo = plant.TopicInfo
|
||||
TopicListResp = plant.TopicListResp
|
||||
UpdatePlantReq = plant.UpdatePlantReq
|
||||
UpdatePlantResp = plant.UpdatePlantResp
|
||||
UpdateUserProfileReq = plant.UpdateUserProfileReq
|
||||
UpdateUserProfileResp = plant.UpdateUserProfileResp
|
||||
UserProfile = plant.UserProfile
|
||||
UpdateProfileReq = plant.UpdateProfileReq
|
||||
WikiClassInfo = plant.WikiClassInfo
|
||||
WikiClassListResp = plant.WikiClassListResp
|
||||
WikiDetailResp = plant.WikiDetailResp
|
||||
WikiInfo = plant.WikiInfo
|
||||
WikiListReq = plant.WikiListReq
|
||||
WikiListResp = plant.WikiListResp
|
||||
|
||||
PlantService interface {
|
||||
// 用户Profile
|
||||
GetUserProfile(ctx context.Context, in *GetUserProfileReq, opts ...grpc.CallOption) (*GetUserProfileResp, error)
|
||||
UpdateUserProfile(ctx context.Context, in *UpdateUserProfileReq, opts ...grpc.CallOption) (*UpdateUserProfileResp, error)
|
||||
IncrUserCounter(ctx context.Context, in *IncrUserCounterReq, opts ...grpc.CallOption) (*IncrUserCounterResp, error)
|
||||
// 植物
|
||||
CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CreatePlantResp, error)
|
||||
UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*UpdatePlantResp, error)
|
||||
DeletePlant(ctx context.Context, in *DeletePlantReq, opts ...grpc.CallOption) (*DeletePlantResp, error)
|
||||
GetPlantList(ctx context.Context, in *GetPlantListReq, opts ...grpc.CallOption) (*GetPlantListResp, error)
|
||||
GetPlantDetail(ctx context.Context, in *GetPlantDetailReq, opts ...grpc.CallOption) (*GetPlantDetailResp, error)
|
||||
GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*PlantUserProfile, error)
|
||||
UpdateUserProfile(ctx context.Context, in *UpdateProfileReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
// 我的植物
|
||||
CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeletePlant(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetPlantList(ctx context.Context, in *PlantListReq, opts ...grpc.CallOption) (*PlantListResp, error)
|
||||
GetPlantDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PlantDetailResp, error)
|
||||
// 养护
|
||||
AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*AddCarePlanResp, error)
|
||||
AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*AddCareRecordResp, error)
|
||||
AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*AddGrowthRecordResp, error)
|
||||
AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
// 百科
|
||||
GetWikiList(ctx context.Context, in *GetWikiListReq, opts ...grpc.CallOption) (*GetWikiListResp, error)
|
||||
GetWikiDetail(ctx context.Context, in *GetWikiDetailReq, opts ...grpc.CallOption) (*GetWikiDetailResp, error)
|
||||
GetWikiClassList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetWikiClassListResp, error)
|
||||
CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CreateWikiClassResp, error)
|
||||
ToggleStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*ToggleStarResp, error)
|
||||
GetWikiList(ctx context.Context, in *WikiListReq, opts ...grpc.CallOption) (*WikiListResp, error)
|
||||
GetWikiDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiDetailResp, error)
|
||||
GetWikiClassList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiClassListResp, error)
|
||||
CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
ToggleWikiStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
// 社区
|
||||
CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CreatePostResp, error)
|
||||
GetPostList(ctx context.Context, in *GetPostListReq, opts ...grpc.CallOption) (*GetPostListResp, error)
|
||||
GetPostDetail(ctx context.Context, in *GetPostDetailReq, opts ...grpc.CallOption) (*GetPostDetailResp, error)
|
||||
DeletePost(ctx context.Context, in *DeletePostReq, opts ...grpc.CallOption) (*DeletePostResp, error)
|
||||
CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommentPostResp, error)
|
||||
LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*LikePostResp, error)
|
||||
CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeletePost(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetPostList(ctx context.Context, in *PostListReq, opts ...grpc.CallOption) (*PostListResp, error)
|
||||
GetPostDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PostDetailResp, error)
|
||||
CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
// 话题
|
||||
GetTopicList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetTopicListResp, error)
|
||||
CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CreateTopicResp, error)
|
||||
DeleteTopic(ctx context.Context, in *DeleteTopicReq, opts ...grpc.CallOption) (*DeleteTopicResp, error)
|
||||
// 配置
|
||||
GetLevelConfigList(ctx context.Context, in *GetLevelConfigListReq, opts ...grpc.CallOption) (*GetLevelConfigListResp, error)
|
||||
GetBadgeConfigList(ctx context.Context, in *GetBadgeConfigListReq, opts ...grpc.CallOption) (*GetBadgeConfigListResp, error)
|
||||
GetTopicList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*TopicListResp, error)
|
||||
CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeleteTopic(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
// 兑换
|
||||
GetExchangeItemList(ctx context.Context, in *GetExchangeItemListReq, opts ...grpc.CallOption) (*GetExchangeItemListResp, error)
|
||||
CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CreateExchangeOrderResp, error)
|
||||
GetExchangeItemList(ctx context.Context, in *ExchangeItemListReq, opts ...grpc.CallOption) (*ExchangeItemListResp, error)
|
||||
CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
// 配置
|
||||
GetLevelConfigList(ctx context.Context, in *PageReq, opts ...grpc.CallOption) (*LevelConfigListResp, error)
|
||||
GetBadgeConfigList(ctx context.Context, in *BadgeConfigListReq, opts ...grpc.CallOption) (*BadgeConfigListResp, error)
|
||||
}
|
||||
|
||||
defaultPlantService struct {
|
||||
@@ -134,154 +112,149 @@ func NewPlantService(cli zrpc.Client) PlantService {
|
||||
}
|
||||
|
||||
// 用户Profile
|
||||
func (m *defaultPlantService) GetUserProfile(ctx context.Context, in *GetUserProfileReq, opts ...grpc.CallOption) (*GetUserProfileResp, error) {
|
||||
func (m *defaultPlantService) GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*PlantUserProfile, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetUserProfile(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) UpdateUserProfile(ctx context.Context, in *UpdateUserProfileReq, opts ...grpc.CallOption) (*UpdateUserProfileResp, error) {
|
||||
func (m *defaultPlantService) UpdateUserProfile(ctx context.Context, in *UpdateProfileReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.UpdateUserProfile(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) IncrUserCounter(ctx context.Context, in *IncrUserCounterReq, opts ...grpc.CallOption) (*IncrUserCounterResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.IncrUserCounter(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 植物
|
||||
func (m *defaultPlantService) CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CreatePlantResp, error) {
|
||||
// 我的植物
|
||||
func (m *defaultPlantService) CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.CreatePlant(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*UpdatePlantResp, error) {
|
||||
func (m *defaultPlantService) UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.UpdatePlant(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) DeletePlant(ctx context.Context, in *DeletePlantReq, opts ...grpc.CallOption) (*DeletePlantResp, error) {
|
||||
func (m *defaultPlantService) DeletePlant(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.DeletePlant(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetPlantList(ctx context.Context, in *GetPlantListReq, opts ...grpc.CallOption) (*GetPlantListResp, error) {
|
||||
func (m *defaultPlantService) GetPlantList(ctx context.Context, in *PlantListReq, opts ...grpc.CallOption) (*PlantListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetPlantList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetPlantDetail(ctx context.Context, in *GetPlantDetailReq, opts ...grpc.CallOption) (*GetPlantDetailResp, error) {
|
||||
func (m *defaultPlantService) GetPlantDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PlantDetailResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetPlantDetail(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 养护
|
||||
func (m *defaultPlantService) AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*AddCarePlanResp, error) {
|
||||
func (m *defaultPlantService) AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.AddCarePlan(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*AddCareRecordResp, error) {
|
||||
func (m *defaultPlantService) AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.AddCareRecord(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*AddGrowthRecordResp, error) {
|
||||
func (m *defaultPlantService) AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.AddGrowthRecord(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 百科
|
||||
func (m *defaultPlantService) GetWikiList(ctx context.Context, in *GetWikiListReq, opts ...grpc.CallOption) (*GetWikiListResp, error) {
|
||||
func (m *defaultPlantService) GetWikiList(ctx context.Context, in *WikiListReq, opts ...grpc.CallOption) (*WikiListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetWikiList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetWikiDetail(ctx context.Context, in *GetWikiDetailReq, opts ...grpc.CallOption) (*GetWikiDetailResp, error) {
|
||||
func (m *defaultPlantService) GetWikiDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiDetailResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetWikiDetail(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetWikiClassList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetWikiClassListResp, error) {
|
||||
func (m *defaultPlantService) GetWikiClassList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiClassListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetWikiClassList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CreateWikiClassResp, error) {
|
||||
func (m *defaultPlantService) CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.CreateWikiClass(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) ToggleStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*ToggleStarResp, error) {
|
||||
func (m *defaultPlantService) ToggleWikiStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.ToggleStar(ctx, in, opts...)
|
||||
return client.ToggleWikiStar(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 社区
|
||||
func (m *defaultPlantService) CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CreatePostResp, error) {
|
||||
func (m *defaultPlantService) CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.CreatePost(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetPostList(ctx context.Context, in *GetPostListReq, opts ...grpc.CallOption) (*GetPostListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetPostList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetPostDetail(ctx context.Context, in *GetPostDetailReq, opts ...grpc.CallOption) (*GetPostDetailResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetPostDetail(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) DeletePost(ctx context.Context, in *DeletePostReq, opts ...grpc.CallOption) (*DeletePostResp, error) {
|
||||
func (m *defaultPlantService) DeletePost(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.DeletePost(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommentPostResp, error) {
|
||||
func (m *defaultPlantService) GetPostList(ctx context.Context, in *PostListReq, opts ...grpc.CallOption) (*PostListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetPostList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetPostDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PostDetailResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetPostDetail(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.CommentPost(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*LikePostResp, error) {
|
||||
func (m *defaultPlantService) LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.LikePost(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 话题
|
||||
func (m *defaultPlantService) GetTopicList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetTopicListResp, error) {
|
||||
func (m *defaultPlantService) GetTopicList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*TopicListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetTopicList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CreateTopicResp, error) {
|
||||
func (m *defaultPlantService) CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.CreateTopic(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) DeleteTopic(ctx context.Context, in *DeleteTopicReq, opts ...grpc.CallOption) (*DeleteTopicResp, error) {
|
||||
func (m *defaultPlantService) DeleteTopic(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.DeleteTopic(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 配置
|
||||
func (m *defaultPlantService) GetLevelConfigList(ctx context.Context, in *GetLevelConfigListReq, opts ...grpc.CallOption) (*GetLevelConfigListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetLevelConfigList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetBadgeConfigList(ctx context.Context, in *GetBadgeConfigListReq, opts ...grpc.CallOption) (*GetBadgeConfigListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetBadgeConfigList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 兑换
|
||||
func (m *defaultPlantService) GetExchangeItemList(ctx context.Context, in *GetExchangeItemListReq, opts ...grpc.CallOption) (*GetExchangeItemListResp, error) {
|
||||
func (m *defaultPlantService) GetExchangeItemList(ctx context.Context, in *ExchangeItemListReq, opts ...grpc.CallOption) (*ExchangeItemListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetExchangeItemList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CreateExchangeOrderResp, error) {
|
||||
func (m *defaultPlantService) CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.CreateExchangeOrder(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 配置
|
||||
func (m *defaultPlantService) GetLevelConfigList(ctx context.Context, in *PageReq, opts ...grpc.CallOption) (*LevelConfigListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetLevelConfigList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultPlantService) GetBadgeConfigList(ctx context.Context, in *BadgeConfigListReq, opts ...grpc.CallOption) (*BadgeConfigListResp, error) {
|
||||
client := plant.NewPlantServiceClient(m.cli.Conn())
|
||||
return client.GetBadgeConfigList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
Name: radio-api
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
Host: 0.0.0.0
|
||||
Port: 9005
|
||||
|
||||
Auth:
|
||||
AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872
|
||||
AccessExpire: 7200
|
||||
AccessSecret: sundynix-jwt-secret-2024
|
||||
AccessExpire: 604800
|
||||
|
||||
# MySQL
|
||||
DB:
|
||||
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
|
||||
RadioRpc:
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 192.168.100.127:2379
|
||||
Key: radio.rpc
|
||||
|
||||
# Redis
|
||||
Cache:
|
||||
- Host: 127.0.0.1:6379
|
||||
Pass: sundynix
|
||||
Type: node
|
||||
|
||||
# RPC 依赖
|
||||
UserRpc:
|
||||
Etcd:
|
||||
Hosts:
|
||||
@@ -28,18 +26,3 @@ FileRpc:
|
||||
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"
|
||||
|
||||
@@ -14,27 +14,7 @@ type Config struct {
|
||||
AccessSecret string
|
||||
AccessExpire int64
|
||||
}
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
Cache []struct {
|
||||
Host string
|
||||
Pass string
|
||||
Type string
|
||||
}
|
||||
RadioRpc zrpc.RpcClientConf
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,52 +6,23 @@ 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/radio/rpc/radioservice"
|
||||
"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
|
||||
RadioRpc radioservice.RadioService
|
||||
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,
|
||||
RadioRpc: radioservice.NewRadioService(zrpc.MustNewClient(c.RadioRpc)),
|
||||
UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)),
|
||||
FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
Name: radio.rpc
|
||||
ListenOn: 0.0.0.0:8080
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
ListenOn: 0.0.0.0:9015
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 127.0.0.1:2379
|
||||
- 192.168.100.127:2379
|
||||
Key: radio.rpc
|
||||
|
||||
DB:
|
||||
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
|
||||
|
||||
@@ -4,4 +4,7 @@ import "github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewCommentProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Co
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CommentProgramLogic) CommentProgram(in *radio.CommentReq) (*radio.CommentResp, error) {
|
||||
func (l *CommentProgramLogic) CommentProgram(in *radio.CommentReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.CommentResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cr
|
||||
}
|
||||
|
||||
// 分类
|
||||
func (l *CreateCategoryLogic) CreateCategory(in *radio.CreateCategoryReq) (*radio.CreateCategoryResp, error) {
|
||||
func (l *CreateCategoryLogic) CreateCategory(in *radio.CategoryReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.CreateCategoryResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewCreateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cre
|
||||
}
|
||||
|
||||
// 频道
|
||||
func (l *CreateChannelLogic) CreateChannel(in *radio.CreateChannelReq) (*radio.CreateChannelResp, error) {
|
||||
func (l *CreateChannelLogic) CreateChannel(in *radio.CreateChannelReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.CreateChannelResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewCreateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cre
|
||||
}
|
||||
|
||||
// 节目
|
||||
func (l *CreateProgramLogic) CreateProgram(in *radio.CreateProgramReq) (*radio.CreateProgramResp, error) {
|
||||
func (l *CreateProgramLogic) CreateProgram(in *radio.CreateProgramReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.CreateProgramResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewCreateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
|
||||
}
|
||||
|
||||
// 音色
|
||||
func (l *CreateVoiceLogic) CreateVoice(in *radio.CreateVoiceReq) (*radio.CreateVoiceResp, error) {
|
||||
func (l *CreateVoiceLogic) CreateVoice(in *radio.CreateVoiceReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.CreateVoiceResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *De
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteCategoryLogic) DeleteCategory(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (l *DeleteCategoryLogic) DeleteCategory(in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.DeleteResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewDeleteChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteChannelLogic) DeleteChannel(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (l *DeleteChannelLogic) DeleteChannel(in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.DeleteResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewDeleteProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteProgramLogic) DeleteProgram(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (l *DeleteProgramLogic) DeleteProgram(in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.DeleteResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewDeleteVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteVoiceLogic) DeleteVoice(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (l *DeleteVoiceLogic) DeleteVoice(in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.DeleteResp{}, nil
|
||||
return &radio.CommonResp{}, 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 GetAnalyticsOverviewLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetAnalyticsOverviewLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAnalyticsOverviewLogic {
|
||||
return &GetAnalyticsOverviewLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 数据分析
|
||||
func (l *GetAnalyticsOverviewLogic) GetAnalyticsOverview(in *radio.AnalyticsReq) (*radio.AnalyticsOverviewResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.AnalyticsOverviewResp{}, nil
|
||||
}
|
||||
@@ -23,8 +23,8 @@ func NewGetCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *G
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetCategoryListLogic) GetCategoryList(in *radio.GetCategoryListReq) (*radio.GetCategoryListResp, error) {
|
||||
func (l *GetCategoryListLogic) GetCategoryList(in *radio.CategoryListReq) (*radio.CategoryListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetCategoryListResp{}, nil
|
||||
return &radio.CategoryListResp{}, 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 GetChannelAnalyticsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetChannelAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelAnalyticsLogic {
|
||||
return &GetChannelAnalyticsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetChannelAnalyticsLogic) GetChannelAnalytics(in *radio.AnalyticsReq) (*radio.ChannelAnalyticsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.ChannelAnalyticsResp{}, nil
|
||||
}
|
||||
@@ -23,8 +23,8 @@ func NewGetChannelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetChannelDetailLogic) GetChannelDetail(in *radio.GetChannelDetailReq) (*radio.GetChannelDetailResp, error) {
|
||||
func (l *GetChannelDetailLogic) GetChannelDetail(in *radio.IdReq) (*radio.ChannelInfo, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetChannelDetailResp{}, nil
|
||||
return &radio.ChannelInfo{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetChannelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetChannelListLogic) GetChannelList(in *radio.GetChannelListReq) (*radio.GetChannelListResp, error) {
|
||||
func (l *GetChannelListLogic) GetChannelList(in *radio.ChannelListReq) (*radio.ChannelListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetChannelListResp{}, nil
|
||||
return &radio.ChannelListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetFavoriteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *G
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetFavoriteListLogic) GetFavoriteList(in *radio.GetFavoriteListReq) (*radio.GetFavoriteListResp, error) {
|
||||
func (l *GetFavoriteListLogic) GetFavoriteList(in *radio.InteractionListReq) (*radio.FavoriteListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetFavoriteListResp{}, nil
|
||||
return &radio.FavoriteListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetHistoryListLogic) GetHistoryList(in *radio.GetHistoryListReq) (*radio.GetHistoryListResp, error) {
|
||||
func (l *GetHistoryListLogic) GetHistoryList(in *radio.InteractionListReq) (*radio.HistoryListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetHistoryListResp{}, nil
|
||||
return &radio.HistoryListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ func NewGetMySubscriptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
}
|
||||
|
||||
// 订阅
|
||||
func (l *GetMySubscriptionsLogic) GetMySubscriptions(in *radio.GetMySubscriptionsReq) (*radio.GetMySubscriptionsResp, error) {
|
||||
// 订阅/VIP
|
||||
func (l *GetMySubscriptionsLogic) GetMySubscriptions(in *radio.SubscriptionListReq) (*radio.SubscriptionListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetMySubscriptionsResp{}, nil
|
||||
return &radio.SubscriptionListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetMyVipInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetM
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetMyVipInfoLogic) GetMyVipInfo(in *radio.GetMyVipInfoReq) (*radio.GetMyVipInfoResp, error) {
|
||||
func (l *GetMyVipInfoLogic) GetMyVipInfo(in *radio.GetProfileReq) (*radio.RadioUserProfile, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetMyVipInfoResp{}, nil
|
||||
return &radio.RadioUserProfile{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetProgramDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetProgramDetailLogic) GetProgramDetail(in *radio.GetProgramDetailReq) (*radio.GetProgramDetailResp, error) {
|
||||
func (l *GetProgramDetailLogic) GetProgramDetail(in *radio.IdReq) (*radio.ProgramInfo, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetProgramDetailResp{}, nil
|
||||
return &radio.ProgramInfo{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetProgramListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetProgramListLogic) GetProgramList(in *radio.GetProgramListReq) (*radio.GetProgramListResp, error) {
|
||||
func (l *GetProgramListLogic) GetProgramList(in *radio.ProgramListReq) (*radio.ProgramListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetProgramListResp{}, nil
|
||||
return &radio.ProgramListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
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,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 GetUserAnalyticsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetUserAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserAnalyticsLogic {
|
||||
return &GetUserAnalyticsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetUserAnalyticsLogic) GetUserAnalytics(in *radio.AnalyticsReq) (*radio.UserAnalyticsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.UserAnalyticsResp{}, 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 GetUserProfileLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserProfileLogic {
|
||||
return &GetUserProfileLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 用户Profile
|
||||
func (l *GetUserProfileLogic) GetUserProfile(in *radio.GetProfileReq) (*radio.RadioUserProfile, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.RadioUserProfile{}, nil
|
||||
}
|
||||
@@ -23,9 +23,8 @@ func NewGetVipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||
}
|
||||
}
|
||||
|
||||
// VIP
|
||||
func (l *GetVipConfigListLogic) GetVipConfigList(in *radio.GetVipConfigListReq) (*radio.GetVipConfigListResp, error) {
|
||||
func (l *GetVipConfigListLogic) GetVipConfigList(in *radio.IdReq) (*radio.VipConfigListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetVipConfigListResp{}, nil
|
||||
return &radio.VipConfigListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewGetVoiceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetV
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetVoiceListLogic) GetVoiceList(in *radio.GetVoiceListReq) (*radio.GetVoiceListResp, error) {
|
||||
func (l *GetVoiceListLogic) GetVoiceList(in *radio.VoiceListReq) (*radio.VoiceListResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.GetVoiceListResp{}, nil
|
||||
return &radio.VoiceListResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewRecordHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Rec
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RecordHistoryLogic) RecordHistory(in *radio.RecordHistoryReq) (*radio.RecordHistoryResp, error) {
|
||||
func (l *RecordHistoryLogic) RecordHistory(in *radio.RecordHistoryReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.RecordHistoryResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewToggleFavoriteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *To
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ToggleFavoriteLogic) ToggleFavorite(in *radio.ToggleFavoriteReq) (*radio.ToggleFavoriteResp, error) {
|
||||
func (l *ToggleFavoriteLogic) ToggleFavorite(in *radio.ToggleFavoriteReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.ToggleFavoriteResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewToggleLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Toggle
|
||||
}
|
||||
|
||||
// 互动
|
||||
func (l *ToggleLikeLogic) ToggleLike(in *radio.ToggleLikeReq) (*radio.ToggleLikeResp, error) {
|
||||
func (l *ToggleLikeLogic) ToggleLike(in *radio.ToggleLikeReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.ToggleLikeResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewUpdateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Up
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateCategoryLogic) UpdateCategory(in *radio.UpdateCategoryReq) (*radio.UpdateCategoryResp, error) {
|
||||
func (l *UpdateCategoryLogic) UpdateCategory(in *radio.CategoryUpdateReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.UpdateCategoryResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewUpdateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Upd
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateChannelLogic) UpdateChannel(in *radio.UpdateChannelReq) (*radio.UpdateChannelResp, error) {
|
||||
func (l *UpdateChannelLogic) UpdateChannel(in *radio.UpdateChannelReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.UpdateChannelResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewUpdateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Upd
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateProgramLogic) UpdateProgram(in *radio.UpdateProgramReq) (*radio.UpdateProgramResp, error) {
|
||||
func (l *UpdateProgramLogic) UpdateProgram(in *radio.UpdateProgramReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.UpdateProgramResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ func NewUpdateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Updat
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateVoiceLogic) UpdateVoice(in *radio.UpdateVoiceReq) (*radio.UpdateVoiceResp, error) {
|
||||
func (l *UpdateVoiceLogic) UpdateVoice(in *radio.UpdateVoiceReq) (*radio.CommonResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &radio.UpdateVoiceResp{}, nil
|
||||
return &radio.CommonResp{}, nil
|
||||
}
|
||||
|
||||
@@ -23,139 +23,139 @@ func NewRadioServiceServer(svcCtx *svc.ServiceContext) *RadioServiceServer {
|
||||
}
|
||||
}
|
||||
|
||||
// 用户
|
||||
func (s *RadioServiceServer) GetRadioUserProfile(ctx context.Context, in *radio.GetRadioUserProfileReq) (*radio.GetRadioUserProfileResp, error) {
|
||||
l := logic.NewGetRadioUserProfileLogic(ctx, s.svcCtx)
|
||||
return l.GetRadioUserProfile(in)
|
||||
// 用户Profile
|
||||
func (s *RadioServiceServer) GetUserProfile(ctx context.Context, in *radio.GetProfileReq) (*radio.RadioUserProfile, error) {
|
||||
l := logic.NewGetUserProfileLogic(ctx, s.svcCtx)
|
||||
return l.GetUserProfile(in)
|
||||
}
|
||||
|
||||
// 分类
|
||||
func (s *RadioServiceServer) CreateCategory(ctx context.Context, in *radio.CreateCategoryReq) (*radio.CreateCategoryResp, error) {
|
||||
func (s *RadioServiceServer) CreateCategory(ctx context.Context, in *radio.CategoryReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewCreateCategoryLogic(ctx, s.svcCtx)
|
||||
return l.CreateCategory(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) UpdateCategory(ctx context.Context, in *radio.UpdateCategoryReq) (*radio.UpdateCategoryResp, error) {
|
||||
func (s *RadioServiceServer) UpdateCategory(ctx context.Context, in *radio.CategoryUpdateReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewUpdateCategoryLogic(ctx, s.svcCtx)
|
||||
return l.UpdateCategory(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) DeleteCategory(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (s *RadioServiceServer) DeleteCategory(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewDeleteCategoryLogic(ctx, s.svcCtx)
|
||||
return l.DeleteCategory(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetCategoryList(ctx context.Context, in *radio.GetCategoryListReq) (*radio.GetCategoryListResp, error) {
|
||||
func (s *RadioServiceServer) GetCategoryList(ctx context.Context, in *radio.CategoryListReq) (*radio.CategoryListResp, error) {
|
||||
l := logic.NewGetCategoryListLogic(ctx, s.svcCtx)
|
||||
return l.GetCategoryList(in)
|
||||
}
|
||||
|
||||
// 频道
|
||||
func (s *RadioServiceServer) CreateChannel(ctx context.Context, in *radio.CreateChannelReq) (*radio.CreateChannelResp, error) {
|
||||
func (s *RadioServiceServer) CreateChannel(ctx context.Context, in *radio.CreateChannelReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewCreateChannelLogic(ctx, s.svcCtx)
|
||||
return l.CreateChannel(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) UpdateChannel(ctx context.Context, in *radio.UpdateChannelReq) (*radio.UpdateChannelResp, error) {
|
||||
func (s *RadioServiceServer) UpdateChannel(ctx context.Context, in *radio.UpdateChannelReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewUpdateChannelLogic(ctx, s.svcCtx)
|
||||
return l.UpdateChannel(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) DeleteChannel(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (s *RadioServiceServer) DeleteChannel(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewDeleteChannelLogic(ctx, s.svcCtx)
|
||||
return l.DeleteChannel(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetChannelList(ctx context.Context, in *radio.GetChannelListReq) (*radio.GetChannelListResp, error) {
|
||||
func (s *RadioServiceServer) GetChannelList(ctx context.Context, in *radio.ChannelListReq) (*radio.ChannelListResp, error) {
|
||||
l := logic.NewGetChannelListLogic(ctx, s.svcCtx)
|
||||
return l.GetChannelList(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetChannelDetail(ctx context.Context, in *radio.GetChannelDetailReq) (*radio.GetChannelDetailResp, error) {
|
||||
func (s *RadioServiceServer) GetChannelDetail(ctx context.Context, in *radio.IdReq) (*radio.ChannelInfo, error) {
|
||||
l := logic.NewGetChannelDetailLogic(ctx, s.svcCtx)
|
||||
return l.GetChannelDetail(in)
|
||||
}
|
||||
|
||||
// 节目
|
||||
func (s *RadioServiceServer) CreateProgram(ctx context.Context, in *radio.CreateProgramReq) (*radio.CreateProgramResp, error) {
|
||||
func (s *RadioServiceServer) CreateProgram(ctx context.Context, in *radio.CreateProgramReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewCreateProgramLogic(ctx, s.svcCtx)
|
||||
return l.CreateProgram(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) UpdateProgram(ctx context.Context, in *radio.UpdateProgramReq) (*radio.UpdateProgramResp, error) {
|
||||
func (s *RadioServiceServer) UpdateProgram(ctx context.Context, in *radio.UpdateProgramReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewUpdateProgramLogic(ctx, s.svcCtx)
|
||||
return l.UpdateProgram(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) DeleteProgram(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (s *RadioServiceServer) DeleteProgram(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewDeleteProgramLogic(ctx, s.svcCtx)
|
||||
return l.DeleteProgram(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetProgramList(ctx context.Context, in *radio.GetProgramListReq) (*radio.GetProgramListResp, error) {
|
||||
func (s *RadioServiceServer) GetProgramList(ctx context.Context, in *radio.ProgramListReq) (*radio.ProgramListResp, error) {
|
||||
l := logic.NewGetProgramListLogic(ctx, s.svcCtx)
|
||||
return l.GetProgramList(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetProgramDetail(ctx context.Context, in *radio.GetProgramDetailReq) (*radio.GetProgramDetailResp, error) {
|
||||
func (s *RadioServiceServer) GetProgramDetail(ctx context.Context, in *radio.IdReq) (*radio.ProgramInfo, error) {
|
||||
l := logic.NewGetProgramDetailLogic(ctx, s.svcCtx)
|
||||
return l.GetProgramDetail(in)
|
||||
}
|
||||
|
||||
// 音色
|
||||
func (s *RadioServiceServer) CreateVoice(ctx context.Context, in *radio.CreateVoiceReq) (*radio.CreateVoiceResp, error) {
|
||||
func (s *RadioServiceServer) CreateVoice(ctx context.Context, in *radio.CreateVoiceReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewCreateVoiceLogic(ctx, s.svcCtx)
|
||||
return l.CreateVoice(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) UpdateVoice(ctx context.Context, in *radio.UpdateVoiceReq) (*radio.UpdateVoiceResp, error) {
|
||||
func (s *RadioServiceServer) UpdateVoice(ctx context.Context, in *radio.UpdateVoiceReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewUpdateVoiceLogic(ctx, s.svcCtx)
|
||||
return l.UpdateVoice(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) DeleteVoice(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) {
|
||||
func (s *RadioServiceServer) DeleteVoice(ctx context.Context, in *radio.IdsReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewDeleteVoiceLogic(ctx, s.svcCtx)
|
||||
return l.DeleteVoice(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetVoiceList(ctx context.Context, in *radio.GetVoiceListReq) (*radio.GetVoiceListResp, error) {
|
||||
func (s *RadioServiceServer) GetVoiceList(ctx context.Context, in *radio.VoiceListReq) (*radio.VoiceListResp, error) {
|
||||
l := logic.NewGetVoiceListLogic(ctx, s.svcCtx)
|
||||
return l.GetVoiceList(in)
|
||||
}
|
||||
|
||||
// 互动
|
||||
func (s *RadioServiceServer) ToggleLike(ctx context.Context, in *radio.ToggleLikeReq) (*radio.ToggleLikeResp, error) {
|
||||
func (s *RadioServiceServer) ToggleLike(ctx context.Context, in *radio.ToggleLikeReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewToggleLikeLogic(ctx, s.svcCtx)
|
||||
return l.ToggleLike(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) ToggleFavorite(ctx context.Context, in *radio.ToggleFavoriteReq) (*radio.ToggleFavoriteResp, error) {
|
||||
func (s *RadioServiceServer) ToggleFavorite(ctx context.Context, in *radio.ToggleFavoriteReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewToggleFavoriteLogic(ctx, s.svcCtx)
|
||||
return l.ToggleFavorite(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) CommentProgram(ctx context.Context, in *radio.CommentReq) (*radio.CommentResp, error) {
|
||||
func (s *RadioServiceServer) CommentProgram(ctx context.Context, in *radio.CommentReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewCommentProgramLogic(ctx, s.svcCtx)
|
||||
return l.CommentProgram(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) RecordHistory(ctx context.Context, in *radio.RecordHistoryReq) (*radio.RecordHistoryResp, error) {
|
||||
func (s *RadioServiceServer) RecordHistory(ctx context.Context, in *radio.RecordHistoryReq) (*radio.CommonResp, error) {
|
||||
l := logic.NewRecordHistoryLogic(ctx, s.svcCtx)
|
||||
return l.RecordHistory(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetHistoryList(ctx context.Context, in *radio.GetHistoryListReq) (*radio.GetHistoryListResp, error) {
|
||||
l := logic.NewGetHistoryListLogic(ctx, s.svcCtx)
|
||||
return l.GetHistoryList(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetFavoriteList(ctx context.Context, in *radio.GetFavoriteListReq) (*radio.GetFavoriteListResp, error) {
|
||||
func (s *RadioServiceServer) GetFavoriteList(ctx context.Context, in *radio.InteractionListReq) (*radio.FavoriteListResp, error) {
|
||||
l := logic.NewGetFavoriteListLogic(ctx, s.svcCtx)
|
||||
return l.GetFavoriteList(in)
|
||||
}
|
||||
|
||||
// 订阅
|
||||
func (s *RadioServiceServer) GetMySubscriptions(ctx context.Context, in *radio.GetMySubscriptionsReq) (*radio.GetMySubscriptionsResp, error) {
|
||||
func (s *RadioServiceServer) GetHistoryList(ctx context.Context, in *radio.InteractionListReq) (*radio.HistoryListResp, error) {
|
||||
l := logic.NewGetHistoryListLogic(ctx, s.svcCtx)
|
||||
return l.GetHistoryList(in)
|
||||
}
|
||||
|
||||
// 订阅/VIP
|
||||
func (s *RadioServiceServer) GetMySubscriptions(ctx context.Context, in *radio.SubscriptionListReq) (*radio.SubscriptionListResp, error) {
|
||||
l := logic.NewGetMySubscriptionsLogic(ctx, s.svcCtx)
|
||||
return l.GetMySubscriptions(in)
|
||||
}
|
||||
@@ -165,13 +165,28 @@ func (s *RadioServiceServer) CreatePayOrder(ctx context.Context, in *radio.Creat
|
||||
return l.CreatePayOrder(in)
|
||||
}
|
||||
|
||||
// VIP
|
||||
func (s *RadioServiceServer) GetVipConfigList(ctx context.Context, in *radio.GetVipConfigListReq) (*radio.GetVipConfigListResp, error) {
|
||||
func (s *RadioServiceServer) GetVipConfigList(ctx context.Context, in *radio.IdReq) (*radio.VipConfigListResp, error) {
|
||||
l := logic.NewGetVipConfigListLogic(ctx, s.svcCtx)
|
||||
return l.GetVipConfigList(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetMyVipInfo(ctx context.Context, in *radio.GetMyVipInfoReq) (*radio.GetMyVipInfoResp, error) {
|
||||
func (s *RadioServiceServer) GetMyVipInfo(ctx context.Context, in *radio.GetProfileReq) (*radio.RadioUserProfile, error) {
|
||||
l := logic.NewGetMyVipInfoLogic(ctx, s.svcCtx)
|
||||
return l.GetMyVipInfo(in)
|
||||
}
|
||||
|
||||
// 数据分析
|
||||
func (s *RadioServiceServer) GetAnalyticsOverview(ctx context.Context, in *radio.AnalyticsReq) (*radio.AnalyticsOverviewResp, error) {
|
||||
l := logic.NewGetAnalyticsOverviewLogic(ctx, s.svcCtx)
|
||||
return l.GetAnalyticsOverview(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetChannelAnalytics(ctx context.Context, in *radio.AnalyticsReq) (*radio.ChannelAnalyticsResp, error) {
|
||||
l := logic.NewGetChannelAnalyticsLogic(ctx, s.svcCtx)
|
||||
return l.GetChannelAnalytics(in)
|
||||
}
|
||||
|
||||
func (s *RadioServiceServer) GetUserAnalytics(ctx context.Context, in *radio.AnalyticsReq) (*radio.UserAnalyticsResp, error) {
|
||||
l := logic.NewGetUserAnalyticsLogic(ctx, s.svcCtx)
|
||||
return l.GetUserAnalytics(in)
|
||||
}
|
||||
|
||||
@@ -1,13 +1,44 @@
|
||||
package svc
|
||||
|
||||
import "sundynix-micro-go/app/radio/rpc/internal/config"
|
||||
import (
|
||||
radioModel "sundynix-micro-go/app/radio/model"
|
||||
"sundynix-micro-go/app/radio/rpc/internal/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
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}
|
||||
}
|
||||
|
||||
+308
-107
@@ -4,7 +4,23 @@ package radio;
|
||||
|
||||
option go_package = "./radio";
|
||||
|
||||
// ========== 通用 ==========
|
||||
|
||||
message CommonResp {
|
||||
int64 code = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
|
||||
message IdReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message IdsReq {
|
||||
repeated string ids = 1;
|
||||
}
|
||||
|
||||
// ========== 用户Profile ==========
|
||||
|
||||
message RadioUserProfile {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
@@ -14,26 +30,45 @@ message RadioUserProfile {
|
||||
int64 vipExpireAt = 6;
|
||||
int32 vipLevel = 7;
|
||||
}
|
||||
message GetRadioUserProfileReq { string userId = 1; }
|
||||
message GetRadioUserProfileResp { RadioUserProfile profile = 1; }
|
||||
|
||||
message GetProfileReq {
|
||||
string userId = 1;
|
||||
}
|
||||
|
||||
// ========== 分类 ==========
|
||||
|
||||
message CategoryInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string icon = 3;
|
||||
int32 sort = 4;
|
||||
}
|
||||
message CreateCategoryReq { string name = 1; string icon = 2; int32 sort = 3; }
|
||||
message CreateCategoryResp { string id = 1; }
|
||||
message UpdateCategoryReq { string id = 1; string name = 2; string icon = 3; int32 sort = 4; }
|
||||
message UpdateCategoryResp {}
|
||||
message DeleteByIdsReq { repeated string ids = 1; }
|
||||
message DeleteResp {}
|
||||
message GetCategoryListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetCategoryListResp { repeated CategoryInfo list = 1; int64 total = 2; }
|
||||
|
||||
message CategoryReq {
|
||||
string name = 1;
|
||||
string icon = 2;
|
||||
int32 sort = 3;
|
||||
}
|
||||
|
||||
message CategoryUpdateReq {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string icon = 3;
|
||||
int32 sort = 4;
|
||||
}
|
||||
|
||||
message CategoryListResp {
|
||||
repeated CategoryInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message CategoryListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
}
|
||||
|
||||
// ========== 频道 ==========
|
||||
|
||||
message ChannelInfo {
|
||||
string id = 1;
|
||||
string categoryId = 2;
|
||||
@@ -48,28 +83,52 @@ message ChannelInfo {
|
||||
string tags = 11;
|
||||
int32 sort = 12;
|
||||
int32 status = 13;
|
||||
int64 createdAt = 14;
|
||||
}
|
||||
|
||||
message CreateChannelReq {
|
||||
string categoryId = 1; string name = 2; string description = 3;
|
||||
int32 isFree = 4; int32 isVipOnly = 5;
|
||||
int32 monthlyPrice = 6; int32 quarterlyPrice = 7; int32 annualPrice = 8;
|
||||
string cover = 9; string tags = 10; int32 sort = 11;
|
||||
string categoryId = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
int32 isFree = 4;
|
||||
int32 isVipOnly = 5;
|
||||
int32 monthlyPrice = 6;
|
||||
int32 quarterlyPrice = 7;
|
||||
int32 annualPrice = 8;
|
||||
string cover = 9;
|
||||
string tags = 10;
|
||||
int32 sort = 11;
|
||||
}
|
||||
message CreateChannelResp { string id = 1; }
|
||||
|
||||
message UpdateChannelReq {
|
||||
string id = 1; string name = 2; string description = 3;
|
||||
int32 isFree = 4; int32 isVipOnly = 5;
|
||||
int32 monthlyPrice = 6; int32 quarterlyPrice = 7; int32 annualPrice = 8;
|
||||
string cover = 9; string tags = 10; int32 sort = 11; int32 status = 12;
|
||||
string id = 1;
|
||||
string categoryId = 2;
|
||||
string name = 3;
|
||||
string description = 4;
|
||||
int32 isFree = 5;
|
||||
int32 isVipOnly = 6;
|
||||
int32 monthlyPrice = 7;
|
||||
int32 quarterlyPrice = 8;
|
||||
int32 annualPrice = 9;
|
||||
string cover = 10;
|
||||
string tags = 11;
|
||||
int32 sort = 12;
|
||||
int32 status = 13;
|
||||
}
|
||||
|
||||
message ChannelListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string categoryId = 3;
|
||||
string userId = 4;
|
||||
}
|
||||
|
||||
message ChannelListResp {
|
||||
repeated ChannelInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
message UpdateChannelResp {}
|
||||
message GetChannelListReq { int32 current = 1; int32 pageSize = 2; string categoryId = 3; string userId = 4; }
|
||||
message GetChannelListResp { repeated ChannelInfo list = 1; int64 total = 2; }
|
||||
message GetChannelDetailReq { string id = 1; string userId = 2; }
|
||||
message GetChannelDetailResp { ChannelInfo channel = 1; }
|
||||
|
||||
// ========== 节目 ==========
|
||||
|
||||
message ProgramInfo {
|
||||
string id = 1;
|
||||
string channelId = 2;
|
||||
@@ -84,113 +143,255 @@ message ProgramInfo {
|
||||
int32 playCount = 11;
|
||||
int32 likeCount = 12;
|
||||
int32 status = 13;
|
||||
int64 createdAt = 14;
|
||||
}
|
||||
|
||||
message CreateProgramReq {
|
||||
string channelId = 1; string title = 2; string description = 3;
|
||||
string content = 4; string cover = 5; string tags = 6;
|
||||
string channelId = 1;
|
||||
string title = 2;
|
||||
string description = 3;
|
||||
string content = 4;
|
||||
string cover = 5;
|
||||
string tags = 6;
|
||||
}
|
||||
message CreateProgramResp { string id = 1; }
|
||||
|
||||
message UpdateProgramReq {
|
||||
string id = 1; string title = 2; string description = 3;
|
||||
string content = 4; string cover = 5; string audioId = 6;
|
||||
int32 audioStatus = 7; int32 duration = 8; string tags = 9; int32 status = 10;
|
||||
string id = 1;
|
||||
string channelId = 2;
|
||||
string title = 3;
|
||||
string description = 4;
|
||||
string content = 5;
|
||||
string cover = 6;
|
||||
string audioId = 7;
|
||||
int32 audioStatus = 8;
|
||||
int32 duration = 9;
|
||||
string tags = 10;
|
||||
int32 status = 11;
|
||||
}
|
||||
|
||||
message ProgramListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string channelId = 3;
|
||||
string userId = 4;
|
||||
}
|
||||
|
||||
message ProgramListResp {
|
||||
repeated ProgramInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
message UpdateProgramResp {}
|
||||
message GetProgramListReq { int32 current = 1; int32 pageSize = 2; string channelId = 3; string userId = 4; }
|
||||
message GetProgramListResp { repeated ProgramInfo list = 1; int64 total = 2; }
|
||||
message GetProgramDetailReq { string id = 1; string userId = 2; }
|
||||
message GetProgramDetailResp { ProgramInfo program = 1; }
|
||||
|
||||
// ========== 音色 ==========
|
||||
|
||||
message VoiceInfo {
|
||||
string id = 1; string speakerId = 2; string name = 3;
|
||||
string description = 4; string gender = 5; string icon = 6;
|
||||
string audioId = 7; int32 sort = 8; int32 status = 9;
|
||||
int32 isDefault = 10; int32 useCount = 11;
|
||||
string id = 1;
|
||||
string speakerId = 2;
|
||||
string name = 3;
|
||||
string description = 4;
|
||||
string gender = 5;
|
||||
string icon = 6;
|
||||
string audioId = 7;
|
||||
int32 sort = 8;
|
||||
int32 status = 9;
|
||||
int32 isDefault = 10;
|
||||
}
|
||||
|
||||
message CreateVoiceReq {
|
||||
string speakerId = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
string gender = 4;
|
||||
string icon = 5;
|
||||
string audioId = 6;
|
||||
int32 sort = 7;
|
||||
int32 isDefault = 8;
|
||||
}
|
||||
|
||||
message UpdateVoiceReq {
|
||||
string id = 1;
|
||||
string speakerId = 2;
|
||||
string name = 3;
|
||||
string description = 4;
|
||||
string gender = 5;
|
||||
string icon = 6;
|
||||
string audioId = 7;
|
||||
int32 sort = 8;
|
||||
int32 status = 9;
|
||||
int32 isDefault = 10;
|
||||
}
|
||||
|
||||
message VoiceListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
}
|
||||
|
||||
message VoiceListResp {
|
||||
repeated VoiceInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
message CreateVoiceReq { string speakerId = 1; string name = 2; string description = 3; string gender = 4; string icon = 5; string audioId = 6; int32 sort = 7; int32 isDefault = 8; }
|
||||
message CreateVoiceResp { string id = 1; }
|
||||
message UpdateVoiceReq { string id = 1; string name = 2; string description = 3; string icon = 4; string audioId = 5; int32 sort = 6; int32 status = 7; int32 isDefault = 8; }
|
||||
message UpdateVoiceResp {}
|
||||
message GetVoiceListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetVoiceListResp { repeated VoiceInfo list = 1; int64 total = 2; }
|
||||
|
||||
// ========== 互动 ==========
|
||||
message ToggleLikeReq { string userId = 1; string programId = 2; }
|
||||
message ToggleLikeResp { bool liked = 1; }
|
||||
message ToggleFavoriteReq { string userId = 1; string programId = 2; }
|
||||
message ToggleFavoriteResp { bool favorited = 1; }
|
||||
message CommentReq { string userId = 1; string programId = 2; string content = 3; string parentId = 4; }
|
||||
message CommentResp {}
|
||||
message RecordHistoryReq { string userId = 1; string programId = 2; int32 duration = 3; }
|
||||
message RecordHistoryResp {}
|
||||
message GetHistoryListReq { string userId = 1; int32 current = 2; int32 pageSize = 3; }
|
||||
message GetHistoryListResp { repeated ProgramInfo list = 1; int64 total = 2; }
|
||||
message GetFavoriteListReq { string userId = 1; int32 current = 2; int32 pageSize = 3; }
|
||||
message GetFavoriteListResp { repeated ProgramInfo list = 1; int64 total = 2; }
|
||||
|
||||
// ========== 订阅/支付 ==========
|
||||
message SubscriptionInfo {
|
||||
string id = 1; string userId = 2; string channelId = 3;
|
||||
int64 expiredAt = 4; int32 status = 5;
|
||||
message ToggleLikeReq {
|
||||
string userId = 1;
|
||||
string programId = 2;
|
||||
}
|
||||
|
||||
message ToggleFavoriteReq {
|
||||
string userId = 1;
|
||||
string programId = 2;
|
||||
}
|
||||
|
||||
message CommentReq {
|
||||
string userId = 1;
|
||||
string programId = 2;
|
||||
string content = 3;
|
||||
string parentId = 4;
|
||||
}
|
||||
|
||||
message RecordHistoryReq {
|
||||
string userId = 1;
|
||||
string programId = 2;
|
||||
int32 duration = 3;
|
||||
}
|
||||
|
||||
message InteractionListReq {
|
||||
string userId = 1;
|
||||
int32 current = 2;
|
||||
int32 pageSize = 3;
|
||||
}
|
||||
|
||||
message FavoriteListResp {
|
||||
repeated ProgramInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message HistoryListResp {
|
||||
repeated ProgramInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
// ========== 订阅/VIP ==========
|
||||
|
||||
message SubscriptionInfo {
|
||||
string id = 1;
|
||||
string channelId = 2;
|
||||
int64 expiredAt = 3;
|
||||
int32 status = 4;
|
||||
}
|
||||
|
||||
message SubscriptionListReq {
|
||||
string userId = 1;
|
||||
}
|
||||
|
||||
message SubscriptionListResp {
|
||||
repeated SubscriptionInfo list = 1;
|
||||
}
|
||||
|
||||
message CreatePayOrderReq {
|
||||
string userId = 1;
|
||||
string channelId = 2;
|
||||
string planType = 3;
|
||||
}
|
||||
|
||||
message CreatePayOrderResp {
|
||||
string orderNo = 1;
|
||||
string prepayId = 2;
|
||||
}
|
||||
message GetMySubscriptionsReq { string userId = 1; }
|
||||
message GetMySubscriptionsResp { repeated SubscriptionInfo list = 1; }
|
||||
message CreatePayOrderReq { string userId = 1; string channelId = 2; string planType = 3; }
|
||||
message CreatePayOrderResp { string orderNo = 1; string prepayId = 2; }
|
||||
|
||||
// ========== VIP ==========
|
||||
message VipConfigInfo {
|
||||
string id = 1; string name = 2; string planType = 3;
|
||||
int32 price = 4; int32 originalPrice = 5; int32 duration = 6;
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string planType = 3;
|
||||
int32 price = 4;
|
||||
int32 originalPrice = 5;
|
||||
int32 duration = 6;
|
||||
string desc = 7;
|
||||
}
|
||||
message GetVipConfigListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetVipConfigListResp { repeated VipConfigInfo list = 1; int64 total = 2; }
|
||||
message GetMyVipInfoReq { string userId = 1; }
|
||||
message GetMyVipInfoResp { RadioUserProfile profile = 1; }
|
||||
|
||||
// ========== 通用 ==========
|
||||
message Empty {}
|
||||
message VipConfigListResp {
|
||||
repeated VipConfigInfo list = 1;
|
||||
}
|
||||
|
||||
// ========== 数据分析 ==========
|
||||
|
||||
message AnalyticsReq {
|
||||
string startDate = 1;
|
||||
string endDate = 2;
|
||||
}
|
||||
|
||||
message AnalyticsOverviewResp {
|
||||
int64 totalUsers = 1;
|
||||
int64 totalPlays = 2;
|
||||
int64 totalChannels = 3;
|
||||
int64 totalPrograms = 4;
|
||||
}
|
||||
|
||||
message ChannelAnalyticsResp {
|
||||
repeated ChannelAnalyticsItem list = 1;
|
||||
}
|
||||
|
||||
message ChannelAnalyticsItem {
|
||||
string channelId = 1;
|
||||
string channelName = 2;
|
||||
int64 playCount = 3;
|
||||
int64 likeCount = 4;
|
||||
int64 subscriberCount = 5;
|
||||
}
|
||||
|
||||
message UserAnalyticsResp {
|
||||
int64 newUsers = 1;
|
||||
int64 activeUsers = 2;
|
||||
int64 vipUsers = 3;
|
||||
}
|
||||
|
||||
// ========== 服务定义 ==========
|
||||
|
||||
service RadioService {
|
||||
// 用户
|
||||
rpc GetRadioUserProfile(GetRadioUserProfileReq) returns (GetRadioUserProfileResp);
|
||||
// 用户Profile
|
||||
rpc GetUserProfile(GetProfileReq) returns (RadioUserProfile);
|
||||
|
||||
// 分类
|
||||
rpc CreateCategory(CreateCategoryReq) returns (CreateCategoryResp);
|
||||
rpc UpdateCategory(UpdateCategoryReq) returns (UpdateCategoryResp);
|
||||
rpc DeleteCategory(DeleteByIdsReq) returns (DeleteResp);
|
||||
rpc GetCategoryList(GetCategoryListReq) returns (GetCategoryListResp);
|
||||
rpc CreateCategory(CategoryReq) returns (CommonResp);
|
||||
rpc UpdateCategory(CategoryUpdateReq) returns (CommonResp);
|
||||
rpc DeleteCategory(IdsReq) returns (CommonResp);
|
||||
rpc GetCategoryList(CategoryListReq) returns (CategoryListResp);
|
||||
|
||||
// 频道
|
||||
rpc CreateChannel(CreateChannelReq) returns (CreateChannelResp);
|
||||
rpc UpdateChannel(UpdateChannelReq) returns (UpdateChannelResp);
|
||||
rpc DeleteChannel(DeleteByIdsReq) returns (DeleteResp);
|
||||
rpc GetChannelList(GetChannelListReq) returns (GetChannelListResp);
|
||||
rpc GetChannelDetail(GetChannelDetailReq) returns (GetChannelDetailResp);
|
||||
rpc CreateChannel(CreateChannelReq) returns (CommonResp);
|
||||
rpc UpdateChannel(UpdateChannelReq) returns (CommonResp);
|
||||
rpc DeleteChannel(IdsReq) returns (CommonResp);
|
||||
rpc GetChannelList(ChannelListReq) returns (ChannelListResp);
|
||||
rpc GetChannelDetail(IdReq) returns (ChannelInfo);
|
||||
|
||||
// 节目
|
||||
rpc CreateProgram(CreateProgramReq) returns (CreateProgramResp);
|
||||
rpc UpdateProgram(UpdateProgramReq) returns (UpdateProgramResp);
|
||||
rpc DeleteProgram(DeleteByIdsReq) returns (DeleteResp);
|
||||
rpc GetProgramList(GetProgramListReq) returns (GetProgramListResp);
|
||||
rpc GetProgramDetail(GetProgramDetailReq) returns (GetProgramDetailResp);
|
||||
rpc CreateProgram(CreateProgramReq) returns (CommonResp);
|
||||
rpc UpdateProgram(UpdateProgramReq) returns (CommonResp);
|
||||
rpc DeleteProgram(IdsReq) returns (CommonResp);
|
||||
rpc GetProgramList(ProgramListReq) returns (ProgramListResp);
|
||||
rpc GetProgramDetail(IdReq) returns (ProgramInfo);
|
||||
|
||||
// 音色
|
||||
rpc CreateVoice(CreateVoiceReq) returns (CreateVoiceResp);
|
||||
rpc UpdateVoice(UpdateVoiceReq) returns (UpdateVoiceResp);
|
||||
rpc DeleteVoice(DeleteByIdsReq) returns (DeleteResp);
|
||||
rpc GetVoiceList(GetVoiceListReq) returns (GetVoiceListResp);
|
||||
rpc CreateVoice(CreateVoiceReq) returns (CommonResp);
|
||||
rpc UpdateVoice(UpdateVoiceReq) returns (CommonResp);
|
||||
rpc DeleteVoice(IdsReq) returns (CommonResp);
|
||||
rpc GetVoiceList(VoiceListReq) returns (VoiceListResp);
|
||||
|
||||
// 互动
|
||||
rpc ToggleLike(ToggleLikeReq) returns (ToggleLikeResp);
|
||||
rpc ToggleFavorite(ToggleFavoriteReq) returns (ToggleFavoriteResp);
|
||||
rpc CommentProgram(CommentReq) returns (CommentResp);
|
||||
rpc RecordHistory(RecordHistoryReq) returns (RecordHistoryResp);
|
||||
rpc GetHistoryList(GetHistoryListReq) returns (GetHistoryListResp);
|
||||
rpc GetFavoriteList(GetFavoriteListReq) returns (GetFavoriteListResp);
|
||||
// 订阅
|
||||
rpc GetMySubscriptions(GetMySubscriptionsReq) returns (GetMySubscriptionsResp);
|
||||
rpc ToggleLike(ToggleLikeReq) returns (CommonResp);
|
||||
rpc ToggleFavorite(ToggleFavoriteReq) returns (CommonResp);
|
||||
rpc CommentProgram(CommentReq) returns (CommonResp);
|
||||
rpc RecordHistory(RecordHistoryReq) returns (CommonResp);
|
||||
rpc GetFavoriteList(InteractionListReq) returns (FavoriteListResp);
|
||||
rpc GetHistoryList(InteractionListReq) returns (HistoryListResp);
|
||||
|
||||
// 订阅/VIP
|
||||
rpc GetMySubscriptions(SubscriptionListReq) returns (SubscriptionListResp);
|
||||
rpc CreatePayOrder(CreatePayOrderReq) returns (CreatePayOrderResp);
|
||||
// VIP
|
||||
rpc GetVipConfigList(GetVipConfigListReq) returns (GetVipConfigListResp);
|
||||
rpc GetMyVipInfo(GetMyVipInfoReq) returns (GetMyVipInfoResp);
|
||||
rpc GetVipConfigList(IdReq) returns (VipConfigListResp);
|
||||
rpc GetMyVipInfo(GetProfileReq) returns (RadioUserProfile);
|
||||
|
||||
// 数据分析
|
||||
rpc GetAnalyticsOverview(AnalyticsReq) returns (AnalyticsOverviewResp);
|
||||
rpc GetChannelAnalytics(AnalyticsReq) returns (ChannelAnalyticsResp);
|
||||
rpc GetUserAnalytics(AnalyticsReq) returns (UserAnalyticsResp);
|
||||
}
|
||||
|
||||
+1017
-1648
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,105 +14,92 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
AnalyticsOverviewResp = radio.AnalyticsOverviewResp
|
||||
AnalyticsReq = radio.AnalyticsReq
|
||||
CategoryInfo = radio.CategoryInfo
|
||||
CategoryListReq = radio.CategoryListReq
|
||||
CategoryListResp = radio.CategoryListResp
|
||||
CategoryReq = radio.CategoryReq
|
||||
CategoryUpdateReq = radio.CategoryUpdateReq
|
||||
ChannelAnalyticsItem = radio.ChannelAnalyticsItem
|
||||
ChannelAnalyticsResp = radio.ChannelAnalyticsResp
|
||||
ChannelInfo = radio.ChannelInfo
|
||||
ChannelListReq = radio.ChannelListReq
|
||||
ChannelListResp = radio.ChannelListResp
|
||||
CommentReq = radio.CommentReq
|
||||
CommentResp = radio.CommentResp
|
||||
CreateCategoryReq = radio.CreateCategoryReq
|
||||
CreateCategoryResp = radio.CreateCategoryResp
|
||||
CommonResp = radio.CommonResp
|
||||
CreateChannelReq = radio.CreateChannelReq
|
||||
CreateChannelResp = radio.CreateChannelResp
|
||||
CreatePayOrderReq = radio.CreatePayOrderReq
|
||||
CreatePayOrderResp = radio.CreatePayOrderResp
|
||||
CreateProgramReq = radio.CreateProgramReq
|
||||
CreateProgramResp = radio.CreateProgramResp
|
||||
CreateVoiceReq = radio.CreateVoiceReq
|
||||
CreateVoiceResp = radio.CreateVoiceResp
|
||||
DeleteByIdsReq = radio.DeleteByIdsReq
|
||||
DeleteResp = radio.DeleteResp
|
||||
Empty = radio.Empty
|
||||
GetCategoryListReq = radio.GetCategoryListReq
|
||||
GetCategoryListResp = radio.GetCategoryListResp
|
||||
GetChannelDetailReq = radio.GetChannelDetailReq
|
||||
GetChannelDetailResp = radio.GetChannelDetailResp
|
||||
GetChannelListReq = radio.GetChannelListReq
|
||||
GetChannelListResp = radio.GetChannelListResp
|
||||
GetFavoriteListReq = radio.GetFavoriteListReq
|
||||
GetFavoriteListResp = radio.GetFavoriteListResp
|
||||
GetHistoryListReq = radio.GetHistoryListReq
|
||||
GetHistoryListResp = radio.GetHistoryListResp
|
||||
GetMySubscriptionsReq = radio.GetMySubscriptionsReq
|
||||
GetMySubscriptionsResp = radio.GetMySubscriptionsResp
|
||||
GetMyVipInfoReq = radio.GetMyVipInfoReq
|
||||
GetMyVipInfoResp = radio.GetMyVipInfoResp
|
||||
GetProgramDetailReq = radio.GetProgramDetailReq
|
||||
GetProgramDetailResp = radio.GetProgramDetailResp
|
||||
GetProgramListReq = radio.GetProgramListReq
|
||||
GetProgramListResp = radio.GetProgramListResp
|
||||
GetRadioUserProfileReq = radio.GetRadioUserProfileReq
|
||||
GetRadioUserProfileResp = radio.GetRadioUserProfileResp
|
||||
GetVipConfigListReq = radio.GetVipConfigListReq
|
||||
GetVipConfigListResp = radio.GetVipConfigListResp
|
||||
GetVoiceListReq = radio.GetVoiceListReq
|
||||
GetVoiceListResp = radio.GetVoiceListResp
|
||||
FavoriteListResp = radio.FavoriteListResp
|
||||
GetProfileReq = radio.GetProfileReq
|
||||
HistoryListResp = radio.HistoryListResp
|
||||
IdReq = radio.IdReq
|
||||
IdsReq = radio.IdsReq
|
||||
InteractionListReq = radio.InteractionListReq
|
||||
ProgramInfo = radio.ProgramInfo
|
||||
ProgramListReq = radio.ProgramListReq
|
||||
ProgramListResp = radio.ProgramListResp
|
||||
RadioUserProfile = radio.RadioUserProfile
|
||||
RecordHistoryReq = radio.RecordHistoryReq
|
||||
RecordHistoryResp = radio.RecordHistoryResp
|
||||
SubscriptionInfo = radio.SubscriptionInfo
|
||||
SubscriptionListReq = radio.SubscriptionListReq
|
||||
SubscriptionListResp = radio.SubscriptionListResp
|
||||
ToggleFavoriteReq = radio.ToggleFavoriteReq
|
||||
ToggleFavoriteResp = radio.ToggleFavoriteResp
|
||||
ToggleLikeReq = radio.ToggleLikeReq
|
||||
ToggleLikeResp = radio.ToggleLikeResp
|
||||
UpdateCategoryReq = radio.UpdateCategoryReq
|
||||
UpdateCategoryResp = radio.UpdateCategoryResp
|
||||
UpdateChannelReq = radio.UpdateChannelReq
|
||||
UpdateChannelResp = radio.UpdateChannelResp
|
||||
UpdateProgramReq = radio.UpdateProgramReq
|
||||
UpdateProgramResp = radio.UpdateProgramResp
|
||||
UpdateVoiceReq = radio.UpdateVoiceReq
|
||||
UpdateVoiceResp = radio.UpdateVoiceResp
|
||||
UserAnalyticsResp = radio.UserAnalyticsResp
|
||||
VipConfigInfo = radio.VipConfigInfo
|
||||
VipConfigListResp = radio.VipConfigListResp
|
||||
VoiceInfo = radio.VoiceInfo
|
||||
VoiceListReq = radio.VoiceListReq
|
||||
VoiceListResp = radio.VoiceListResp
|
||||
|
||||
RadioService interface {
|
||||
// 用户
|
||||
GetRadioUserProfile(ctx context.Context, in *GetRadioUserProfileReq, opts ...grpc.CallOption) (*GetRadioUserProfileResp, error)
|
||||
// 用户Profile
|
||||
GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error)
|
||||
// 分类
|
||||
CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*CreateCategoryResp, error)
|
||||
UpdateCategory(ctx context.Context, in *UpdateCategoryReq, opts ...grpc.CallOption) (*UpdateCategoryResp, error)
|
||||
DeleteCategory(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error)
|
||||
GetCategoryList(ctx context.Context, in *GetCategoryListReq, opts ...grpc.CallOption) (*GetCategoryListResp, error)
|
||||
CreateCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
UpdateCategory(ctx context.Context, in *CategoryUpdateReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeleteCategory(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetCategoryList(ctx context.Context, in *CategoryListReq, opts ...grpc.CallOption) (*CategoryListResp, error)
|
||||
// 频道
|
||||
CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CreateChannelResp, error)
|
||||
UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*UpdateChannelResp, error)
|
||||
DeleteChannel(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error)
|
||||
GetChannelList(ctx context.Context, in *GetChannelListReq, opts ...grpc.CallOption) (*GetChannelListResp, error)
|
||||
GetChannelDetail(ctx context.Context, in *GetChannelDetailReq, opts ...grpc.CallOption) (*GetChannelDetailResp, error)
|
||||
CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeleteChannel(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetChannelList(ctx context.Context, in *ChannelListReq, opts ...grpc.CallOption) (*ChannelListResp, error)
|
||||
GetChannelDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ChannelInfo, error)
|
||||
// 节目
|
||||
CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CreateProgramResp, error)
|
||||
UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*UpdateProgramResp, error)
|
||||
DeleteProgram(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error)
|
||||
GetProgramList(ctx context.Context, in *GetProgramListReq, opts ...grpc.CallOption) (*GetProgramListResp, error)
|
||||
GetProgramDetail(ctx context.Context, in *GetProgramDetailReq, opts ...grpc.CallOption) (*GetProgramDetailResp, error)
|
||||
CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeleteProgram(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetProgramList(ctx context.Context, in *ProgramListReq, opts ...grpc.CallOption) (*ProgramListResp, error)
|
||||
GetProgramDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ProgramInfo, error)
|
||||
// 音色
|
||||
CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CreateVoiceResp, error)
|
||||
UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*UpdateVoiceResp, error)
|
||||
DeleteVoice(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error)
|
||||
GetVoiceList(ctx context.Context, in *GetVoiceListReq, opts ...grpc.CallOption) (*GetVoiceListResp, error)
|
||||
CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeleteVoice(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetVoiceList(ctx context.Context, in *VoiceListReq, opts ...grpc.CallOption) (*VoiceListResp, error)
|
||||
// 互动
|
||||
ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*ToggleLikeResp, error)
|
||||
ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*ToggleFavoriteResp, error)
|
||||
CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommentResp, error)
|
||||
RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*RecordHistoryResp, error)
|
||||
GetHistoryList(ctx context.Context, in *GetHistoryListReq, opts ...grpc.CallOption) (*GetHistoryListResp, error)
|
||||
GetFavoriteList(ctx context.Context, in *GetFavoriteListReq, opts ...grpc.CallOption) (*GetFavoriteListResp, error)
|
||||
// 订阅
|
||||
GetMySubscriptions(ctx context.Context, in *GetMySubscriptionsReq, opts ...grpc.CallOption) (*GetMySubscriptionsResp, error)
|
||||
ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetFavoriteList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*FavoriteListResp, error)
|
||||
GetHistoryList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*HistoryListResp, error)
|
||||
// 订阅/VIP
|
||||
GetMySubscriptions(ctx context.Context, in *SubscriptionListReq, opts ...grpc.CallOption) (*SubscriptionListResp, error)
|
||||
CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error)
|
||||
// VIP
|
||||
GetVipConfigList(ctx context.Context, in *GetVipConfigListReq, opts ...grpc.CallOption) (*GetVipConfigListResp, error)
|
||||
GetMyVipInfo(ctx context.Context, in *GetMyVipInfoReq, opts ...grpc.CallOption) (*GetMyVipInfoResp, error)
|
||||
GetVipConfigList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*VipConfigListResp, error)
|
||||
GetMyVipInfo(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error)
|
||||
// 数据分析
|
||||
GetAnalyticsOverview(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*AnalyticsOverviewResp, error)
|
||||
GetChannelAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*ChannelAnalyticsResp, error)
|
||||
GetUserAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*UserAnalyticsResp, error)
|
||||
}
|
||||
|
||||
defaultRadioService struct {
|
||||
@@ -126,139 +113,139 @@ func NewRadioService(cli zrpc.Client) RadioService {
|
||||
}
|
||||
}
|
||||
|
||||
// 用户
|
||||
func (m *defaultRadioService) GetRadioUserProfile(ctx context.Context, in *GetRadioUserProfileReq, opts ...grpc.CallOption) (*GetRadioUserProfileResp, error) {
|
||||
// 用户Profile
|
||||
func (m *defaultRadioService) GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetRadioUserProfile(ctx, in, opts...)
|
||||
return client.GetUserProfile(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 分类
|
||||
func (m *defaultRadioService) CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*CreateCategoryResp, error) {
|
||||
func (m *defaultRadioService) CreateCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.CreateCategory(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) UpdateCategory(ctx context.Context, in *UpdateCategoryReq, opts ...grpc.CallOption) (*UpdateCategoryResp, error) {
|
||||
func (m *defaultRadioService) UpdateCategory(ctx context.Context, in *CategoryUpdateReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.UpdateCategory(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) DeleteCategory(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) {
|
||||
func (m *defaultRadioService) DeleteCategory(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.DeleteCategory(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetCategoryList(ctx context.Context, in *GetCategoryListReq, opts ...grpc.CallOption) (*GetCategoryListResp, error) {
|
||||
func (m *defaultRadioService) GetCategoryList(ctx context.Context, in *CategoryListReq, opts ...grpc.CallOption) (*CategoryListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetCategoryList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 频道
|
||||
func (m *defaultRadioService) CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CreateChannelResp, error) {
|
||||
func (m *defaultRadioService) CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.CreateChannel(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*UpdateChannelResp, error) {
|
||||
func (m *defaultRadioService) UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.UpdateChannel(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) DeleteChannel(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) {
|
||||
func (m *defaultRadioService) DeleteChannel(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.DeleteChannel(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetChannelList(ctx context.Context, in *GetChannelListReq, opts ...grpc.CallOption) (*GetChannelListResp, error) {
|
||||
func (m *defaultRadioService) GetChannelList(ctx context.Context, in *ChannelListReq, opts ...grpc.CallOption) (*ChannelListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetChannelList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetChannelDetail(ctx context.Context, in *GetChannelDetailReq, opts ...grpc.CallOption) (*GetChannelDetailResp, error) {
|
||||
func (m *defaultRadioService) GetChannelDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ChannelInfo, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetChannelDetail(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 节目
|
||||
func (m *defaultRadioService) CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CreateProgramResp, error) {
|
||||
func (m *defaultRadioService) CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.CreateProgram(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*UpdateProgramResp, error) {
|
||||
func (m *defaultRadioService) UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.UpdateProgram(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) DeleteProgram(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) {
|
||||
func (m *defaultRadioService) DeleteProgram(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.DeleteProgram(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetProgramList(ctx context.Context, in *GetProgramListReq, opts ...grpc.CallOption) (*GetProgramListResp, error) {
|
||||
func (m *defaultRadioService) GetProgramList(ctx context.Context, in *ProgramListReq, opts ...grpc.CallOption) (*ProgramListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetProgramList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetProgramDetail(ctx context.Context, in *GetProgramDetailReq, opts ...grpc.CallOption) (*GetProgramDetailResp, error) {
|
||||
func (m *defaultRadioService) GetProgramDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*ProgramInfo, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetProgramDetail(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 音色
|
||||
func (m *defaultRadioService) CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CreateVoiceResp, error) {
|
||||
func (m *defaultRadioService) CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.CreateVoice(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*UpdateVoiceResp, error) {
|
||||
func (m *defaultRadioService) UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.UpdateVoice(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) DeleteVoice(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) {
|
||||
func (m *defaultRadioService) DeleteVoice(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.DeleteVoice(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetVoiceList(ctx context.Context, in *GetVoiceListReq, opts ...grpc.CallOption) (*GetVoiceListResp, error) {
|
||||
func (m *defaultRadioService) GetVoiceList(ctx context.Context, in *VoiceListReq, opts ...grpc.CallOption) (*VoiceListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetVoiceList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 互动
|
||||
func (m *defaultRadioService) ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*ToggleLikeResp, error) {
|
||||
func (m *defaultRadioService) ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.ToggleLike(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*ToggleFavoriteResp, error) {
|
||||
func (m *defaultRadioService) ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.ToggleFavorite(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommentResp, error) {
|
||||
func (m *defaultRadioService) CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.CommentProgram(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*RecordHistoryResp, error) {
|
||||
func (m *defaultRadioService) RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.RecordHistory(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetHistoryList(ctx context.Context, in *GetHistoryListReq, opts ...grpc.CallOption) (*GetHistoryListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetHistoryList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetFavoriteList(ctx context.Context, in *GetFavoriteListReq, opts ...grpc.CallOption) (*GetFavoriteListResp, error) {
|
||||
func (m *defaultRadioService) GetFavoriteList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*FavoriteListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetFavoriteList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 订阅
|
||||
func (m *defaultRadioService) GetMySubscriptions(ctx context.Context, in *GetMySubscriptionsReq, opts ...grpc.CallOption) (*GetMySubscriptionsResp, error) {
|
||||
func (m *defaultRadioService) GetHistoryList(ctx context.Context, in *InteractionListReq, opts ...grpc.CallOption) (*HistoryListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetHistoryList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 订阅/VIP
|
||||
func (m *defaultRadioService) GetMySubscriptions(ctx context.Context, in *SubscriptionListReq, opts ...grpc.CallOption) (*SubscriptionListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetMySubscriptions(ctx, in, opts...)
|
||||
}
|
||||
@@ -268,13 +255,28 @@ func (m *defaultRadioService) CreatePayOrder(ctx context.Context, in *CreatePayO
|
||||
return client.CreatePayOrder(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// VIP
|
||||
func (m *defaultRadioService) GetVipConfigList(ctx context.Context, in *GetVipConfigListReq, opts ...grpc.CallOption) (*GetVipConfigListResp, error) {
|
||||
func (m *defaultRadioService) GetVipConfigList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*VipConfigListResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetVipConfigList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetMyVipInfo(ctx context.Context, in *GetMyVipInfoReq, opts ...grpc.CallOption) (*GetMyVipInfoResp, error) {
|
||||
func (m *defaultRadioService) GetMyVipInfo(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*RadioUserProfile, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetMyVipInfo(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 数据分析
|
||||
func (m *defaultRadioService) GetAnalyticsOverview(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*AnalyticsOverviewResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetAnalyticsOverview(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetChannelAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*ChannelAnalyticsResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetChannelAnalytics(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRadioService) GetUserAnalytics(ctx context.Context, in *AnalyticsReq, opts ...grpc.CallOption) (*UserAnalyticsResp, error) {
|
||||
client := radio.NewRadioServiceClient(m.cli.Conn())
|
||||
return client.GetUserAnalytics(ctx, in, opts...)
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
Name: system-api
|
||||
|
||||
Log:
|
||||
Encoding: plain
|
||||
Host: 0.0.0.0
|
||||
Port: 9003
|
||||
|
||||
Auth:
|
||||
AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872
|
||||
AccessExpire: 7200
|
||||
AccessSecret: sundynix-jwt-secret-2024
|
||||
AccessExpire: 604800
|
||||
|
||||
DB:
|
||||
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
|
||||
|
||||
# system-rpc 服务配置
|
||||
SystemRpc:
|
||||
Etcd:
|
||||
Hosts:
|
||||
|
||||
@@ -15,7 +15,4 @@ type Config struct {
|
||||
AccessExpire int64
|
||||
}
|
||||
SystemRpc zrpc.RpcClientConf
|
||||
DB struct {
|
||||
DataSource string
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user