fix: PascalCase JSON fields + code:200 success + Unix timestamp ExpDate

This commit is contained in:
2026-07-28 17:09:39 +08:00
parent 7190d93edf
commit 9c3eba2327
4 changed files with 14 additions and 13 deletions
+4 -4
View File
@@ -13,9 +13,9 @@ type ServerService struct {
client *client
}
// rainyunServer mirrors the Rainyun RCS API JSON fields.
// rainyunServer mirrors the Rainyun RCS API JSON fields (PascalCase).
type rainyunServer struct {
ID int `json:"id"`
ID int `json:"ID"`
Name string `json:"name"`
Status string `json:"status"`
IP string `json:"ip"`
@@ -24,7 +24,7 @@ type rainyunServer struct {
Disk int `json:"disk"`
OS string `json:"os"`
Region string `json:"zone_name"`
ExpireDate string `json:"expire_date"`
ExpireDate int64 `json:"ExpDate"` // Unix timestamp
}
func (s *ServerService) List(ctx context.Context) ([]provider.Server, error) {
@@ -87,7 +87,7 @@ func (s *ServerService) Upgrade(ctx context.Context, id, plan string) error {
// toServer maps a rainyunServer to the provider.Server model.
func toServer(r rainyunServer) provider.Server {
expire, _ := time.Parse("2006-01-02", r.ExpireDate)
expire := time.Unix(r.ExpireDate, 0)
return provider.Server{
ID: fmt.Sprintf("%d", r.ID),
Name: r.Name,