forked from free-lancers/electricity_bill_calc_service
		
	enhance(time):调整日期时间在输出位JSON时的默认格式。
This commit is contained in:
		| @@ -7,12 +7,12 @@ type Report struct { | ||||
| 	Deleted               `xorm:"extends"` | ||||
| 	Id                    string     `xorm:"varchar(120) pk not null" json:"id"` | ||||
| 	ParkId                string     `xorm:"varchar(120) not null" json:"parkId"` | ||||
| 	Period                time.Time  `xorm:"date not null" json:"period"` | ||||
| 	Period                time.Time  `xorm:"date not null" json:"period" time_format:"simple_date" time_location:"shanghai"` | ||||
| 	Published             bool       `xorm:"bool not null default false" json:"published"` | ||||
| 	PublishedAt           *time.Time `xorm:"timestampz" json:"publishedAt"` | ||||
| 	PublishedAt           *time.Time `xorm:"timestampz" json:"publishedAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| 	Withdraw              int8       `xorm:"smallint not null default 0" json:"withdraw"` | ||||
| 	LastWithdrawAppliedAt *time.Time `xorm:"timestampz" json:"lastWithdrawAppliedAt"` | ||||
| 	LastWithdrawAuditAt   *time.Time `xorm:"timestampz" json:"lastWithdrawAuditAt"` | ||||
| 	LastWithdrawAppliedAt *time.Time `xorm:"timestampz" json:"lastWithdrawAppliedAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| 	LastWithdrawAuditAt   *time.Time `xorm:"timestampz" json:"lastWithdrawAuditAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| } | ||||
|  | ||||
| func (Report) TableName() string { | ||||
|   | ||||
| @@ -7,5 +7,5 @@ type Session struct { | ||||
| 	Name      string    `json:"name"` | ||||
| 	Type      int8      `json:"type"` | ||||
| 	Token     string    `json:"token"` | ||||
| 	ExpiresAt time.Time `json:"expiresAt"` | ||||
| 	ExpiresAt time.Time `json:"expiresAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package model | ||||
| import "time" | ||||
|  | ||||
| type Created struct { | ||||
| 	CreatedAt time.Time `xorm:"timestampz not null created" json:"createdAt"` | ||||
| 	CreatedAt time.Time `xorm:"timestampz not null created" json:"createdAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| } | ||||
|  | ||||
| type CreatedWithUser struct { | ||||
| @@ -12,7 +12,7 @@ type CreatedWithUser struct { | ||||
| } | ||||
|  | ||||
| type Deleted struct { | ||||
| 	DeletedAt *time.Time `xorm:"timestampz deleted" json:"deletedAt"` | ||||
| 	DeletedAt *time.Time `xorm:"timestampz deleted" json:"deletedAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| } | ||||
|  | ||||
| type DeletedWithUser struct { | ||||
| @@ -22,7 +22,7 @@ type DeletedWithUser struct { | ||||
|  | ||||
| type CreatedAndModified struct { | ||||
| 	Created        `xorm:"extends"` | ||||
| 	LastModifiedAt *time.Time `xorm:"timestampz updated" json:"lastModifiedAt"` | ||||
| 	LastModifiedAt *time.Time `xorm:"timestampz updated" json:"lastModifiedAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| } | ||||
|  | ||||
| type CreatedAndModifiedWithUser struct { | ||||
|   | ||||
| @@ -14,9 +14,9 @@ type UserCharge struct { | ||||
| 	Discount   decimal.Decimal `xorm:"numeric(5,4) not null" json:"discount"` | ||||
| 	Amount     decimal.Decimal `xorm:"numeric(12,2) not null" json:"amount"` | ||||
| 	Settled    bool            `xorm:"bool not null default false" json:"settled"` | ||||
| 	SettledAt  *time.Time      `xorm:"timestampz" json:"settledAt"` | ||||
| 	SettledAt  *time.Time      `xorm:"timestampz" json:"settledAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| 	Refunded   bool            `xorm:"bool not null default false" json:"refunded"` | ||||
| 	RefundedAt *time.Time      `xorm:"timestampz" json:"refundedAt"` | ||||
| 	RefundedAt *time.Time      `xorm:"timestampz" json:"refundedAt" time_format:"simple_datetime" time_location:"shanghai"` | ||||
| } | ||||
|  | ||||
| func (UserCharge) TableName() string { | ||||
|   | ||||
| @@ -17,7 +17,7 @@ type UserDetail struct { | ||||
| 	Contact                    *string         `xorm:"varchar(100)" json:"contact"` | ||||
| 	Phone                      *string         `xorm:"varchar(50)" json:"phone"` | ||||
| 	UnitServiceFee             decimal.Decimal `xorm:"numeric(8,2) not null" json:"unitServiceFee"` | ||||
| 	ServiceExpiration          time.Time       `xorm:"date not null" json:"serviceExpiration"` | ||||
| 	ServiceExpiration          time.Time       `xorm:"date not null" json:"serviceExpiration" time_format:"simple_date" time_location:"shanghai"` | ||||
| } | ||||
|  | ||||
| func (UserDetail) TableName() string { | ||||
| @@ -34,3 +34,12 @@ type JoinedUserDetail struct { | ||||
| func (JoinedUserDetail) TableName() string { | ||||
| 	return "user" | ||||
| } | ||||
|  | ||||
| type FullJoinedUserDetail struct { | ||||
| 	User       `xorm:"extends"` | ||||
| 	UserDetail `xorm:"extends"` | ||||
| } | ||||
|  | ||||
| func (FullJoinedUserDetail) TableName() string { | ||||
| 	return "user" | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user