Browse Source

前后端对接

dev
majun 7 months ago
parent
commit
027a37585a
  1. 2
      api/channel/v1/channel.go
  2. 2
      api/live/v1/live.go
  3. 4
      main.go

2
api/channel/v1/channel.go

@ -12,7 +12,7 @@ type ChannelList struct {
}
type GetChannelReq struct {
g.Meta `path:"/channel" method:"get" tags:"Channel" summary:"获取单个频道"`
g.Meta `path:"/channel" method:"post" tags:"Channel" summary:"获取单个频道"`
Id int `v:"required|min:1#频道ID不能为空|频道ID不能小于1" dc:"频道ID"`
UserId int `v:"required|min:90000000|max:99999999#用户ID不能为空|用户ID不能小于90000000|用户ID不能大于99999999" dc:"用户ID"`
FlagType int `v:"min:1|max:2#类型不能小于1|类型不能大于2" dc:"列表类型"`

2
api/live/v1/live.go

@ -12,7 +12,7 @@ type Live struct {
}
type GetLiveReq struct {
g.Meta `path:"/live" method:"get" tags:"Live" summary:"获取直播列表"`
g.Meta `path:"/live" method:"post" tags:"Live" summary:"获取直播列表"`
UserId int `v:"required|min:90000000|max:99999999#用户ID不能为空|用户ID不能小于90000000|用户ID不能大于99999999" dc:"用户ID"`
}

4
main.go

@ -27,9 +27,9 @@ func main() {
// 创建CORS中间件,配置允许的源等信息
c := cors.New(cors.Options{
AllowedOrigins: []string{"http://localhost:5173"},
AllowedOrigins: []string{"http://192.168.9.*:5173"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE"},
AllowedHeaders: []string{"Content-Type"},
AllowedHeaders: []string{"Content-Type, Authorization"},
})
handler := c.Handler(mux)
log.Fatal(http.ListenAndServe(":8080", handler))

Loading…
Cancel
Save