Merge pull request #4 from songquanpeng/main

Fork Sync: Update from parent repository
This commit is contained in:
quzard 2023-06-03 10:46:49 +08:00 committed by GitHub
commit c264b8c030
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,11 @@ func updateChannelBalance(channel *model.Channel) (float64, error) {
}
now := time.Now()
startDate := fmt.Sprintf("%s-01", now.Format("2006-01"))
//endDate := now.Format("2006-01-02")
url = fmt.Sprintf("%s/v1/dashboard/billing/usage?start_date=%s&end_date=%s", baseURL, startDate, "2023-06-01")
endDate := now.Format("2006-01-02")
if !subscription.HasPaymentMethod {
startDate = now.AddDate(0, 0, -100).Format("2006-01-02")
}
url = fmt.Sprintf("%s/v1/dashboard/billing/usage?start_date=%s&end_date=%s", baseURL, startDate, endDate)
req, err = http.NewRequest("GET", url, nil)
if err != nil {
return 0, err