|
@@ -179,9 +179,11 @@ func GetYiDongToken() (token string, err error) {
|
|
|
|
|
|
//获取易董活动列表
|
|
|
func GetYiDongActivity(cont context.Context) (err error) {
|
|
|
+ //func GetYiDongActivity() (err error) {
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
+ go utils.SendAlarmMsg("获取易董活动列表失败:"+err.Error(), 2)
|
|
|
utils.FileLog.Info(err.Error())
|
|
|
}
|
|
|
}()
|
|
@@ -215,8 +217,16 @@ func GetYiDongActivity(cont context.Context) (err error) {
|
|
|
utils.FileLog.Info(err.Error())
|
|
|
return
|
|
|
}
|
|
|
- fmt.Println(body)
|
|
|
- utils.FileLog.Info(string(body))
|
|
|
+
|
|
|
+ //添加请求日志记录
|
|
|
+ itemApiLog := new(models.CygxThreeApiLog)
|
|
|
+ itemApiLog.CreateTime = time.Now()
|
|
|
+ itemApiLog.Source = 1
|
|
|
+ itemApiLog.Url = url
|
|
|
+ itemApiLog.Body = utils.ReplaceSpaceAndWrap(fmt.Sprint(payload))
|
|
|
+ itemApiLog.Result = string(body)
|
|
|
+ go models.AddCygxThreeApiLog(itemApiLog)
|
|
|
+
|
|
|
err = json.Unmarshal(body, &ApifoxModal)
|
|
|
if err != nil {
|
|
|
fmt.Println("Getres.PublicGetDate Err:", err.Error())
|
|
@@ -227,6 +237,7 @@ func GetYiDongActivity(cont context.Context) (err error) {
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
utils.FileLog.Info(string(err.Error()))
|
|
|
+ return
|
|
|
}
|
|
|
mapOldYiDong := make(map[string]string)
|
|
|
mapOldYiDongBody := make(map[string]string)
|
|
@@ -234,18 +245,24 @@ func GetYiDongActivity(cont context.Context) (err error) {
|
|
|
mapOldYiDong[v.YidongActivityId] = v.YidongActivityId
|
|
|
mapOldYiDongBody[v.YidongActivityId] = fmt.Sprint(v.ActivityName, v.Label, v.ChartPermissionId, v.ActivityTime, v.YidongActivityEndTime, v.DistinguishedGuest)
|
|
|
}
|
|
|
- fmt.Println(mapOldYiDongBody)
|
|
|
var itemsAdd []*models.CygxActivity
|
|
|
if len(ApifoxModal.Result) > 0 {
|
|
|
actList := ApifoxModal.Result
|
|
|
for _, v := range actList {
|
|
|
+ //同步有效性 1有效,0失效
|
|
|
+ if v.SyncFlag == "0" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
var item = new(models.CygxActivity)
|
|
|
item.YidongActivityId = v.ID
|
|
|
item.ActivityTypeId = 3
|
|
|
item.ActivityTypeName = "公司调研电话会"
|
|
|
- item.ActivityName = v.CompanyInfo + v.Title
|
|
|
- item.Label = v.CompanyInfo
|
|
|
- item.TemporaryLabel = v.CompanyInfo
|
|
|
+ sliceCompanyInfo := strings.Split(v.Title, "(")
|
|
|
+ companyInfo := sliceCompanyInfo[0]
|
|
|
+ item.ActivityName = v.Title
|
|
|
+ item.LastUpdatedTime = time.Now()
|
|
|
+ item.Label = companyInfo
|
|
|
+ item.TemporaryLabel = companyInfo
|
|
|
item.ChartPermissionId = GetActivityTypeIdWithYiDong(v.IndustrySwName)
|
|
|
item.ChartPermissionName = GetActivityTypeNameWithYiDong(v.IndustrySwName)
|
|
|
item.ChartPermissionNames = GetActivityTypeNameWithYiDong(v.IndustrySwName)
|
|
@@ -263,28 +280,29 @@ func GetYiDongActivity(cont context.Context) (err error) {
|
|
|
}
|
|
|
detailList := detailYidng.Resultdetail.GuestPersonList
|
|
|
for _, vdetail := range detailList {
|
|
|
- item.DistinguishedGuest += vdetail.PersonName + ","
|
|
|
+ item.DistinguishedGuest += vdetail.PersonName + " " + vdetail.JobName + ","
|
|
|
}
|
|
|
item.DistinguishedGuest = strings.TrimRight(item.DistinguishedGuest, ",")
|
|
|
- item.Body = "<p>" + "【" + v.CompanyInfo + v.Title + "】" + "<p>时间:" + v.Start + "</p>嘉宾:" + item.DistinguishedGuest + "</p>"
|
|
|
+ item.Body = "<p>" + "【" + v.Title + "】" + "<p>时间:" + v.Start + "</p>嘉宾:" + item.DistinguishedGuest + "</p>"
|
|
|
+ //fmt.Println(item.Body)
|
|
|
+ //return err
|
|
|
if mapOldYiDong[v.ID] == "" {
|
|
|
itemsAdd = append(itemsAdd, item)
|
|
|
newId, err := models.AddCygxActivity(item)
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
utils.FileLog.Info(string(err.Error()))
|
|
|
+ return err
|
|
|
}
|
|
|
|
|
|
//把公司名称当做标的 对活动进行产业标的的关联
|
|
|
- YidongActivityGroup(v.CompanyInfo, int(newId))
|
|
|
+ YidongActivityGroup(companyInfo, int(newId))
|
|
|
} else {
|
|
|
//如果内容主体有做变更,就修改内容
|
|
|
- if mapOldYiDongBody[v.ID] != fmt.Sprint(item.ActivityName, item.Label, item.ChartPermissionId, item.ActivityTime, item.YidongActivityEndTime, item.DistinguishedGuest) {
|
|
|
- //fmt.Println("修改")
|
|
|
- //fmt.Println(mapOldYiDongBody[v.ID])
|
|
|
- //fmt.Println(fmt.Sprint(item.ActivityName, item.Label, item.ChartPermissionId, item.ActivityTime, item.DistinguishedGuest))
|
|
|
+ if mapOldYiDongBody[v.ID] != fmt.Sprint(item.ActivityName+"12", item.Label, item.ChartPermissionId, item.ActivityTime, item.YidongActivityEndTime, item.DistinguishedGuest) {
|
|
|
updateParams := make(map[string]interface{})
|
|
|
updateParams["ActivityName"] = item.ActivityName
|
|
|
+ updateParams["Body"] = item.Body
|
|
|
updateParams["Label"] = item.Label
|
|
|
updateParams["TemporaryLabel"] = item.TemporaryLabel
|
|
|
updateParams["DistinguishedGuest"] = item.DistinguishedGuest
|
|
@@ -298,6 +316,7 @@ func GetYiDongActivity(cont context.Context) (err error) {
|
|
|
updateParams["ActivityJoinType"] = item.ActivityJoinType
|
|
|
updateParams["YidongSignUpStart"] = item.YidongSignUpStart
|
|
|
updateParams["YidongSignUpEnd"] = item.YidongSignUpEnd
|
|
|
+ updateParams["LastUpdatedTime"] = time.Now()
|
|
|
whereParam := map[string]interface{}{"yidong_activity_id": item.YidongActivityId}
|
|
|
err = models.UpdateByExpr(models.CygxActivity{}, whereParam, updateParams)
|
|
|
if err != nil {
|
|
@@ -344,7 +363,16 @@ func GetYiDongActivityDetail(activityId string) (detail *models.ApifoxModaldetai
|
|
|
utils.FileLog.Info(err.Error())
|
|
|
return
|
|
|
}
|
|
|
- utils.FileLog.Info(string(body))
|
|
|
+
|
|
|
+ //添加请求日志记录
|
|
|
+ itemApiLog := new(models.CygxThreeApiLog)
|
|
|
+ itemApiLog.CreateTime = time.Now()
|
|
|
+ itemApiLog.Source = 1
|
|
|
+ itemApiLog.Url = url
|
|
|
+ itemApiLog.Body = utils.ReplaceSpaceAndWrap(fmt.Sprint(payload))
|
|
|
+ itemApiLog.Result = string(body)
|
|
|
+ go models.AddCygxThreeApiLog(itemApiLog)
|
|
|
+
|
|
|
err = json.Unmarshal(body, &ApifoxModal)
|
|
|
if err != nil {
|
|
|
fmt.Println("Getres.PublicGetDate Err:", err.Error())
|
|
@@ -360,6 +388,7 @@ func GetYiDongCreateUserInfo(user *models.WxUserItem) (userTgc string, err error
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
+ go utils.SendAlarmMsg("生成用户相关信息接口 获取用户tgc失败:"+err.Error(), 2)
|
|
|
utils.FileLog.Info(err.Error())
|
|
|
}
|
|
|
}()
|
|
@@ -395,8 +424,6 @@ func GetYiDongCreateUserInfo(user *models.WxUserItem) (userTgc string, err error
|
|
|
utils.FileLog.Info(err.Error())
|
|
|
return
|
|
|
}
|
|
|
- utils.FileLog.Info(string(body))
|
|
|
- fmt.Println(string(body))
|
|
|
err = json.Unmarshal(body, &ApifoxModal)
|
|
|
if err != nil {
|
|
|
fmt.Println("Getres.PublicGetDate Err:", err.Error())
|
|
@@ -464,7 +491,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
|
|
|
fmt.Println("GetActivityListByYidong Err:", err.Error())
|
|
|
return err
|
|
|
}
|
|
|
- fmt.Println(artivityListYidong)
|
|
|
+ //return err
|
|
|
if len(artivityListYidong) == 0 {
|
|
|
return err
|
|
|
}
|
|
@@ -530,7 +557,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
|
|
|
}
|
|
|
for _, vresult := range ApifoxModal.Result {
|
|
|
if vresult.EndTime != "" {
|
|
|
- err = models.UpdateCygxActivitySignupisMeet(v.YidongActivityId, vresult.PersonTelephone)
|
|
|
+ err = models.UpdateCygxActivitySignupisMeet(v.ActivityId, vresult.PersonTelephone)
|
|
|
if err != nil {
|
|
|
fmt.Println("UpdateCygxActivitySignupisMeet Err:", err.Error())
|
|
|
return err
|
|
@@ -578,7 +605,6 @@ func YidongActivityGroup(subjectName string, activityId int) (err error) {
|
|
|
subjectActivityItems = append(subjectActivityItems, subjectActivityItem)
|
|
|
mapSubjectName[v.SubjectName] = v.SubjectName
|
|
|
}
|
|
|
- fmt.Println(v)
|
|
|
}
|
|
|
err = models.AddCygxActiuvityGroupMulti(industrialActivityItems, subjectActivityItems)
|
|
|
if err != nil {
|