chore: remove console logging & update balance rendering

This commit is contained in:
JustSong 2023-06-29 21:32:56 +08:00
parent 2fde6839a0
commit 46464215ba
2 changed files with 6 additions and 8 deletions

View File

@ -62,11 +62,11 @@ type API2GPTUsageResponse struct {
}
type APGC2DGPTUsageResponse struct {
Grants interface{} `json:"grants"`
Object string `json:"object"`
TotalAvailable float64 `json:"total_available"`
TotalGranted float64 `json:"total_granted"`
TotalUsed float64 `json:"total_used"`
//Grants interface{} `json:"grants"`
Object string `json:"object"`
TotalAvailable float64 `json:"total_available"`
TotalGranted float64 `json:"total_granted"`
TotalUsed float64 `json:"total_used"`
}
// GetAuthHeader get auth header
@ -161,13 +161,11 @@ func updateChannelAPI2GPTBalance(channel *model.Channel) (float64, error) {
func updateChannelAIGC2DBalance(channel *model.Channel) (float64, error) {
url := "https://api.aigc2d.com/dashboard/billing/credit_grants"
body, err := GetResponseBody("GET", url, channel, GetAuthHeader(channel.Key))
if err != nil {
return 0, err
}
response := APGC2DGPTUsageResponse{}
err = json.Unmarshal(body, &response)
fmt.Println(response)
if err != nil {
return 0, err
}

View File

@ -39,7 +39,7 @@ function renderBalance(type, balance) {
case 12: // API2GPT
return <span>¥{balance.toFixed(2)}</span>;
case 13: // AIGC2D
return <span>¥{(balance * 0.0021).toFixed(2)}</span>;
return <span>{renderNumber(balance)}</span>;
default:
return <span>不支持</span>;
}