Convert unix timestamps to datetime
Cette révision appartient à :
Parent
c65711df66
révision
8934acc341
|
@ -7,6 +7,7 @@ import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Feed struct {
|
type Feed struct {
|
||||||
|
@ -44,7 +45,7 @@ type Torrents struct {
|
||||||
Sub_category_id int `gorm:"column:sub_category_id"`
|
Sub_category_id int `gorm:"column:sub_category_id"`
|
||||||
Status int `gorm:"column:status_id"`
|
Status int `gorm:"column:status_id"`
|
||||||
Hash string `gorm:"column:torrent_hash"`
|
Hash string `gorm:"column:torrent_hash"`
|
||||||
Date int `gorm:"column:date"`
|
Date int64 `gorm:"column:date"`
|
||||||
Downloads int `gorm:"column:downloads"`
|
Downloads int `gorm:"column:downloads"`
|
||||||
Filesize string `gorm:"column:filesize"`
|
Filesize string `gorm:"column:filesize"`
|
||||||
Description []byte `gorm:"column:description"`
|
Description []byte `gorm:"column:description"`
|
||||||
|
@ -77,7 +78,7 @@ type TorrentsJson struct {
|
||||||
Name string `json: "name"`
|
Name string `json: "name"`
|
||||||
Status int `json: "status"`
|
Status int `json: "status"`
|
||||||
Hash string `json: "hash"`
|
Hash string `json: "hash"`
|
||||||
Date int `json: "date"`
|
Date string `json: "date"`
|
||||||
Filesize string `json: "filesize"`
|
Filesize string `json: "filesize"`
|
||||||
Description template.HTML `json: "description"`
|
Description template.HTML `json: "description"`
|
||||||
Sub_Category SubCategoryJson `json: "sub_category"`
|
Sub_Category SubCategoryJson `json: "sub_category"`
|
||||||
|
@ -212,7 +213,7 @@ func (t *Torrents) toJson() TorrentsJson {
|
||||||
Name: html.UnescapeString(t.Name),
|
Name: html.UnescapeString(t.Name),
|
||||||
Status: t.Status,
|
Status: t.Status,
|
||||||
Hash: t.Hash,
|
Hash: t.Hash,
|
||||||
Date: t.Date,
|
Date: time.Unix(t.Date, 0).Format(time.RFC3339),
|
||||||
Filesize: t.Filesize,
|
Filesize: t.Filesize,
|
||||||
Description: template.HTML(unZlib(t.Description)),
|
Description: template.HTML(unZlib(t.Description)),
|
||||||
Sub_Category: t.Sub_Categories.toJson(),
|
Sub_Category: t.Sub_Categories.toJson(),
|
||||||
|
|
Référencer dans un nouveau ticket