renjiaojiao 3 years ago
parent
commit
868c9d1780

+ 1 - 1
src/customerService/customController.go

@@ -64,7 +64,7 @@ func MyCustomerList(context *admin.Context) (interface{}, error) {
 	}
 	log.Println(param)
 	adminPhone := context.User.Phone
-	count, data := MyCustomerService(param.State, param.UpdateTimeStart, param.UpdateTimeEnd, param.CompanyName, param.Phone, adminPhone, param.Page.Offset, param.Page.PageSize)
+	count, data := MyCustomerService(param.State, param.UpdateTimeStart, param.UpdateTimeEnd, param.CompanyName, param.Phone, adminPhone)
 	return map[string]interface{}{
 		"lists": data,
 		"total": count,

+ 2 - 2
src/customerService/customService.go

@@ -254,7 +254,7 @@ func CustomSendMsgService(param *customMsg, sendStatus int, loginUserName string
 	return 0, errors.New("发送消息出错")
 }
 
-func MyCustomerService(state, updateTimeStart, updateTimeEnd, companyName, phone, adminPhone string, offSet, pageSize int) (count int64, data []map[string]interface{}) {
+func MyCustomerService(state, updateTimeStart, updateTimeEnd, companyName, phone, adminPhone string) (count int64, data []map[string]interface{}) {
 	salesperson := util.CusTiDb.FindOne("jy_salesperson_info", map[string]interface{}{"phone": adminPhone}, "seatNumber", "")
 	if salesperson != nil && len(*salesperson) > 0 {
 		code := qutil.ObjToString((*salesperson)["seatNumber"])
@@ -281,7 +281,7 @@ func MyCustomerService(state, updateTimeStart, updateTimeEnd, companyName, phone
 			sqlStr += str
 			sqlc += str
 		}
-		sqlStr += " order by lastUpdateTime desc limit " + fmt.Sprint(offSet) + " " + "," + " " + fmt.Sprint(pageSize)
+		sqlStr += " order by lastUpdateTime desc "
 		log.Println("sql:", sqlStr)
 		log.Println("sqlc:", sqlc)
 		count = util.CusTiDb.CountBySql(sqlc)

+ 3 - 0
src/customerService/newsController.go

@@ -19,6 +19,9 @@ type MsgListParam struct {
 	SendTimeEnd     string `form:"sendTimeEnd"`     //发送时间  ---查询截止
 	UpdateTimeStart string `form:"updateTimeStart"` //最近一次修改时间  --查询起始时间
 	UpdateTimeEnd   string `form:"updateTimeEnd"`   //最近一次修改时间  --查询截止时间
+	Creator         string `form:"creator"`         //创建人
+	UserId          string `form:"userId"`          //1 用户id  2 用户手机号
+	Phone           string `form:"phone"`           //注册手机号
 	utils.Page
 }
 

+ 22 - 15
src/customerService/newsService.go

@@ -73,43 +73,49 @@ func MsgDetail(id int) (*map[string]interface{}, error) {
 	return nil, errors.New("查询出错")
 }
 
-//var Str = "id,send_usergroup_name,msg_type,title,content,send_mode,send_time,send_status,update_time,createtime,link,isdel,send_name,send_usergroup_id"
+var Str = "a.id,a.send_usergroup_name,a.msg_type,a.title,a.content,a.send_mode,a.send_time,a.send_status,a.update_time,a.createtime,a.link,a.isdel,a.send_name,a.send_usergroup_id,a.sign,a.user_add_way,a.template_name"
 
 //消息列表查询
 func MsgList(param *MsgListParam, isLookAllMsg, loginUserId int) (*[]map[string]interface{}, int) {
-	sql := "SELECT * FROM message_send_log "
+	sql := "SELECT " + Str + "  FROM message_send_log as a LEFT JOIN sendmsg_customer_info as b on a.id = b.msg_id "
 	str := ""
-	sqlc := "SELECT COUNt(*) FROM message_send_log "
+	sqlc := "SELECT COUNt(*) FROM message_send_log as a  LEFT JOIN sendmsg_customer_info as b on a.id = b.msg_id "
 	if param.UserGroupName != "" {
-		str += " send_usergroup_name = '" + param.UserGroupName + "' and"
+		str += " a.send_usergroup_name = '" + param.UserGroupName + "' and"
 	}
 	if param.MsgType != 0 {
-		str += " msg_type = " + strconv.Itoa(param.MsgType) + " and"
+		str += " a.msg_type = " + strconv.Itoa(param.MsgType) + " and"
 	}
 	if param.Title != "" {
-		str += " title like " + "'%" + param.Title + "%' and"
+		str += " a.title like " + "'%" + param.Title + "%' and"
 	}
 	if param.SendStatus != 0 {
-		str += " send_status = " + strconv.Itoa(param.SendStatus) + " and"
+		str += " a.send_status = " + strconv.Itoa(param.SendStatus) + " and"
 	}
 	if param.SendTimeStart != "" {
-		str += " send_time >= '" + param.SendTimeStart + " 00:00:00" + "' and"
+		str += " a.send_time >= '" + param.SendTimeStart + " 00:00:00" + "' and"
 	}
 	if param.SendTimeEnd != "" {
-		str += " send_time <= '" + param.SendTimeEnd + " 23:59:59" + "' and"
+		str += " a.send_time <= '" + param.SendTimeEnd + " 23:59:59" + "' and"
 	}
 	if param.UpdateTimeStart != "" {
-		str += " update_time >= '" + param.UpdateTimeStart + " 00:00:00" + "' and"
+		str += " a.update_time >= '" + param.UpdateTimeStart + " 00:00:00" + "' and"
 	}
 	if param.UpdateTimeEnd != "" {
-		str += " update_time <= '" + param.UpdateTimeEnd + " 23:59:59" + "' and"
+		str += " a.update_time <= '" + param.UpdateTimeEnd + " 23:59:59" + "' and"
 	}
 	if isLookAllMsg == 0 {
-		str += " send_userid = " + strconv.Itoa(loginUserId) + " and"
+		str += " a.send_userid = " + strconv.Itoa(loginUserId) + " and"
 	}
-	page := " order by id desc limit " + fmt.Sprint(param.Page.Offset) + " " + "," + " " + fmt.Sprint(param.Page.PageSize)
-	sql += " WHERE isdel = 1 and"
-	sqlc += " WHERE isdel = 1 and"
+	if param.Phone != "" {
+		str += " b.register_phone like '%" + param.Phone + "%' and"
+	}
+	if param.UserId != "" {
+		str += " b.user_id like '%" + param.Phone + "%' and"
+	}
+	page := " order by a.id desc limit " + fmt.Sprint(param.Page.Offset) + " " + "," + " " + fmt.Sprint(param.Page.PageSize)
+	sql += " WHERE a.isdel = 1 and"
+	sqlc += " WHERE a.isdel = 1 and"
 	if str != "" {
 		str = str[:len(str)-3]
 		sql += str
@@ -824,6 +830,7 @@ func pushMsg(param *SendMessage, sendStatus int) (int, error) {
 		"link":                param.Link,
 		"isdel":               1,
 		"send_userid":         "hjzx", //呼叫中心
+		"sign":                3,
 	})
 	msgLogId = strconv.FormatInt(msgId, 10)
 	//立即发送