Bläddra i källkod

feature(订单管理系统):
1、跟进时间范围修改

niezch 2 år sedan
förälder
incheckning
bde5354033

+ 1 - 2
opms_parent/app/model/cust/cust_customer.go

@@ -28,8 +28,7 @@ type CustCustomerSearchReq struct {
 	IsRemovePage bool   `json:"isRemovePage,omitempty"` //是否去掉分页
 	CustProvince string `json:"custProvince"`           // 所在省
 	CustCity     string `json:"custCity"`               // 所在市
-	CreateOn     string `json:"createOn"`
-	SalesName    string `json:"salesName"` // 所属于销售
+	SalesName    string `json:"salesName"`              // 所属于销售
 	request.PageReq
 }
 

+ 0 - 1
opms_parent/app/model/plat/plat_followup.go

@@ -20,7 +20,6 @@ type PlatFollowup internal.PlatFollowup
 type SearchPlatFollowupReq struct {
 	Sell            string `json:"sell"`
 	FollowType      string `json:"followType"`
-	CreateOn        string `json:"createOn"`
 	CustId          string `json:"custId"`
 	CustName        string `json:"custName"`
 	TargetType      string `son:"targetType"`

+ 5 - 8
opms_parent/app/service/cust/cust_customer.go

@@ -115,15 +115,12 @@ func (s *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int,
 	if req.SalesName != "" {
 		Model = Model.Where(s.Dao.C.SalesName+" like ?", "%"+req.SalesName+"%")
 	}
-	if req.CreateOn != "" {
-		dates := strings.Split(req.CreateOn, ",")
-		if len(dates) == 2 {
-			begin := dates[0]
-			end := dates[1]
-			Model = Model.Where(s.Dao.C.FollowUpDate+" >=? AND "+s.Dao.C.FollowUpDate+"<=?", begin, end)
-		}
+	// 获取日期区间范围内的记录
+	if req.BeginTime != "" && req.EndTime != "" {
+		begin := strings.Split(req.BeginTime, " ")[0] + " 00:00:00"
+		end := strings.Split(req.EndTime, " ")[0] + " 23:59:59"
+		Model = Model.WhereBetween(s.Dao.C.FollowUpDate, begin, end)
 	}
-
 	if req.IsRemovePage {
 		Model = Model
 	} else {

+ 6 - 13
opms_parent/app/service/plat/plat_followup.go

@@ -7,6 +7,7 @@ import (
 	"dashoo.cn/opms_libary/myerrors"
 	"database/sql"
 	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/os/gtime"
 	"github.com/gogf/gf/util/gconv"
 	"strconv"
 	"strings"
@@ -179,11 +180,11 @@ func (s *followupService) GetListByDay(req *model.SearchPlatFollowupReq) (total
 		followupModel = followupModel.Where("created_by", s.GetCxtUserId())
 	}
 	// 日期条件
-	//if req.DaysBeforeToday > 0 { // 获取前N天的跟进记录
-	//	now := gtime.Now()
-	//	begin := now.AddDate(0, 0, -req.DaysBeforeToday).Format("Y-m-d 00:00:00")
-	//	followupModel = followupModel.Where("follow_date>=?", begin)
-	//}
+	if req.DaysBeforeToday > 0 { // 获取前N天的跟进记录
+		now := gtime.Now()
+		begin := now.AddDate(0, 0, -req.DaysBeforeToday).Format("Y-m-d 00:00:00")
+		followupModel = followupModel.Where("follow_date>=?", begin)
+	}
 	// 获取日期区间范围内的记录
 	if req.BeginTime != "" && req.EndTime != "" {
 		begin := strings.Split(req.BeginTime, " ")[0] + " 00:00:00"
@@ -193,14 +194,6 @@ func (s *followupService) GetListByDay(req *model.SearchPlatFollowupReq) (total
 	if req.FollowType != "" {
 		followupModel = followupModel.Where("follow_type", req.FollowType)
 	}
-	if req.CreateOn != "" {
-		dates := strings.Split(req.CreateOn, ",")
-		if len(dates) == 2 {
-			begin := dates[0]
-			end := dates[1]
-			followupModel = followupModel.Where("follow_date>=? AND follow_date<=?", begin, end)
-		}
-	}
 	//跟进记录销售 添加销售人权限
 	if req.Sell != "" {
 		followupModel = followupModel.Where("created_by", s.CxtUser.Id)