浏览代码

增加系统配置接口

kobe6258 4 月之前
父节点
当前提交
ef05f793e1
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      controllers/product.go

+ 8 - 1
controllers/product.go

@@ -413,6 +413,7 @@ func (this *ProductController) ProductList() {
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 	sortType := this.GetString("SortType")
+	sortColumn := this.GetString("SortColumn")
 	KeyWord := this.GetString("KeyWord")
 	CreatedTime := this.GetString("CreatedTime")
 	UpdatedTime := this.GetString("UpdatedTime")
@@ -429,7 +430,13 @@ func (this *ProductController) ProductList() {
 	if KeyWord != "" {
 		condition += " AND title like '%" + KeyWord + "%'"
 	}
-	sortCondition := " ORDER BY created_time "
+	var sortCondition string
+	if sortColumn == "" {
+		sortCondition = " ORDER BY created_time "
+	} else {
+		sortCondition = " ORDER BY " + sortColumn + " "
+	}
+
 	if sortType == "" {
 		sortType = "DESC"
 	}