File tree Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import (
20
20
21
21
"yunion.io/x/jsonutils"
22
22
"yunion.io/x/pkg/errors"
23
- "yunion.io/x/pkg/util/timeutils"
24
23
"yunion.io/x/pkg/utils"
25
24
26
25
billing_api "yunion.io/x/cloudmux/pkg/apis/billing"
@@ -45,12 +44,12 @@ type SEip struct {
45
44
Tags string
46
45
CreatedAt time.Time
47
46
UpdatedAt time.Time
48
- ExpiredAt string
47
+ ExpiredAt time. Time
49
48
ProjectId string
50
49
}
51
50
52
51
func (self * SEip ) GetBillingType () string {
53
- if len ( self .ExpiredAt ) > 0 {
52
+ if ! self .ExpiredAt . IsZero () {
54
53
return billing_api .BILLING_TYPE_PREPAID
55
54
}
56
55
return billing_api .BILLING_TYPE_POSTPAID
@@ -61,11 +60,7 @@ func (self *SEip) GetCreatedAt() time.Time {
61
60
}
62
61
63
62
func (self * SEip ) GetExpiredAt () time.Time {
64
- if len (self .ExpiredAt ) > 0 {
65
- t , _ := timeutils .ParseTimeStr (self .ExpiredAt )
66
- return t
67
- }
68
- return time.Time {}
63
+ return self .ExpiredAt
69
64
}
70
65
71
66
func (self * SEip ) GetId () string {
@@ -133,7 +128,10 @@ func (self *SEip) GetBandwidth() int {
133
128
}
134
129
135
130
func (self * SEip ) GetInternetChargeType () string {
136
- return ""
131
+ if self .GetBillingType () == billing_api .BILLING_TYPE_PREPAID {
132
+ return api .EIP_CHARGE_TYPE_BY_BANDWIDTH
133
+ }
134
+ return api .EIP_CHARGE_TYPE_BY_TRAFFIC
137
135
}
138
136
139
137
func (self * SEip ) Delete () error {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ package ctyun
17
17
import (
18
18
"context"
19
19
"fmt"
20
- "strconv"
21
20
"strings"
22
21
"time"
23
22
@@ -41,7 +40,7 @@ type SInstance struct {
41
40
image * SImage
42
41
43
42
AzName string
44
- ExpiredTime string
43
+ ExpiredTime time. Time
45
44
CreatedTime time.Time
46
45
ProjectId string
47
46
AttachedVolume []string
@@ -96,7 +95,7 @@ type SInstance struct {
96
95
}
97
96
98
97
func (self * SInstance ) GetBillingType () string {
99
- if len ( self .ExpiredTime ) > 0 {
98
+ if ! self .OnDemand {
100
99
return billing_api .BILLING_TYPE_PREPAID
101
100
}
102
101
return billing_api .BILLING_TYPE_POSTPAID
@@ -107,11 +106,7 @@ func (self *SInstance) GetCreatedAt() time.Time {
107
106
}
108
107
109
108
func (self * SInstance ) GetExpiredAt () time.Time {
110
- if len (self .ExpiredTime ) > 0 {
111
- expire , _ := strconv .Atoi (self .ExpiredTime )
112
- return time .Unix (int64 (expire / 1000 ), 0 )
113
- }
114
- return time.Time {}
109
+ return self .ExpiredTime
115
110
}
116
111
117
112
func (self * SInstance ) GetId () string {
You can’t perform that action at this time.
0 commit comments