Browse Source

新增白名单,添加外呼手机号判断

xingzai 3 years ago
parent
commit
6230913f32
1 changed files with 13 additions and 10 deletions
  1. 13 10
      services/user.go

+ 13 - 10
services/user.go

@@ -617,7 +617,7 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
 	//手机号新增
 	fieldStr = ` u.mobile,u.country_code,u.real_name,c.company_name,u.company_id,cp.seller_name,cp.status,`
 	condition = `  AND cp.status IN ( '正式', '试用' ) AND u.mobile IN (` + mobileStr + `) `
-	list1, err := models.GetFormalUserWhiteList(fieldStr, condition)
+	listMobile, err := models.GetFormalUserWhiteList(fieldStr, condition)
 	if err != nil {
 		msg = "获取失败,Err:" + err.Error()
 		return
@@ -629,15 +629,18 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
 	}
 	fieldStr = ` u.outbound_mobile as mobile,u.outbound_country_code as country_code,u.real_name,c.company_name,u.company_id,cp.status,`
 	condition = `  AND cp.status IN ( '正式', '试用' ) AND u.outbound_mobile IN (` + outboundMobileStr + `) `
-	list2, err := models.GetFormalUserWhiteList(fieldStr, condition)
+	listOutboundMobile, err := models.GetFormalUserWhiteList(fieldStr, condition)
 	if err != nil {
 		msg = "获取失败,Err:" + err.Error()
 		return
 	}
 	var rep models.UserWhiteListRep
 	var repList []*models.UserWhiteList
-	for _, v := range list2 {
-		repList = append(list1, v)
+	repList = listMobile
+	if len(listOutboundMobile) > 0 {
+		for _, v := range listOutboundMobile {
+			repList = append(listMobile, v)
+		}
 	}
 	rep.List = repList
 	//创建excel
@@ -860,9 +863,9 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
 	fmt.Println(sendResult2)
 	os.Remove(downLoadnFilePaths)
 	if sendResult {
-		fmt.Println(len(list1))
-		if len(list1) > 0 {
-			for _, v := range list1 {
+		fmt.Println(len(listMobile))
+		if len(listMobile) > 0 {
+			for _, v := range listMobile {
 				item := new(models.WxUserWhite)
 				item.Mobile = v.Mobile
 				item.CountryCode = v.CountryCode
@@ -880,9 +883,9 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
 				}
 			}
 		}
-		if len(list2) > 0 {
-			fmt.Println(len(list2))
-			for _, v := range list2 {
+		if len(listOutboundMobile) > 0 {
+			fmt.Println(len(listOutboundMobile))
+			for _, v := range listOutboundMobile {
 				item := new(models.WxUserWhite)
 				item.OutboundMobile = v.Mobile
 				item.OutboundCountryCode = v.CountryCode