|
@@ -7,6 +7,7 @@ import (
|
|
|
"eta/eta_mini_crm_ht/models/response"
|
|
|
"eta/eta_mini_crm_ht/services"
|
|
|
"eta/eta_mini_crm_ht/utils"
|
|
|
+ "fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"math"
|
|
|
"strings"
|
|
@@ -1262,15 +1263,17 @@ func (this *UserController) GlobalSearch() {
|
|
|
br.Ret = 200
|
|
|
}
|
|
|
|
|
|
-// TemplateList
|
|
|
+// TemporaryList
|
|
|
// @Title 潜在用户列表
|
|
|
// @Description 潜在用户列表
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Param Keyword query string false "手机号"
|
|
|
+// @Param SortParam query string false "排序字段参数,用来排序的字段, 枚举值:0:注册时间,1:阅读数,2:最近一次阅读时间"
|
|
|
+// @Param SortType query string true "如何排序,是正序还是倒序,0:倒序,1:正序"
|
|
|
// @Success 200 {object} response.TemplateUserListResp
|
|
|
// @router /temporary/list [get]
|
|
|
-func (this *UserController) TemplateList() {
|
|
|
+func (this *UserController) TemporaryList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
this.Data["json"] = br
|
|
@@ -1297,16 +1300,36 @@ func (this *UserController) TemplateList() {
|
|
|
}
|
|
|
startSize := utils.StartIndex(currentIndex, pageSize)
|
|
|
|
|
|
+ sortParamInt, _ := this.GetInt("SortParam", 0)
|
|
|
+ sortTypeInt, _ := this.GetInt("SortType", 0)
|
|
|
+
|
|
|
+ var sortStr = ``
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
|
|
|
+ sortParamMap := map[int]string{0: "created_time", 1: "read_count", 2: "last_read_time"}
|
|
|
+ sortTypeMap := map[int]string{0: "desc", 1: "asc"}
|
|
|
+ sortParam, ok := sortParamMap[sortParamInt]
|
|
|
+ if !ok {
|
|
|
+ br.Msg = "错误的排序字段参数"
|
|
|
+ br.ErrMsg = fmt.Sprint("错误的排序字段:", sortParamInt)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sortType, ok := sortTypeMap[sortTypeInt]
|
|
|
+ if !ok {
|
|
|
+ br.Msg = "错误的排序字段"
|
|
|
+ br.ErrMsg = fmt.Sprint("错误的排序字段:", sortTypeInt)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sortStr = fmt.Sprintf("%s %s,updated_time desc ", sortParam, sortType)
|
|
|
+
|
|
|
if keyword != "" {
|
|
|
condition += ` AND mobile LIKE ? `
|
|
|
pars = utils.GetLikeKeywordPars(pars, keyword, 1)
|
|
|
}
|
|
|
|
|
|
resp := new(response.TemplateUserListResp)
|
|
|
- total, userList, err := models.GetPageTemplateUserList(condition, pars, startSize, pageSize)
|
|
|
+ total, userList, err := models.GetPageTemplateUserList(condition, pars, sortStr, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "查询用户失败"
|
|
|
br.Msg = "查询用户失败,系统错误,Err:" + err.Error()
|