瀏覽代碼

fix:更新潜在用户列表查询

zqbao 9 月之前
父節點
當前提交
26bb859faf
共有 1 個文件被更改,包括 35 次插入8 次删除
  1. 35 8
      controllers/user.go

+ 35 - 8
controllers/user.go

@@ -735,20 +735,47 @@ func (this *UserController) PotentialList() {
 	}
 	}
 
 
 	if registerStartDate != "" {
 	if registerStartDate != "" {
-		condition += " AND u.register_time>? "
-		pars = append(pars, registerStartDate)
+		registerStartTime, er := time.Parse(utils.FormatDate, registerStartDate)
+		if er != nil {
+			br.Msg = "日期格式有误"
+			return
+		}
+		condition += " AND u.register_time>=? "
+		registerStartDateStr := registerStartTime.Format(utils.FormatDateTime)
+		pars = append(pars, registerStartDateStr)
 	}
 	}
 	if registerEndDate != "" {
 	if registerEndDate != "" {
-		condition += " AND u.register_time<? "
-		pars = append(pars, registerEndDate)
+		registerEndTime, er := time.Parse(utils.FormatDate, registerEndDate)
+		if er != nil {
+			br.Msg = "日期格式有误"
+			return
+		}
+		condition += " AND u.register_time<=? "
+		// 结束时间包含今天
+		registerEndTime = registerEndTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
+		registerEndDateStr := registerEndTime.Format(utils.FormatDateTime)
+		pars = append(pars, registerEndDateStr)
 	}
 	}
 	if lastUpdateStartDate != "" {
 	if lastUpdateStartDate != "" {
-		condition += " AND ur.create_time>? "
-		pars = append(pars, lastUpdateStartDate)
+		lastUpdateStartTime, er := time.Parse(utils.FormatDate, lastUpdateStartDate)
+		if er != nil {
+			br.Msg = "日期格式有误"
+			return
+		}
+		condition += " AND ur.create_time>=? "
+
+		lastUpdateStartDateStr := lastUpdateStartTime.Format(utils.FormatDateTime)
+		pars = append(pars, lastUpdateStartDateStr)
 	}
 	}
 	if lastUpdateEndDate != "" {
 	if lastUpdateEndDate != "" {
-		condition += " AND ur.create_time<? "
-		pars = append(pars, lastUpdateEndDate)
+		lastUpdateEndTime, er := time.Parse(utils.FormatDate, lastUpdateEndDate)
+		if er != nil {
+			br.Msg = "日期格式有误"
+			return
+		}
+		lastUpdateEndDateStr := lastUpdateEndTime.Format(utils.FormatDateTime)
+		condition += " AND ur.create_time<=? "
+		pars = append(pars, lastUpdateEndDateStr)
 	}
 	}
 	if pageSize <= 0 {
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
 		pageSize = utils.PageSize20