feat(expense): add ExpenseService with GetOrdersList

This commit is contained in:
2026-08-13 00:28:14 +08:00
parent 7d33b2e702
commit 2ee9555506
2 changed files with 56 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
package expense
import "github.com/XingfenD/rainyun_api_go_sdk/apis"
type ExpenseService struct {
client *apis.RyClient
}
func NewExpenseService(c *apis.RyClient) *ExpenseService {
return &ExpenseService{client: c}
}
+45
View File
@@ -0,0 +1,45 @@
package expense
import (
"github.com/XingfenD/rainyun_api_go_sdk/apis/common"
"github.com/XingfenD/rainyun_api_go_sdk/constant"
)
// 订单列表查询参数
type GetOrdersListRequest struct {
Options common.StandQueryParameters `json:"options"`
}
// 订单列表响应
type GetOrdersListResponse struct {
Code int `json:"code"`
Data OrdersListData `json:"data"`
}
// 订单列表数据
type OrdersListData struct {
TotalRecords int `json:"TotalRecords"`
Records []Order `json:"Records"`
}
// 订单
type Order struct {
ID int `json:"id"`
ProductName string `json:"product_name"`
Amount float64 `json:"amount"`
Status string `json:"status"`
CreateDate string `json:"create_date"`
}
// 获取订单列表
func (s *ExpenseService) GetOrdersList(req *GetOrdersListRequest) (*GetOrdersListResponse, error) {
path := "/expense/orders/list"
var resp GetOrdersListResponse
querys, err := common.MarshalQueryParams(req)
if err != nil {
return nil, err
}
err = s.client.Do(constant.HTTPMethod_GET, path, querys, nil, &resp)
return &resp, err
}