Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Cette révision appartient à :
ayame-git 2017-05-09 05:44:08 +03:00
Parent c15ec0c551
révision 59b1e2bb5f
2 fichiers modifiés avec 20 ajouts et 20 suppressions

Voir le fichier

@ -20,23 +20,23 @@ type Feed struct {
} }
type Torrents struct { type Torrents struct {
Id uint `gorm:"column:torrent_id;primary_key"` Id uint `gorm:"column:torrent_id;primary_key"`
Name string `gorm:"column:torrent_name"` Name string `gorm:"column:torrent_name"`
Hash string `gorm:"column:torrent_hash"` Hash string `gorm:"column:torrent_hash"`
Category int `gorm:"column:category"` Category int `gorm:"column:category_od"`
Sub_Category int `gorm:"column:sub_category"` Sub_Category int `gorm:"column:sub_category_id"`
Status int `gorm:"column:status"` Status int `gorm:"column:status_id"`
Date time.Time `gorm:"column:date"` Date time.Time `gorm:"column:date"`
UploaderId uint `gorm:"column:uploader"` UploaderId uint `gorm:"column:uploader"`
Downloads int `gorm:"column:downloads"` Downloads int `gorm:"column:downloads"`
Stardom int `gorm:"column:stardom"` Stardom int `gorm:"column:stardom"`
Filesize int64 `gorm:"column:filesize"` Filesize int64 `gorm:"column:filesize"`
Description string `gorm:"column:description"` Description string `gorm:"column:description"`
WebsiteLink string `gorm:"column:website_link"` WebsiteLink string `gorm:"column:website_link"`
Uploader *User `gorm:"ForeignKey:uploader"` Uploader *User `gorm:"ForeignKey:uploader"`
OldComments []OldComment `gorm:"ForeignKey:torrent_id"` OldComments []OldComment `gorm:"ForeignKey:torrent_id"`
Comments []Comment `gorm:"ForeignKey:torrent_id"` Comments []Comment `gorm:"ForeignKey:torrent_id"`
} }
/* We need JSON Object instead because of Magnet URL that is not in the database but generated dynamically */ /* We need JSON Object instead because of Magnet URL that is not in the database but generated dynamically */

Voir le fichier

@ -79,11 +79,11 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
parameters := torrentService.WhereParams{} parameters := torrentService.WhereParams{}
conditions := []string{} conditions := []string{}
if searchCatId != "" { if searchCatId != "" {
conditions = append(conditions, "category = ?") conditions = append(conditions, "category_id = ?")
parameters.Params = append(parameters.Params, searchCatId) parameters.Params = append(parameters.Params, searchCatId)
} }
if searchSubCatId != "" { if searchSubCatId != "" {
conditions = append(conditions, "sub_category = ?") conditions = append(conditions, "sub_category_id = ?")
parameters.Params = append(parameters.Params, searchSubCatId) parameters.Params = append(parameters.Params, searchSubCatId)
} }
if userId != "" { if userId != "" {
@ -92,9 +92,9 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
} }
if search_param.Status != "" { if search_param.Status != "" {
if search_param.Status == "2" { if search_param.Status == "2" {
conditions = append(conditions, "status != ?") conditions = append(conditions, "status_id != ?")
} else { } else {
conditions = append(conditions, "status = ?") conditions = append(conditions, "status_id = ?")
} }
parameters.Params = append(parameters.Params, search_param.Status) parameters.Params = append(parameters.Params, search_param.Status)
} }