1
This commit is contained in:
parent
01aa915c30
commit
d46244ea0c
@ -271,6 +271,14 @@ func (r *QuestionDao) GetQuestionPageSearch(req requests.GetQuestionPage, page,
|
||||
query = query.Order("discount_price " + req.Order.DiscountPrice)
|
||||
}
|
||||
|
||||
if req.Order.CreatedAt != "" {
|
||||
if req.Order.CreatedAt != "desc" && req.Order.CreatedAt != "asc" {
|
||||
return nil, 0, errors.New("排序字段错误")
|
||||
}
|
||||
|
||||
query = query.Order("created_at " + req.Order.CreatedAt)
|
||||
}
|
||||
|
||||
if req.Order.UpdatedAt != "" {
|
||||
if req.Order.UpdatedAt != "desc" && req.Order.UpdatedAt != "asc" {
|
||||
return nil, 0, errors.New("排序字段错误")
|
||||
|
||||
@ -34,6 +34,7 @@ type GetQuestionPageOrder struct {
|
||||
Price string `json:"price" form:"price" label:"排序"` // 价格(原价)
|
||||
DiscountPrice string `json:"discount_price" form:"discount_price" label:"排序"` // 优惠价格
|
||||
UpdatedAt string `json:"updated_at" form:"updated_at" label:"排序"`
|
||||
CreatedAt string `json:"created_at" form:"created_at" label:"排序"`
|
||||
}
|
||||
|
||||
// GetQuestionList 获取问题列表
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user