|
@@ -636,14 +636,12 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
|
|
|
msg = "获取失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ fmt.Println("发送附件完成", len(list1))
|
|
|
var rep models.UserWhiteListRep
|
|
|
- for _, v := range list1 {
|
|
|
- rep.List = append(rep.List, v)
|
|
|
- }
|
|
|
for _, v := range list2 {
|
|
|
- rep.List = append(rep.List, v)
|
|
|
+ list1 = append(list1, v)
|
|
|
}
|
|
|
-
|
|
|
+ rep.List = list1
|
|
|
//创建excel
|
|
|
dir, errFile := os.Executable()
|
|
|
exPath := filepath.Dir(dir)
|
|
@@ -694,48 +692,51 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
|
|
|
cellL.Value = "备注"
|
|
|
cellM := rowTitle.AddCell()
|
|
|
cellM.Value = "权限(消费,医药,智造,科技,策略)"
|
|
|
- for _, item := range rep.List {
|
|
|
- row := sheet.AddRow()
|
|
|
- cellA := row.AddCell()
|
|
|
- cellA.Value = item.RealName
|
|
|
- cellB := row.AddCell()
|
|
|
- cellB.Value = item.Mobile
|
|
|
- cellC := row.AddCell()
|
|
|
- cellC.Value = item.CountryCode
|
|
|
- if len(item.Mobile) >= 11 && item.CountryCode == "" {
|
|
|
- cellC.Value = "86"
|
|
|
- }
|
|
|
- cellD := row.AddCell()
|
|
|
- cellD.Value = item.CompanyName
|
|
|
- cellE := row.AddCell()
|
|
|
- cellE.Value = ""
|
|
|
- cellF := row.AddCell()
|
|
|
- cellF.Value = ""
|
|
|
- cellG := row.AddCell()
|
|
|
- cellG.Value = ""
|
|
|
- cellH := row.AddCell()
|
|
|
- cellH.Value = item.SellerName
|
|
|
- cellI := row.AddCell()
|
|
|
- cellI.Value = ""
|
|
|
- cellJ := row.AddCell()
|
|
|
- cellJ.Value = ""
|
|
|
- cellK := row.AddCell()
|
|
|
- cellK.Value = ""
|
|
|
- cellL := row.AddCell()
|
|
|
- cellL.Value = ""
|
|
|
- cellM := row.AddCell()
|
|
|
- if item.Permission == "" {
|
|
|
- item.Permission = "专家/医药/智造/消费/研选/科技/策略/路演服务"
|
|
|
+
|
|
|
+ if len(rep.List) > 0 {
|
|
|
+ for _, item := range rep.List {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellA := row.AddCell()
|
|
|
+ cellA.Value = item.RealName
|
|
|
+ cellB := row.AddCell()
|
|
|
+ cellB.Value = item.Mobile
|
|
|
+ cellC := row.AddCell()
|
|
|
+ cellC.Value = item.CountryCode
|
|
|
+ if len(item.Mobile) >= 11 && item.CountryCode == "" {
|
|
|
+ cellC.Value = "86"
|
|
|
+ }
|
|
|
+ cellD := row.AddCell()
|
|
|
+ cellD.Value = item.CompanyName
|
|
|
+ cellE := row.AddCell()
|
|
|
+ cellE.Value = ""
|
|
|
+ cellF := row.AddCell()
|
|
|
+ cellF.Value = ""
|
|
|
+ cellG := row.AddCell()
|
|
|
+ cellG.Value = ""
|
|
|
+ cellH := row.AddCell()
|
|
|
+ cellH.Value = item.SellerName
|
|
|
+ cellI := row.AddCell()
|
|
|
+ cellI.Value = ""
|
|
|
+ cellJ := row.AddCell()
|
|
|
+ cellJ.Value = ""
|
|
|
+ cellK := row.AddCell()
|
|
|
+ cellK.Value = ""
|
|
|
+ cellL := row.AddCell()
|
|
|
+ cellL.Value = ""
|
|
|
+ cellM := row.AddCell()
|
|
|
+ if item.Permission == "" {
|
|
|
+ item.Permission = "专家/医药/智造/消费/研选/科技/策略/路演服务"
|
|
|
+ }
|
|
|
+ cellM.Value = item.Permission
|
|
|
}
|
|
|
- cellM.Value = item.Permission
|
|
|
}
|
|
|
errFile = xlsxFile.Save(downLoadnFilePath)
|
|
|
if errFile != nil {
|
|
|
msg = "保存文件失败Err:" + errFile.Error()
|
|
|
return
|
|
|
}
|
|
|
- title := "新增用户白名单"
|
|
|
- content := "新增用户白名单"
|
|
|
+ title := time.Now().Format("2006-01-02") + "新增白名单用户"
|
|
|
+ content := time.Now().Format("2006-01-02") + "新增白名单用户"
|
|
|
fileName := downLoadnFilePath
|
|
|
//if activityInfo.ChartPermissionName == "科技" {
|
|
|
// touser = utils.EmailTechnology
|
|
@@ -811,57 +812,66 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
|
|
|
cellM = rowTitle.AddCell()
|
|
|
cellM.Value = "权限(消费,医药,智造,科技,策略)"
|
|
|
//手机号冻结
|
|
|
- list3, err := models.GetFrozenUserWhiteList()
|
|
|
+ listFrozen, err := models.GetFrozenUserWhiteList() //手机号用户修改
|
|
|
+ listFrozenOutbound, err := models.GetFrozenUserWhiteListOutbound() //外呼手机号用户修改
|
|
|
+ if len(listFrozenOutbound) > 0 {
|
|
|
+ for _, v := range listFrozenOutbound {
|
|
|
+ listFrozen = append(listFrozen, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
if err != nil {
|
|
|
msg = "获取失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- for _, item := range list3 {
|
|
|
- row := sheet.AddRow()
|
|
|
- cellA := row.AddCell()
|
|
|
- cellA.Value = item.RealName
|
|
|
- cellB := row.AddCell()
|
|
|
- if item.Mobile != "" {
|
|
|
- cellB.Value = item.Mobile
|
|
|
- } else {
|
|
|
- cellB.Value = item.OutboundMobile
|
|
|
- }
|
|
|
- cellC := row.AddCell()
|
|
|
- if item.CountryCode != "" {
|
|
|
- cellC.Value = item.CountryCode
|
|
|
- } else {
|
|
|
- cellC.Value = item.OutboundCountryCode
|
|
|
+ if len(listFrozen) > 0 {
|
|
|
+ for _, item := range listFrozen {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ cellA := row.AddCell()
|
|
|
+ cellA.Value = item.RealName
|
|
|
+ cellB := row.AddCell()
|
|
|
+ if item.Mobile != "" {
|
|
|
+ cellB.Value = item.Mobile
|
|
|
+ } else {
|
|
|
+ cellB.Value = item.OutboundMobile
|
|
|
+ }
|
|
|
+ cellC := row.AddCell()
|
|
|
+ if item.CountryCode != "" {
|
|
|
+ cellC.Value = item.CountryCode
|
|
|
+ } else {
|
|
|
+ cellC.Value = item.OutboundCountryCode
|
|
|
+ }
|
|
|
+ cellD := row.AddCell()
|
|
|
+ cellD.Value = item.CompanyName
|
|
|
+ cellE := row.AddCell()
|
|
|
+ cellE.Value = ""
|
|
|
+ cellF := row.AddCell()
|
|
|
+ cellF.Value = ""
|
|
|
+ cellG := row.AddCell()
|
|
|
+ cellG.Value = ""
|
|
|
+ cellH := row.AddCell()
|
|
|
+ cellH.Value = item.SellerName
|
|
|
+ cellI := row.AddCell()
|
|
|
+ cellI.Value = ""
|
|
|
+ cellJ := row.AddCell()
|
|
|
+ cellJ.Value = ""
|
|
|
+ cellK := row.AddCell()
|
|
|
+ cellK.Value = ""
|
|
|
+ cellL := row.AddCell()
|
|
|
+ cellL.Value = ""
|
|
|
+ cellM := row.AddCell()
|
|
|
+ cellM.Value = item.PermissionName
|
|
|
}
|
|
|
- cellD := row.AddCell()
|
|
|
- cellD.Value = item.CompanyName
|
|
|
- cellE := row.AddCell()
|
|
|
- cellE.Value = ""
|
|
|
- cellF := row.AddCell()
|
|
|
- cellF.Value = ""
|
|
|
- cellG := row.AddCell()
|
|
|
- cellG.Value = ""
|
|
|
- cellH := row.AddCell()
|
|
|
- cellH.Value = item.SellerName
|
|
|
- cellI := row.AddCell()
|
|
|
- cellI.Value = ""
|
|
|
- cellJ := row.AddCell()
|
|
|
- cellJ.Value = ""
|
|
|
- cellK := row.AddCell()
|
|
|
- cellK.Value = ""
|
|
|
- cellL := row.AddCell()
|
|
|
- cellL.Value = ""
|
|
|
- cellM := row.AddCell()
|
|
|
- cellM.Value = item.PermissionName
|
|
|
}
|
|
|
errFile = xlsxFile.Save(downLoadnFilePath)
|
|
|
if errFile != nil {
|
|
|
msg = "保存文件失败Err:" + errFile.Error()
|
|
|
return
|
|
|
}
|
|
|
- title = "冻结用户白名单"
|
|
|
- content = "冻结用户白名单"
|
|
|
+ title = time.Now().Format("2006-01-02") + "删除白名单用户"
|
|
|
+ content = time.Now().Format("2006-01-02") + "删除白名单用户"
|
|
|
fileName = downLoadnFilePath
|
|
|
go utils.SendEmailHaveFile(title, content, fileName, "cxzhang@hzinsights.com;tshen@hzinsights.com")
|
|
|
+ //go utils.SendEmailHaveFile(title, content, fileName, "cxzhang@hzinsights.com")
|
|
|
time.Sleep(time.Duration(2) * time.Second) //延迟两秒,避免过多活动的时候邮件发送没有内容
|
|
|
defer func() {
|
|
|
os.Remove(downLoadnFilePath)
|
|
@@ -905,13 +915,16 @@ func SendEmailUserWhiteListChange(cont context.Context) (err error) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for _, v := range list3 {
|
|
|
+ for _, v := range listFrozen {
|
|
|
err = models.DeleteWxUserWhite(v)
|
|
|
if err != nil {
|
|
|
msg = "删除信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ fmt.Println("发送附件完成", len(list1))
|
|
|
+ fmt.Println("发送附件完成", len(list2))
|
|
|
fmt.Println("发送附件完成", len(rep.List))
|
|
|
+ fmt.Println("发送附件完成", len(listFrozen))
|
|
|
return
|
|
|
}
|