Added User Search Functionality
Cette révision appartient à :
Parent
e845009057
révision
c15ec0c551
1 fichiers modifiés avec 5 ajouts et 0 suppressions
|
@ -37,6 +37,7 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
|
|||
search_param.Status = r.URL.Query().Get("s")
|
||||
search_param.Sort = r.URL.Query().Get("sort")
|
||||
search_param.Order = r.URL.Query().Get("order")
|
||||
userId := r.URL.Query().Get("userId")
|
||||
|
||||
catsSplit := strings.Split(search_param.Category, "_")
|
||||
// need this to prevent out of index panics
|
||||
|
@ -85,6 +86,10 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
|
|||
conditions = append(conditions, "sub_category = ?")
|
||||
parameters.Params = append(parameters.Params, searchSubCatId)
|
||||
}
|
||||
if userId != "" {
|
||||
conditions = append(conditions, "uploader = ?")
|
||||
parameters.Params = append(parameters.Params, userId)
|
||||
}
|
||||
if search_param.Status != "" {
|
||||
if search_param.Status == "2" {
|
||||
conditions = append(conditions, "status != ?")
|
||||
|
|
Référencer dans un nouveau ticket