This commit is contained in:
Yvan
2026-09-23 17:42:55 +08:00
parent 53e8599bdd
commit 0a8ecbe09b
75 changed files with 2299 additions and 276 deletions
+21 -18
View File
@@ -55,24 +55,27 @@ type LiveRoomRequest struct {
Enabled bool `json:"enabled"`
}
type LiveRoomResponse struct {
ID uint `json:"id"`
StreamID string `json:"streamId"`
Name string `json:"name"`
CategoryID uint `json:"categoryId"`
CategoryName string `json:"categoryName"`
CoverURL string `json:"coverUrl"`
Intro string `json:"intro"`
Sort int `json:"sort"`
AnchorUserID uint `json:"anchorUserId"`
AnchorName string `json:"anchorName"`
AnchorAvatar string `json:"anchorAvatar"`
StreamURL string `json:"streamUrl"`
ReplayURL string `json:"replayUrl"`
Enabled bool `json:"enabled"`
Status string `json:"status"`
ViewerCount int `json:"viewerCount"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ID uint `json:"id"`
StreamID string `json:"streamId"`
Name string `json:"name"`
CategoryID uint `json:"categoryId"`
CategoryName string `json:"categoryName"`
CoverURL string `json:"coverUrl"`
Intro string `json:"intro"`
Sort int `json:"sort"`
AnchorUserID uint `json:"anchorUserId"`
AnchorName string `json:"anchorName"`
AnchorAvatar string `json:"anchorAvatar"`
StreamURL string `json:"streamUrl"`
ReplayURL string `json:"replayUrl"`
Enabled bool `json:"enabled"`
Status string `json:"status"`
ViewerCount int `json:"viewerCount"`
ViewerCountText string `json:"viewerCountText"`
LikeCount int `json:"likeCount"`
StartedAt *time.Time `json:"startedAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type LiveStatusRequest struct {
Enabled bool `json:"enabled"`
+5
View File
@@ -9,6 +9,7 @@ type LiveClientLoginRequest struct {
type LiveClientRegisterRequest struct {
Username string `json:"username" binding:"required"`
Nickname string `json:"nickname"`
Password string `json:"password" binding:"required"`
ConfirmPassword string `json:"confirmPassword" binding:"required"`
}
@@ -34,6 +35,10 @@ type LiveClientAccountResponse struct {
CreatedAt time.Time `json:"createdAt"`
}
type LiveClientBalanceResponse struct {
DiamondBalance int64 `json:"diamondBalance"`
}
type LiveClientAuthResponse struct {
User *LiveClientAccountResponse `json:"user"`
Token string `json:"token"`
+16
View File
@@ -0,0 +1,16 @@
package dto
import (
"encoding/json"
"testing"
)
func TestLiveClientRegisterRequestDecodesNickname(t *testing.T) {
var request LiveClientRegisterRequest
if err := json.Unmarshal([]byte(`{"username":"viewer","nickname":"直播用户","password":"password","confirmPassword":"password"}`), &request); err != nil {
t.Fatal(err)
}
if request.Nickname != "直播用户" {
t.Fatalf("nickname = %q", request.Nickname)
}
}
+4
View File
@@ -9,6 +9,10 @@ type RechargePlan struct {
AmountCents int64 `json:"amountCents"`
Enabled bool `json:"enabled"`
}
type RechargeProvider struct {
ID string `json:"id"`
Name string `json:"name"`
}
type RechargePlansRequest struct {
Plans []*RechargePlan `json:"plans" binding:"required"`
}