Sfoglia il codice sorgente

Merge branch 'cygx/need_1007' of http://8.136.199.33:3000/hongze/hz_crm_api

zhangchuanxing 4 mesi fa
parent
commit
c327a4b4e1

+ 145 - 81
controllers/cygx/activity_meet.go

@@ -1610,6 +1610,7 @@ func (this *ActivityMeetCoAntroller) AttendanceDetail() {
 // @Title 线上活动进门财经关联匹配列表
 // @Description 获取线上活动进门财经关联匹配列表接口
 // @Param   KeyWord   query   string  false       "搜索关键词"
+// @Param   ActivityId   query   int  false       "搜索关键词"
 // @Success 200 {object} cygx.RoadshowDataTitleList
 // @router /activityMeet/matchingList [get]
 func (this *ActivityMeetCoAntroller) MatchingList() {
@@ -1629,7 +1630,19 @@ func (this *ActivityMeetCoAntroller) MatchingList() {
 		br.Msg = "请输入搜索内容"
 		return
 	}
-	list, err := cygx.GetRoadshowDataTitleList(keyWord)
+	activityId, _ := this.GetInt("ActivityId")
+
+	detail, err := cygx.GetAddActivityInfoById(activityId)
+	if err != nil {
+		br.Msg = "活动不存在"
+		br.ErrMsg = "活动ID错误,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+		return
+	}
+	dateTime := detail.ActivityTime
+	dateTime = utils.TimeRemoveHms(dateTime)
+	startTime := dateTime + " 00:00:00'"
+	endTime := dateTime + " 23:59:59'"
+	list, err := cygx.GetRoadshowDataTitleList(startTime, endTime, keyWord)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取信息失败,Err:" + err.Error()
@@ -1648,6 +1661,21 @@ func (this *ActivityMeetCoAntroller) MatchingList() {
 			list[k].RoadshowTitle = activityName
 		}
 	}
+
+	param := new(cygxService.GetYiDongActivityByApiReq)
+	param.MeetingStatus = "2"
+	param.ConveneStartStr = dateTime
+	param.ConveneEndStr = dateTime
+	actList := cygxService.GetYiDongActivityListByApi(param)
+	for _, v := range actList {
+		if strings.Contains(v.Title, keyWord) {
+			item := new(cygx.RoadshowDataTitle)
+			item.RoadshowTitle = v.Title
+			item.ActivityTime = dateTime
+			list = append(list, item)
+		}
+	}
+
 	resplist.List = list
 	br.Ret = 200
 	br.Success = true
@@ -1704,102 +1732,138 @@ func (this *ActivityMeetCoAntroller) MatchingByHand() {
 	var condition string
 	dateTime := detail.ActivityTime
 	dateTime = utils.TimeRemoveHms(dateTime)
-	condition += ` AND roadshow_begin_time >= ` + "'" + dateTime + " 00:00:00'"
-	condition += ` AND roadshow_begin_time  <= ` + "'" + dateTime + " 23:59:59'"
-	if len(slice) > 0 {
-		keyWord = slice[0]
-	}
-	if keyWord != "" {
-		list, err := cygx.GetRoadshowDataList(keyWord, condition)
-		if err != nil {
-			br.Msg = "手动归类失败"
-			br.ErrMsg = "获取进门财经数据失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
-			return
-		}
-		var roadshowId string
-		for _, v := range list {
-			if v.RoadshowId != "" {
-				roadshowId = v.RoadshowId
+
+	param := new(cygxService.GetYiDongActivityByApiReq)
+	param.MeetingStatus = "2"
+	param.ConveneStartStr = dateTime
+	param.ConveneEndStr = dateTime
+	actList := cygxService.GetYiDongActivityListByApi(param)
+
+	var ismatch bool // 是否匹配
+
+	//优先匹配易董的活动
+	if len(actList) > 0 {
+		for _, v := range actList {
+			var yidongTitle string
+			titleSlice := strings.Split(v.Title, "】")
+
+			for _, vt := range titleSlice {
+				yidongTitle = vt
+			}
+			//如果活动时间一致,而且标题还还包含关键词就建立匹配关系
+			if strings.Contains(detail.ActivityNameTask, yidongTitle) && detail.ActivityTime == v.Start {
+				err = cygx.UpdateCygxActivityyidongActivityId(v.ID, activityId)
+				if err != nil {
+					br.Msg = "手动归类失败"
+					br.ErrMsg = "建立易董活动匹配关系失败,UpdateCygxActivityyidongActivityId Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+					return
+				}
+				ismatch = true
+				go cygxService.GetYiDongActivityMeeting(v.ID, activityId)
 				break
 			}
+
 		}
-		needAddAttendanc := make([]*cygx.CygxActivityAttendanceDetail, 0)
-		if len(list) > 0 {
-			err = cygx.UpdateActivityRoadshowTitle(activityId, keyWord, roadshowId)
+	}
+
+	if !ismatch {
+		condition += ` AND roadshow_begin_time >= ` + "'" + dateTime + " 00:00:00'"
+		condition += ` AND roadshow_begin_time  <= ` + "'" + dateTime + " 23:59:59'"
+		if len(slice) > 0 {
+			keyWord = slice[0]
+		}
+		if keyWord != "" {
+			list, err := cygx.GetRoadshowDataList(keyWord, condition)
 			if err != nil {
 				br.Msg = "手动归类失败"
-				br.ErrMsg = "关联匹配类型失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+				br.ErrMsg = "获取进门财经数据失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
 				return
 			}
+			var roadshowId string
 			for _, v := range list {
-				if v.UserPhone != "" {
-					item := new(cygx.CygxActivityAttendanceDetail)
-					item.ActivityId = 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.CrmCompanyMapStatusId = v.CrmCompanyMapStatusId
-					item.CreateTime = time.Now()
-					mobileStr += "'" + v.UserPhone + "'" + ","
-
-					needAddAttendanc = append(needAddAttendanc, item)
+				if v.RoadshowId != "" {
+					roadshowId = v.RoadshowId
+					break
 				}
 			}
-			mobileStr = strings.TrimRight(mobileStr, ",")
-			if mobileStr == "" {
-				mobileStr = "1"
-			}
-			listUser, err := cygx.GetWxUserOutboundMobile(mobileStr)
-			if err != nil {
-				br.Msg = "手动归类失败!"
-				br.ErrMsg = "获取用户列表失败,Err:" + err.Error()
-				return
-			}
-			for _, v := range listUser {
-				userIdArr = append(userIdArr, v.UserId)
-			}
+			needAddAttendanc := make([]*cygx.CygxActivityAttendanceDetail, 0)
+			if len(list) > 0 {
+				err = cygx.UpdateActivityRoadshowTitle(activityId, keyWord, roadshowId)
+				if err != nil {
+					br.Msg = "手动归类失败"
+					br.ErrMsg = "关联匹配类型失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+					return
+				}
+				for _, v := range list {
+					if v.UserPhone != "" {
+						item := new(cygx.CygxActivityAttendanceDetail)
+						item.ActivityId = 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.CrmCompanyMapStatusId = v.CrmCompanyMapStatusId
+						item.CreateTime = time.Now()
+						mobileStr += "'" + v.UserPhone + "'" + ","
+
+						needAddAttendanc = append(needAddAttendanc, item)
+					}
+				}
+				mobileStr = strings.TrimRight(mobileStr, ",")
+				if mobileStr == "" {
+					mobileStr = "1"
+				}
+				listUser, err := cygx.GetWxUserOutboundMobile(mobileStr)
+				if err != nil {
+					br.Msg = "手动归类失败!"
+					br.ErrMsg = "获取用户列表失败,Err:" + err.Error()
+					return
+				}
+				for _, v := range listUser {
+					userIdArr = append(userIdArr, v.UserId)
+				}
 
-			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
+				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 = cygx.AddAttendancDetail(needAddAttendanc, activityId, mobileStr)
-			if err != nil {
+				err = cygx.AddAttendancDetail(needAddAttendanc, activityId, mobileStr)
+				if err != nil {
+					br.Msg = "手动归类失败"
+					br.ErrMsg = "手动归类失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+					return
+				}
+				go cygxService.AddCygxActivityRestrictSignupByAdmin(activityId)
+				go cygx.AddCygxActivityMeetDetailLogOnline(needAddAttendanc, activityId)
+				go cygxService.ActivityUserLabelLogAdd(activityId, userIdArr)                 //添加用户活动到会标签到Redis
+				go cygxService.AddctivitySignupDetailListByHand(needAddAttendanc, activityId) //手动匹配进门财经信息
+			} else {
 				br.Msg = "手动归类失败"
-				br.ErrMsg = "手动归类失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+				br.ErrMsg = "暂未找到匹配数据!"
 				return
 			}
-			go cygxService.AddCygxActivityRestrictSignupByAdmin(activityId)
-			go cygx.AddCygxActivityMeetDetailLogOnline(needAddAttendanc, activityId)
-			go cygxService.ActivityUserLabelLogAdd(activityId, userIdArr)                 //添加用户活动到会标签到Redis
-			go cygxService.AddctivitySignupDetailListByHand(needAddAttendanc, activityId) //手动匹配进门财经信息
-		} else {
-			br.Msg = "手动归类失败"
-			br.ErrMsg = "暂未找到匹配数据!"
-			return
 		}
 	}
 	//添加操作日志记录

+ 28 - 0
models/cygx/activity.go

@@ -130,6 +130,7 @@ type ActivityDetail struct {
 	Theme                     string `description:"主题"`
 	Expert                    string `description:"专家"`
 	ActivityName              string `description:"活动名称"`
+	ActivityNameTask          string `description:"活动名称定时任务同步的时候使用"`
 	OnlineParticipation       string `description:"网络参会"`
 	ReportLink                string `description:"报告链接"`
 	City                      string `description:"城市"`
@@ -732,3 +733,30 @@ func UpdateCygxActivityMomentsImg(momentsImg string, activityId int) (err error)
 	_, err = o.Raw(sql, momentsImg, activityId).Exec()
 	return
 }
+
+// UpdateCygxActivityyidongActivityId  ,建立与易董的活动关联
+func UpdateCygxActivityyidongActivityId(yidongActivityId string, activityId int) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := ` UPDATE cygx_activity SET yidong_activity_id_by_cygx = ?  WHERE activity_id=?   `
+	_, err = o.Raw(sql, yidongActivityId, activityId).Exec()
+	return
+}
+
+// UpdateCygxActivitySubmitMeetingByYidong  ,跟易董返回的用户状态修改活动以提交到会状态
+func UpdateCygxActivitySubmitMeetingByYidong(yidongActivityId string) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `UPDATE cygx_activity SET is_submit_meeting = 1 WHERE yidong_activity_id=? OR  yidong_activity_id_by_cygx = ? `
+	_, err = o.Raw(sql, yidongActivityId, yidongActivityId).Exec()
+	return
+}
+
+// UpdateCygxActivitySignupisMeetList 批量修改易董的活动,用户已到会
+func UpdateCygxActivitySignupisMeetList(condition string, pars []interface{}) (err error) {
+	if condition == "" {
+		return
+	}
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `UPDATE cygx_activity_signup SET is_meeting=1 WHERE  1= 1 ` + condition
+	_, err = o.Raw(sql, pars).Exec()
+	return
+}

+ 13 - 8
models/cygx/activity_attendance_detail.go

@@ -97,11 +97,16 @@ func AddAttendancDetail(items []*CygxActivityAttendanceDetail, activityId int, m
 		return
 	}
 	//插入提交信息
-	for _, v := range items {
-		_, err = to.Insert(v)
-		if err != nil {
-			return
-		}
+	//for _, v := range items {
+	//	_, err = to.Insert(v)
+	//	if err != nil {
+	//		return
+	//	}
+	//}
+
+	_, err = o.InsertMulti(len(items), items)
+	if err != nil {
+		return err
 	}
 	return
 }
@@ -246,10 +251,10 @@ type RoadshowDataTitleResp struct {
 	ActivityId int    `description:"活动ID"`
 }
 
-func GetRoadshowDataTitleList(title string) (list []*RoadshowDataTitle, err error) {
+func GetRoadshowDataTitleList(startTime, endTime, title string) (list []*RoadshowDataTitle, err error) {
 	o := orm.NewOrmUsingDB("comein_data")
-	sql := `SELECT roadshow_title, roadshow_begin_time as activity_time  FROM roadshow_data WHERE roadshow_title LIKE '%` + title + `%'  GROUP BY  roadshow_id `
-	_, err = o.Raw(sql).QueryRows(&list)
+	sql := `SELECT roadshow_title, roadshow_begin_time as activity_time  FROM roadshow_data WHERE  roadshow_begin_time > ? AND  roadshow_end_time < ?   AND roadshow_title LIKE '%` + title + `%'  GROUP BY  roadshow_id `
+	_, err = o.Raw(sql, startTime, endTime).QueryRows(&list)
 	return
 }
 

+ 35 - 0
models/cygx/activity_signup_detail.go

@@ -121,3 +121,38 @@ func UpdateActivitySignupDetailMulti(items []*CygxActivitySignupDetail) (err err
 	}
 	return
 }
+
+// UpdateActivitySignupDetailMultiByYiDong 易董批量修改用户报名信息且报名的人
+func UpdateActivitySignupDetailMultiByYiDong(items []*CygxActivitySignupDetail) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	p, err := o.Raw(` UPDATE cygx_activity_signup_detail SET 
+							first_meeting_time = ?,
+							last_meeting_time = ?,
+							meeting_status_str = ?,
+							position = ?,
+							real_name = ?,
+							duration = ?,
+							is_meeting = ?
+							WHERE mobile = ? AND activity_id = ? `).Prepare()
+	if err != nil {
+		return
+	}
+	defer func() {
+		_ = p.Close() // 别忘记关闭 statement
+	}()
+	for _, v := range items {
+		_, err = p.Exec(
+			v.FirstMeetingTime,
+			v.LastMeetingTime,
+			v.MeetingStatusStr,
+			v.Position,
+			v.RealName,
+			v.Duration,
+			v.IsMeeting,
+			v.Mobile, v.ActivityId)
+		if err != nil {
+			return
+		}
+	}
+	return
+}

+ 369 - 0
services/cygx/yidong.go

@@ -83,6 +83,74 @@ type PersonUser struct {
 	CreatePersonName string `description:"创建人姓名:创建时必填" json:"createPersonName"`
 }
 
+type YidongActivityResult struct {
+	ActivityJoinType               string  `json:"activityJoinType"`               // 活动入会类型,01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会
+	Banner                         string  `json:"banner"`                         // 宣传图
+	BusinessCardOpen               string  `json:"businessCardOpen"`               // 上传名片是否开启,1是 0否
+	BusinessCardRequired           string  `json:"businessCardRequired"`           // 上传名片是否必填,1是 0否
+	CertificateInformationOpen     string  `json:"certificateInformationOpen"`     // 证件信息是否开启,1是 0否
+	CertificateInformationRequired string  `json:"certificateInformationRequired"` // 证件信息是否必填,1是 0否
+	CompanyCodeOpen                string  `json:"companyCodeOpen"`                // 公司代码是否开启,1是 0否
+	CompanyCodeRequired            string  `json:"companyCodeRequired"`            // 公司代码是否必填,1是 0否
+	CompanyInfo                    string  `json:"companyInfo"`                    // 公司名称
+	CompanyShortNameOpen           string  `json:"companyShortNameOpen"`           // 公司名称是否开启,1是 0否
+	CompanyShortNameRequired       string  `json:"companyShortNameRequired"`       // 公司名称是否必填,1是 0否
+	End                            string  `json:"end"`                            // 活动结束时间
+	ID                             string  `json:"id"`                             // 活动主键id
+	IndustrySwName                 string  `json:"industrySwName"`                 // 行业
+	InviteeOpen                    *string `json:"inviteeOpen"`                    // 邀请机构是否开启,1是 0否
+	InviteeRequired                *string `json:"inviteeRequired"`                // 邀请机构是否必填,1是 0否
+	JobNameOpen                    string  `json:"jobNameOpen"`                    // 职务是否开启,1是 0否
+	JobNameRequired                string  `json:"jobNameRequired"`                // 职务是否必填,1是 0否
+	MailOpen                       string  `json:"mailOpen"`                       // 邮箱是否开启,1是 0否
+	MailRequired                   string  `json:"mailRequired"`                   // 邮箱是否必填,1是 0否
+	PersonNameOpen                 string  `json:"personNameOpen"`                 // 姓名是否开启,1是 0否
+	PersonNameRequired             string  `json:"personNameRequired"`             // 姓名是否必填,1是 0否
+	PersonTelephoneOpen            string  `json:"personTelephoneOpen"`            // 手机号是否开启,1是 0否
+	PersonTelephoneRequired        string  `json:"personTelephoneRequired"`        // 手机号是否必填,1是 0否
+	SignUpEnd                      string  `json:"signUpEnd"`                      // 报名结束时间,适应于报名审核后可入会,为空表示不限制报名时间
+	SignUpStart                    string  `json:"signUpStart"`                    // 报名开始时间,适应于报名审核后可入会,为空表示不限制报名时间
+	Start                          string  `json:"start"`                          // 活动开始时间
+	SyncFlag                       string  `json:"syncFlag"`                       // 同步有效性,同步有效性 1有效,0失效
+	Title                          string  `json:"title"`                          // 活动主题
+	Type                           string  `json:"type"`                           // 路演类型
+	URL                            string  `json:"url"`                            // 活动短链接
+}
+
+type YidongApifoxModal struct {
+	ErrorCode interface{}            `json:"errorCode"`
+	ErrorMsg  interface{}            `json:"errorMsg"`
+	Result    []YidongActivityResult `json:"result"`
+	Success   bool                   `json:"success"`
+	Timestamp int64                  `json:"timestamp"`
+}
+
+type YidongResultuser struct {
+	DeviceType        string `json:"deviceType"`       // 参会方式,1-PC,2-Mac,3-Android,4-IOS,5-Web,6-iPad,7-Android Pad,8-小程序,0-PSTN
+	Duration          string `json:"duration"`         // 云会议参会时长
+	DurationInteract  string `json:"durationInteract"` // 互动交流参会时长
+	DurationLive      string `json:"durationLive"`     // 直播参会时长
+	DurationReview    string `json:"durationReview"`   // 回看参会时长
+	EndTime           string `json:"endTime"`          // 云会议最后退会时间
+	EndTimeInteract   string `json:"endTimeInteract"`  // 互动交流最后退会时间
+	EndTimeLive       string `json:"endTimeLive"`      // 直播最后退会时间
+	EndTimeReview     string `json:"endTimeReview"`    // 回看最后退会时间
+	ID                string `json:"id"`               // 主键id
+	Mail              string `json:"mail" comment:"电子邮件"`
+	CompanyName       string `json:"company_name" comment:"公司名称"`
+	JobName           string `json:"jobName"`           // 职务
+	MobileCountryCode string `json:"mobileCountryCode"` // 手机号国际区号码
+	PersonName        string `json:"personName"`        // 姓名
+	PersonTelephone   string `json:"personTelephone"`   // 用户手机号
+	StartTime         string `json:"startTime"`         // 云会议最早入会时间
+	StartTimeInteract string `json:"startTimeInteract"` // 互动交流最早入会时间
+	StartTimeLive     string `json:"startTimeLive"`     // 直播最早入会时间
+	StartTimeReview   string `json:"startTimeReview"`   // 回看最早入会时间
+	Status            string `json:"status"`            // 状态,D表示被删除
+	UserID            string `json:"userId,omitempty"`  // 用户id
+	SignUpStatus      string `json:"sign_up_status" comment:"报名状态"`
+}
+
 // CheckYidongActivitySignupTime 校验易董的活动是否可以 添加报名
 func CheckYidongActivitySignupTime(activityInfo *cygx.ActivityDetail) (errstr string) {
 	if activityInfo.YidongSignUpEnd == "0000-00-00 00:00:00" {
@@ -752,3 +820,304 @@ func YiDongUpdateActivityStatus(activityId int) {
 	err = cygx.UpdateCygxActivityTencentConferenceNumber(activityInfo)
 	return
 }
+
+// GetLoginAuthCodeReq 获取登录编码请求体
+type GetYiDongActivityByApiReq struct {
+	MeetingStatus   string `json:"meetingStatus" description:"会议状态必需(0未开始1进行中2已结束)多个逗号分隔"`
+	ConveneStartStr string `json:"conveneStartStr" description:"活动日期范围开始"`
+	ConveneEndStr   string `json:"conveneEndStr" description:"活动日期范围结束"`
+	LastUpdateTime  string `json:"lastUpdateTime" description:"上次同步时间(用于筛选更新时间大于同步时间的活动数据)"`
+}
+
+// 根据条件获取易董建会列表信息
+func GetYiDongActivityListByApi(param *GetYiDongActivityByApiReq) (yiDongResult []YidongActivityResult) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("根据条件获取易董建会列表信息  GetYiDongActivityListByApi"+err.Error(), param), 2)
+		}
+	}()
+	var token string
+	token, _ = GetYidongToken()
+	url := utils.YiDongZhengTongYunUrl + "interact/activityManageApi/getRoadshowList?access_token=" + token
+	method := "POST"
+	data, e := json.Marshal(param)
+	if e != nil {
+		err = errors.New("data json marshal err: " + e.Error())
+		return
+	}
+
+	payload := strings.NewReader(string(data))
+	client := &http.Client{}
+	req, e := http.NewRequest(method, url, payload)
+	if e != nil {
+		err = errors.New(" http.NewRequest err: " + e.Error())
+		return
+	}
+	req.Header.Add("Content-Type", "application/json")
+
+	res, e := client.Do(req)
+	if e != nil {
+		err = errors.New(" client.Do err: " + e.Error())
+		return
+	}
+	defer res.Body.Close()
+	var ApifoxModal *YidongApifoxModal
+	body, e := ioutil.ReadAll(res.Body)
+	if e != nil {
+		err = errors.New("  ioutil.ReadAll: " + e.Error())
+		return
+	}
+
+	//添加请求日志记录
+	itemApiLog := new(cygx.CygxThreeApiLog)
+	itemApiLog.CreateTime = time.Now()
+	itemApiLog.Source = 1
+	itemApiLog.Url = url
+	itemApiLog.Body = utils.ReplaceSpaceAndWrap(fmt.Sprint(payload))
+	itemApiLog.Result = string(body)
+	go cygx.AddCygxThreeApiLog(itemApiLog)
+
+	err = json.Unmarshal(body, &ApifoxModal)
+	if err != nil {
+		fmt.Println("Getres.PublicGetDate Err:", err.Error())
+		return
+	}
+	if len(ApifoxModal.Result) > 0 {
+		yiDongResult = ApifoxModal.Result
+	} else {
+		yiDongResult = make([]YidongActivityResult, 0)
+	}
+	return
+}
+
+type GetYiDongActivityMeetByActivityIdReq struct {
+	ActivityId string `json:"activityId" description:"活动ID"`
+}
+
+type YidongApifoxModaluser struct {
+	ErrorCode interface{}        `json:"errorCode"`
+	ErrorMsg  interface{}        `json:"errorMsg"`
+	Result    []YidongResultuser `json:"result"`
+	Success   bool               `json:"success"`
+	Timestamp int64              `json:"timestamp"`
+}
+
+// 根据条件获取易董活动ID获取到会信息
+func GetYiDongActivityMeetDataByaAtivityId(ativityId string) (yiDongResult []YidongResultuser) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("根据条件获取易董建会列表信息  GetYiDongActivityListByApi"+err.Error(), ativityId), 2)
+		}
+	}()
+	var token string
+	token, _ = GetYidongToken()
+	url := utils.YiDongZhengTongYunUrl + "interact/activityManageApi/getAttendPersonList?access_token=" + token
+	method := "POST"
+	param := new(GetYiDongActivityMeetByActivityIdReq)
+	param.ActivityId = ativityId
+	data, e := json.Marshal(param)
+	if e != nil {
+		err = errors.New("data json marshal err: " + e.Error())
+		return
+	}
+
+	payload := strings.NewReader(string(data))
+	client := &http.Client{}
+	req, e := http.NewRequest(method, url, payload)
+	if e != nil {
+		err = errors.New(" http.NewRequest err: " + e.Error())
+		return
+	}
+	req.Header.Add("Content-Type", "application/json")
+	res, e := client.Do(req)
+	if e != nil {
+		err = errors.New(" client.Do err: " + e.Error())
+		return
+	}
+	defer res.Body.Close()
+	var ApifoxModal *YidongApifoxModaluser
+	body, e := ioutil.ReadAll(res.Body)
+	if e != nil {
+		err = errors.New(" ioutil.ReadAll err: " + e.Error())
+		return
+	}
+	e = json.Unmarshal(body, &ApifoxModal)
+	if e != nil {
+		err = errors.New(" json.Unmarshal  err: " + e.Error())
+		return
+	}
+
+	//添加请求日志记录
+	itemApiLog := new(cygx.CygxThreeApiLog)
+	itemApiLog.CreateTime = time.Now()
+	itemApiLog.Source = 1
+	itemApiLog.Url = url
+	itemApiLog.Body = utils.ReplaceSpaceAndWrap(fmt.Sprint(payload))
+	itemApiLog.Result = string(body)
+	go cygx.AddCygxThreeApiLog(itemApiLog)
+
+	err = json.Unmarshal(body, &ApifoxModal)
+	if err != nil {
+		fmt.Println("Getres.PublicGetDate Err:", err.Error())
+		return
+	}
+	if len(ApifoxModal.Result) > 0 {
+		yiDongResult = ApifoxModal.Result
+	} else {
+		yiDongResult = make([]YidongResultuser, 0)
+	}
+	return
+}
+
+// 根据条件获取易董活动ID获取到会信息
+func GetYiDongActivityMeeting(yidongActivityId string, cygxActivityId int) (yiDongResult []YidongResultuser) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("根据条件获取易董建会列表信息  GetYiDongActivityMeeting"+err.Error(), cygxActivityId), 2)
+		}
+	}()
+
+	//跟易董返回的用户状态修改活动以提交到会状态
+	e := cygx.UpdateCygxActivitySubmitMeetingByYidong(yidongActivityId)
+	if e != nil {
+		err = errors.New("UpdateCygxActivitySubmitMeetingByYidong err: " + e.Error())
+		return
+	}
+	meetDataList := GetYiDongActivityMeetDataByaAtivityId(yidongActivityId)
+	var mobiles []string
+	var mobileStr string
+	var mobileStrMeet string
+	mapActivityAttendanceDetail := make(map[string]*cygx.CygxActivityAttendanceDetail)
+	if len(meetDataList) > 0 {
+
+		var itemsUpdate []*cygx.CygxActivitySignupDetail
+		needAddAttendanc := make([]*cygx.CygxActivityAttendanceDetail, 0)
+
+		for _, vresult := range meetDataList {
+			if vresult.PersonTelephone == "" {
+				continue
+			}
+			if vresult.Duration != "" || vresult.DurationReview != "" {
+				mobiles = append(mobiles, vresult.PersonTelephone)
+				var itemDetail = new(cygx.CygxActivitySignupDetail)
+				if vresult.Duration != "" {
+					itemDetail.FirstMeetingTime = vresult.StartTime
+					itemDetail.LastMeetingTime = vresult.EndTime
+					itemDetail.Duration = vresult.Duration
+					itemDetail.MeetingStatusStr = "直播"
+				} else if vresult.DurationReview != "" {
+					itemDetail.FirstMeetingTime = vresult.StartTimeReview
+					itemDetail.LastMeetingTime = vresult.EndTimeReview
+					itemDetail.Duration = vresult.DurationReview
+					itemDetail.MeetingStatusStr = "回放"
+				}
+				itemDetail.Position = vresult.JobName
+				itemDetail.RealName = vresult.PersonName
+
+				itemDetail.Mobile = vresult.PersonTelephone
+				itemDetail.OutboundMobile = vresult.PersonTelephone
+				itemDetail.IsMeeting = 1
+				itemDetail.ActivityId = cygxActivityId
+				mapActivityAttendanceDetail[vresult.PersonTelephone] = new(cygx.CygxActivityAttendanceDetail)
+				mapActivityAttendanceDetail[vresult.PersonTelephone].FirstMeetingTime = vresult.StartTime
+				mapActivityAttendanceDetail[vresult.PersonTelephone].LastMeetingTime = vresult.EndTime
+				mapActivityAttendanceDetail[vresult.PersonTelephone].Duration = utils.GetAttendanceDetailSecondsByYiDong(vresult.Duration)
+				itemsUpdate = append(itemsUpdate, itemDetail)
+			}
+
+			item := new(cygx.CygxActivityAttendanceDetail)
+			item.ActivityId = cygxActivityId
+			item.Mobile = vresult.PersonTelephone
+			if vresult.Duration != "" {
+				if vresult.Duration != "" {
+					item.FirstMeetingTime = vresult.StartTime
+					item.LastMeetingTime = vresult.EndTime
+					item.Duration = vresult.Duration
+					item.MeetingStatusStr = "直播"
+				} else if vresult.DurationReview != "" {
+					item.FirstMeetingTime = vresult.StartTimeReview
+					item.LastMeetingTime = vresult.EndTimeReview
+					item.Duration = vresult.DurationReview
+					item.MeetingStatusStr = "回放"
+				}
+				item.Position = vresult.JobName
+				item.RealName = vresult.PersonName
+
+				item.FirstMeetingTime = vresult.StartTime
+				item.LastMeetingTime = vresult.EndTime
+				item.Duration = vresult.Duration
+				item.IsMeetingStr = 1
+				mobileStrMeet += "'" + vresult.PersonTelephone + "'" + ","
+				item.CreateTime = time.Now()
+				needAddAttendanc = append(needAddAttendanc, item)
+			}
+			mobileStr += "'" + vresult.PersonTelephone + "'" + ","
+
+		}
+		lenmobiles := len(mobiles)
+		if lenmobiles > 0 {
+			var parsYd []interface{}
+			var conditionYd string
+			conditionYd = ` AND mobile  IN (` + utils.GetOrmInReplace(lenmobiles) + `) AND  activity_id=?  `
+			parsYd = append(parsYd, mobiles, cygxActivityId)
+			e = cygx.UpdateCygxActivitySignupisMeetList(conditionYd, parsYd)
+			if e != nil {
+				err = errors.New("UpdateCygxActivitySignupisMeetList err: " + e.Error())
+				return
+			}
+			e = cygx.UpdateActivitySignupDetailMultiByYiDong(itemsUpdate)
+			if e != nil {
+				err = errors.New("UpdateActivitySignupDetailMultiByYiDong err: " + e.Error())
+				return
+			}
+		}
+
+		mobileStr = strings.TrimRight(mobileStr, ",")
+		if mobileStr == "" {
+			mobileStr = "1"
+		}
+		mobileStrMeet = strings.TrimRight(mobileStrMeet, ",")
+		if mobileStrMeet == "" {
+			mobileStrMeet = "1"
+		}
+
+		listUser, e := cygx.GetWxUserOutboundMobile(mobileStr)
+		if e != nil {
+			err = errors.New("GetWxUserOutboundMobile err: " + e.Error())
+			return
+		}
+		for kAdd, vAdd := range needAddAttendanc {
+			for _, v2 := range listUser {
+				if v2.OutboundMobile == vAdd.Mobile || v2.Mobile == vAdd.Mobile {
+					if needAddAttendanc[kAdd].CompanyId <= 1 {
+						needAddAttendanc[kAdd].CompanyId = v2.CompanyId
+						needAddAttendanc[kAdd].SellerName = v2.SellerName
+						needAddAttendanc[kAdd].CompanyName = v2.CompanyName
+						//needAddAttendanc[k].IsMeetingStr = 1
+					}
+				}
+			}
+		}
+
+		//参会记录
+		e = cygx.AddAttendancDetail(needAddAttendanc, cygxActivityId, mobileStrMeet)
+		if e != nil {
+			err = errors.New("AddAttendancDetail err: " + e.Error())
+			return
+		}
+		////处理是否限制报名
+		e = AddCygxActivityRestrictSignupByAdmin(cygxActivityId)
+		if e != nil {
+			err = errors.New("AddCygxActivityRestrictSignupByAdmin err: " + e.Error())
+			return
+		}
+		AddctivitySignupDetailListByHand(needAddAttendanc, cygxActivityId)
+	}
+	return
+}

+ 8 - 0
utils/common.go

@@ -2353,3 +2353,11 @@ func TruncateActivityNameString(s string) string {
 func GetLikeKeyword(keyword string) string {
 	return `%` + keyword + `%`
 }
+
+// 用户参会时间转换
+func GetAttendanceDetailSecondsByYiDong(str string) string {
+	var timeStr string
+	timeStr = strings.Replace(str, ":", "'", -1)
+	timeStr += "''"
+	return timeStr
+}