瀏覽代碼

no message

xingzai 6 月之前
父節點
當前提交
ba2810351d
共有 1 個文件被更改,包括 13 次插入4 次删除
  1. 13 4
      controllers/cygx/rai_serve.go

+ 13 - 4
controllers/cygx/rai_serve.go

@@ -316,6 +316,7 @@ func (this *RaiServeCoAntroller) ChcckPermissionName() {
 // @Param   TagId   int   string  false       "标签ID"
 // @Param   Status   query   string  false       "客户状态,正式、未续约(除了正式之外的所有)"
 // @Param   SortType   query   string  true       "如何排序,是正序还是倒序,枚举值:`asc 正序`,`desc 倒叙`"
+// @Param   SortParam   query   string  false       "排序字段参数,用来排序的字段, 枚举值:'money':金额 、 'endDate':结束时间"
 // @Param   KeyWord   query   string  false       "搜索关键词"
 // @Param   IsExport   query   bool  false       "是否导出excel,默认是false"
 // @Success 200 {object} cygx.RaiServeTagListResp
@@ -339,6 +340,8 @@ func (this *RaiServeCoAntroller) List() {
 	status := this.GetString("Status")
 	sellerId := this.GetString("SellerId")
 	shareSellerId := this.GetString("ShareSellerId")
+	//排序参数
+	sortParam := this.GetString("SortParam")
 	sortType := this.GetString("SortType")
 	tagType, _ := this.GetInt("TagType")
 	tagId, _ := this.GetInt("TagId")
@@ -379,11 +382,17 @@ func (this *RaiServeCoAntroller) List() {
 		//pars = append(pars, shareSellerId)
 	}
 
-	if sortType != "" {
+	if sortType != "" && sortParam != "" {
+		if sortParam == "money" {
+			sortStr = " ORDER BY money   "
+		}
+		if sortParam == "endDate" {
+			sortStr = " ORDER BY end_date   "
+		}
 		if sortType == "asc" {
-			sortStr = " ORDER BY money  ASC "
-		} else if sortType == "desc" {
-			sortStr = " ORDER BY money DESC "
+			sortStr += " ASC "
+		} else {
+			sortStr += " DESC "
 		}
 	} else {
 		sortStr = " ORDER BY end_date DESC "