|
@@ -610,28 +610,23 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
|
|
|
dateNow := time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
|
|
|
startDate := dateTime + " 00:00:00"
|
|
|
endDate := dateNow + " 23:59:59"
|
|
|
- //获取需要处理的活动
|
|
|
- //listActivity, err := models.GetActivityListByDateTime(startDate, endDate)
|
|
|
- //if err != nil {
|
|
|
- // fmt.Println("GetTacticsList Err:", err.Error())
|
|
|
- // return err
|
|
|
- //}
|
|
|
//获取进门财经需要处理的活动
|
|
|
listActivityRoadshow, err := models.GetRoadshowDataListByDateTime(startDate, endDate)
|
|
|
if err != nil {
|
|
|
fmt.Println("GetRoadshowDataListByDateTime Err:", err.Error())
|
|
|
return err
|
|
|
}
|
|
|
-
|
|
|
- //fmt.Println(listActivity)
|
|
|
-
|
|
|
for _, vAct := range listActivityRoadshow {
|
|
|
doTime := utils.TimeRemoveHms2(vAct.RoadshowBeginTime)
|
|
|
findStartDate := doTime + " 00:00:00"
|
|
|
findEndDate := doTime + " 23:59:59"
|
|
|
+ var roadshowTitle string
|
|
|
+ roadshowTitle = vAct.RoadshowTitle
|
|
|
vAct.RoadshowTitle = strings.Replace(vAct.RoadshowTitle, "【", "", -1)
|
|
|
vAct.RoadshowTitle = strings.Replace(vAct.RoadshowTitle, "】", "", -1)
|
|
|
vAct.RoadshowTitle = strings.Replace(vAct.RoadshowTitle, " ", "", -1)
|
|
|
+ vAct.RoadshowTitle = strings.Replace(vAct.RoadshowTitle, "-", "", -1)
|
|
|
+ vAct.RoadshowTitle = strings.Replace(vAct.RoadshowTitle, ":", "", -1)
|
|
|
nameSlice := strings.Split(vAct.RoadshowTitle, "|")
|
|
|
//fmt.Println(timeSlice[0])
|
|
|
//对于手动匹配到的活动数据也要更新
|
|
@@ -651,14 +646,15 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
|
|
|
} else {
|
|
|
activityIds += strconv.Itoa(activityDetail.ActivityId) + ","
|
|
|
}
|
|
|
- list, err := models.GetRoadshowDataList(activityName, findStartDate, findEndDate)
|
|
|
+ list, err := models.GetRoadshowDataList(roadshowTitle, findStartDate, findEndDate)
|
|
|
if err != nil {
|
|
|
fmt.Println("GetTacticsList Err:", err.Error())
|
|
|
return err
|
|
|
}
|
|
|
+ //fmt.Println("原来的", vAct.RoadshowTitle)
|
|
|
+ //fmt.Println("处理的", activityName)
|
|
|
+
|
|
|
needAddAttendanc := make([]*models.CygxActivityAttendanceDetail, 0)
|
|
|
- fmt.Println("原来的", vAct.RoadshowTitle)
|
|
|
- fmt.Println("处理的", activityName)
|
|
|
var mobileStr string
|
|
|
if len(list) > 0 {
|
|
|
for _, v := range list {
|
|
@@ -734,11 +730,106 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //for _, v := range listActivity {
|
|
|
- // activityIds += strconv.Itoa(v.ActivityId) + ","
|
|
|
- //}
|
|
|
- activityIds = strings.TrimRight(activityIds, ",")
|
|
|
+ //获取需要处理的活动
|
|
|
+ listActivity, err := models.GetActivityListByDateTime(startDate, endDate, activityIds)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("GetTacticsList Err:", err.Error())
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ //通过本地去找进门财经的数据
|
|
|
+ for _, vAct := range listActivity {
|
|
|
+ doTime := utils.TimeRemoveHms2(vAct.ActivityName)
|
|
|
+ findStartDate := doTime + " 00:00:00"
|
|
|
+ findEndDate := doTime + " 23:59:59"
|
|
|
+ var roadshowTitle string
|
|
|
+ nameSlice := strings.Split(vAct.ActivityName, "|")
|
|
|
+ //对于手动匹配到的活动数据也要更新
|
|
|
+ var activityName string
|
|
|
+ if len(nameSlice) > 1 {
|
|
|
+ if vAct.JmcjRoadshowTitle != "" {
|
|
|
+ activityName = vAct.JmcjRoadshowTitle
|
|
|
+ } else {
|
|
|
+ activityName = nameSlice[len(nameSlice)-1]
|
|
|
+ }
|
|
|
+ //fmt.Println("原来的1", vAct.ActivityName)
|
|
|
+ //fmt.Println("处理的2", activityName)
|
|
|
+ activityName = nameSlice[len(nameSlice)-1]
|
|
|
+ if activityName != "" {
|
|
|
+ list, err := models.GetRoadshowDataList(roadshowTitle, findStartDate, findEndDate)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("GetTacticsList Err:", err.Error())
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ needAddAttendanc := make([]*models.CygxActivityAttendanceDetail, 0)
|
|
|
+ var mobileStr string
|
|
|
+ if len(list) > 0 {
|
|
|
+ for _, v := range list {
|
|
|
+ if v.UserPhone != "" {
|
|
|
+ item := new(models.CygxActivityAttendanceDetail)
|
|
|
+ item.ActivityId = vAct.ActivityId
|
|
|
+ item.RealName = v.UserName
|
|
|
+ item.Mobile = v.UserPhone
|
|
|
+ item.CompanyName = v.Company
|
|
|
+ //item.SellerName = sellerName
|
|
|
+ item.FirstMeetingTime = v.FirstWatchTime
|
|
|
+ item.LastMeetingTime = v.LastWatchTime
|
|
|
+ item.Duration = utils.GetAttendanceDetailSeconds(v.JoinTime)
|
|
|
+ if v.JoinType == 1 {
|
|
|
+ item.MeetingTypeStr = "网络"
|
|
|
+ } else {
|
|
|
+ item.MeetingTypeStr = "电话"
|
|
|
+ }
|
|
|
+ item.MeetingAuthentication = v.AuthInfo
|
|
|
+ if v.DataType == 1 {
|
|
|
+ item.MeetingStatusStr = "直播"
|
|
|
+ } else {
|
|
|
+ item.MeetingStatusStr = "回放"
|
|
|
+ }
|
|
|
+ item.Position = v.Occupation
|
|
|
+ item.UseridEntity = v.UseridEntity
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ mobileStr += "'" + v.UserPhone + "'" + ","
|
|
|
+ needAddAttendanc = append(needAddAttendanc, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mobileStr = strings.TrimRight(mobileStr, ",")
|
|
|
+ if mobileStr == "" {
|
|
|
+ mobileStr = "1"
|
|
|
+ }
|
|
|
+ listUser, err := models.GetWxUserOutboundMobile(mobileStr)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("GetWxUserOutboundMobile Err:", err.Error())
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ for k, v := range needAddAttendanc {
|
|
|
+ for _, v2 := range listUser {
|
|
|
+ if v2.OutboundMobile == v.Mobile {
|
|
|
+ needAddAttendanc[k].CompanyId = v2.CompanyId
|
|
|
+ needAddAttendanc[k].SellerName = v2.SellerName
|
|
|
+ needAddAttendanc[k].CompanyName = v2.CompanyName
|
|
|
+ needAddAttendanc[k].IsMeetingStr = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //参会记录
|
|
|
+ err = models.AddAttendancDetail(needAddAttendanc, vAct.ActivityId, mobileStr)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("AddAttendancDetail Err:", err.Error())
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ ////处理是否限制报名
|
|
|
+ err = AddCygxActivityRestrictSignupByAdmin(vAct.ActivityId)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("AddCygxActivityRestrictSignupByAdmin Err:", err.Error())
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ activityIds += strconv.Itoa(vAct.ActivityId) + ","
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ activityIds = strings.TrimRight(activityIds, ",")
|
|
|
if activityIds != "" {
|
|
|
detailList, err := models.GetActivityAttendanceDetailList(activityIds)
|
|
|
if err != nil {
|