Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ cmd/csghub-server/__debug_*
run_dataviewer_local.sh
run_notification_local.sh
run_temporal_worker.sh
run_logcollector_local.sh

local.toml
loki-config.yml

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions _mocks/opencsg.com/csghub-server/component/mock_UserComponent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions api/handler/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,16 +825,19 @@ func (h *UserHandler) GetUserResource(ctx *gin.Context) {
req.CurrentUser = currentUser
req.Page = page
req.PageSize = per
ds, total, err := h.user.GetUserResource(ctx.Request.Context(), req)
req.StartTime = ctx.Query("start_time")
req.EndTime = ctx.Query("end_time")
ds, total, totalPrice, err := h.user.GetUserResource(ctx.Request.Context(), req)
if err != nil {
slog.ErrorContext(ctx.Request.Context(), "failed to get user's resource", slog.Any("error", err), slog.Any("username", username))
httpbase.ServerError(ctx, err)
return
}
respData := gin.H{
"message": "OK",
"data": ds,
"total": total,
"message": "OK",
"data": ds,
"total": total,
"total_price": totalPrice,
}
ctx.JSON(http.StatusOK, respData)
}
Expand Down
9 changes: 5 additions & 4 deletions api/handler/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,14 @@ func TestUserHandler_GetUserResource(t *testing.T) {
Page: 1,
PageSize: 10,
},
}).Return([]types.UserResourcesResp{{ID: 123}}, 100, nil)
}).Return([]types.UserResourcesResp{{ID: 123}}, 100, 50.0, nil)
tester.WithParam("username", "u").AddPagination(1, 10).Execute()

tester.ResponseEqSimple(t, 200, gin.H{
"message": "OK",
"data": []types.UserResourcesResp{{ID: 123}},
"total": 100,
"message": "OK",
"data": []types.UserResourcesResp{{ID: 123}},
"total": 100,
"total_price": 50.0,
})
}

Expand Down
1 change: 1 addition & 0 deletions builder/accounting/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type AccountingClient interface {
ListRecharges(req types.RechargesIndexReq) (any, error)
StatementsIndex(req types.ActStatementsReq) (any, error)
ListPresents(req types.PresentsIndexReq) (any, error)
GetOrderDetailByID(currentUser string, id int64) (any, error)
}
type accountingClientImpl struct {
remote *url.URL
Expand Down
4 changes: 4 additions & 0 deletions builder/accounting/client_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ func (ac *accountingClientImpl) StatementsIndex(req types.ActStatementsReq) (any
func (ac *accountingClientImpl) ListPresents(req types.PresentsIndexReq) (any, error) {
return nil, nil
}

func (ac *accountingClientImpl) GetOrderDetailByID(currentUser string, id int64) (any, error) {
return nil, nil
}
Loading
Loading