|
@@ -2,6 +2,7 @@ package services
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/utils"
|
|
@@ -253,6 +254,28 @@ func AddctivitySignupDetailByJmcjNew(itemsDetail []*models.CygxActivityAttendanc
|
|
|
var itemsAdd []*models.CygxActivitySignupDetail
|
|
|
var itemsUpdate []*models.CygxActivitySignupDetail
|
|
|
|
|
|
+ var mobiles []string
|
|
|
+ mobileMap := make(map[string]bool)
|
|
|
+ mobileUserMap := make(map[string]int)
|
|
|
+ for _, v := range itemsDetail {
|
|
|
+ if !mobileMap[v.Mobile] {
|
|
|
+ mobiles = append(mobiles, v.Mobile)
|
|
|
+ }
|
|
|
+ mobileMap[v.Mobile] = true
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ listUser, e := models.GetWxUserByOutboundMobiles(mobiles)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetWxUserOutboundMobiles, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listUser {
|
|
|
+ mobileUserMap[v.Mobile] = v.UserId
|
|
|
+ }
|
|
|
+
|
|
|
for _, v := range itemsDetail {
|
|
|
var item = new(models.CygxActivitySignupDetail)
|
|
|
item.ActivityId = v.ActivityId
|
|
@@ -279,6 +302,7 @@ func AddctivitySignupDetailByJmcjNew(itemsDetail []*models.CygxActivityAttendanc
|
|
|
item.UseridEntity = v.UseridEntity
|
|
|
item.ActivityTime = v.ActivityTime
|
|
|
item.CrmCompanyMapStatusId = v.CrmCompanyMapStatusId
|
|
|
+ item.UserId = mobileUserMap[v.Mobile]
|
|
|
|
|
|
if _, ok := mapsignUpDetai[fmt.Sprint("ActivityId", v.ActivityId, "Mobile", item.Mobile)]; !ok {
|
|
|
itemsAdd = append(itemsAdd, item)
|
|
@@ -308,3 +332,46 @@ func AddctivitySignupDetailByJmcjNew(itemsDetail []*models.CygxActivityAttendanc
|
|
|
}
|
|
|
return err
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|