Browse Source

Merge branch 'crm/13.4' into debug

hsun 1 year ago
parent
commit
89ea2b28b7
1 changed files with 7 additions and 13 deletions
  1. 7 13
      controllers/english_report/email.go

+ 7 - 13
controllers/english_report/email.go

@@ -25,7 +25,7 @@ type EnglishReportEmailController struct {
 // @Param   CompanyId	query	int		false	"客户ID"
 // @Param   Keywords	query	string	false	"关键词:联系人名称/邮箱地址"
 // @Param   SortType	query	int		false	"点击量排序方式:1-倒序;2-正序"
-// @Param   SortParam	query	int		false	"排序字段:1-点击量;2-点击时间"
+// @Param   SortParam	query	int		false	"排序字段:1-点击量;2-点击时间 3-用户状态"
 // @Param   ListParam   query   int  	false   "筛选字段参数,用来筛选的字段, 枚举值:1:正式 、 2:临时 、 3:终止 、4:正式+临时 "
 // @Success 200 {object} models.EnglishReportEmailPageListResp
 // @router /email/list [get]
@@ -62,18 +62,12 @@ func (this *EnglishReportEmailController) List() {
 		pars = append(pars, k, k)
 	}
 
-	if sortParam == 1 {
-		if sortType == 1 {
-			order = ` ORDER BY a.view_total DESC`
-		} else {
-			order = ` ORDER BY a.view_total ASC`
-		}
-	} else {
-		if sortType == 1 {
-			order = ` ORDER BY a.create_time DESC`
-		} else {
-			order = ` ORDER BY a.create_time ASC`
-		}
+	sortParamArr := []int{1, 2, 3}
+	sortTypeArr := []int{1, 2}
+	if utils.InArrayByInt(sortParamArr, sortParam) && utils.InArrayByInt(sortTypeArr, sortType) {
+		pMap := map[int]string{1: "a.view_total", 2: "a.last_view_time", 3: "a.enabled"}
+		tMap := map[int]string{1: "DESC", 2: "ASC"}
+		order = fmt.Sprintf(` ORDER BY %s %s`, pMap[sortParam], tMap[sortType])
 	}
 
 	if listParam == 1 {