From 6d67affe39fe494ed502c005889068a0551221ce Mon Sep 17 00:00:00 2001 From: argeric Date: Tue, 16 Apr 2024 15:36:06 +0800 Subject: [PATCH] Return `count` info instead of `display flag`. --- api/account_api.go | 18 ++++++------------ api/types.go | 3 +-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/api/account_api.go b/api/account_api.go index a4ea120..eaa6930 100644 --- a/api/account_api.go +++ b/api/account_api.go @@ -32,18 +32,12 @@ func getAccountInfo(c *gin.Context) (interface{}, error) { } accountInfo := AccountInfo{ - Balance: decimal.NewFromBigInt(balance, 0), - FileCount: submitStat.FileCount, - TxCount: submitStat.TxCount, - DataSize: submitStat.DataSize, - StorageFee: submitStat.BaseFee, - } - - if accountInfo.TxCount > 0 { - accountInfo.TxTab = 1 - } - if rewardStat.RewardCount > 0 { - accountInfo.RewardTab = 1 + Balance: decimal.NewFromBigInt(balance, 0), + FileCount: submitStat.FileCount, + TxCount: submitStat.TxCount, + DataSize: submitStat.DataSize, + StorageFee: submitStat.BaseFee, + RewardCount: rewardStat.RewardCount, } return accountInfo, nil diff --git a/api/types.go b/api/types.go index c82b5b8..6330b67 100644 --- a/api/types.go +++ b/api/types.go @@ -185,6 +185,5 @@ type AccountInfo struct { DataSize uint64 `json:"dataTotal"` // Total Size of storage data StorageFee decimal.Decimal `json:"storageFeeTotal"` // Total storage fee - TxTab uint8 `json:"txTab"` // Flag to display the tx list, 1 - has tx list, 0 - hasn't tx list - RewardTab uint8 `json:"rewardTab"` // Flag to display the reward list, 1 - has reward list, 0 - hasn't reward list + RewardCount uint64 `json:"rewardCount"` // Number of distributed reward recodes }