浏览代码

fix:修复用户列表和阅读列表的筛选项

zqbao 7 月之前
父节点
当前提交
ce0961e33b
共有 2 个文件被更改,包括 10 次插入34 次删除
  1. 5 17
      controllers/user.go
  2. 5 17
      controllers/user_read_record.go

+ 5 - 17
controllers/user.go

@@ -462,7 +462,7 @@ func (this *UserController) Check() {
 // @Description 用户列表
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Param   SellerId   query   string  true       "销售id"
+// @Param   SellerDepartmentId   query   string  true       "营业部门id"
 // @Param   Status   query   int  true       "用户状态"
 // @Param   KeyWord   query   string  true       "手机号/邮箱/姓名"
 // @Param   IsRegistered   query   string  true       "是否注册"
@@ -483,7 +483,7 @@ func (this *UserController) List() {
 	}()
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
-	sellerIdStr := this.GetString("SellerId")
+	sellerDepartmentId, _ := this.GetInt("SellerDepartmentId", 0)
 	status := this.GetString("Status")
 	keyWord := this.GetString("KeyWord")
 	IsRegistered := this.GetString("IsRegistered")
@@ -540,21 +540,9 @@ func (this *UserController) List() {
 		sortCondition = " ORDER BY u.create_time DESC"
 	}
 
-	if sellerIdStr != "" {
-		sellerIds := strings.Split(sellerIdStr, ",")
-		if len(sellerIds) != 0 {
-			condition += ` AND ( `
-			for i, id := range sellerIds {
-				if i == 0 {
-					condition += ` u.seller_id = ? `
-					pars = append(pars, id)
-				} else {
-					condition += ` OR u.seller_id = ? `
-					pars = append(pars, id)
-				}
-			}
-			condition += `) `
-		}
+	if sellerDepartmentId > 0 {
+		condition += ` AND u.seller_department_id = ? `
+		pars = append(pars, sellerDepartmentId)
 	}
 	switch status {
 	case "禁用":

+ 5 - 17
controllers/user_read_record.go

@@ -21,7 +21,7 @@ type UserReadRecordController struct {
 // @Description 用户阅读统计列表
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Param   SellerId   query   int  true       "销售id"
+// @Param   SellerDepartmentId   query   int  true       "营业部门id"
 // @Param   Status   query   string  true       "用户状态"
 // @Param   KeyWord   query   string  true       "手机号/邮箱/姓名"
 // @Param   IsRegistered   query   string  true       "是否注册"
@@ -43,7 +43,7 @@ func (this *UserReadRecordController) List() {
 
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
-	sellerIdStr := this.GetString("SellerId")
+	sellerDepartmentId, _ := this.GetInt("SellerDepartmentId", 0)
 	status := this.GetString("Status")
 	keyWord := this.GetString("KeyWord")
 	IsRegistered := this.GetString("IsRegisterd")
@@ -73,21 +73,9 @@ func (this *UserReadRecordController) List() {
 		currentIndex = 1
 	}
 
-	if sellerIdStr != "" {
-		sellerIds := strings.Split(sellerIdStr, ",")
-		if len(sellerIds) != 0 {
-			condition += ` AND ( `
-			for i, id := range sellerIds {
-				if i == 0 {
-					condition += ` u.seller_id = ? `
-					pars = append(pars, id)
-				} else {
-					condition += ` OR u.seller_id = ? `
-					pars = append(pars, id)
-				}
-			}
-			condition += `) `
-		}
+	if sellerDepartmentId > 0 {
+		condition += " AND u.seller_department_id=? "
+		pars = append(pars, sellerDepartmentId)
 	}
 	if sortParam != "" && sortType != "" {
 		sortCondition = " ORDER BY "