|
@@ -975,3 +975,93 @@ type YiDongSignAppointmentsForThirdResp struct {
|
|
|
Success bool `json:"success"` // 成功标识,true:成功;false:失败。可作为判断报名是否成功的标识
|
|
|
Timestamp float64 `json:"timestamp"` // 时间戳
|
|
|
}
|
|
|
+
|
|
|
+//func init() {
|
|
|
+// GroupingActivityToYiDong()
|
|
|
+//}
|
|
|
+
|
|
|
+// GroupingActivityToYiDong 建立与易董的活动关联
|
|
|
+func GroupingActivityToYiDong(cont context.Context) (err error) {
|
|
|
+ //func GroupingActivityToYiDong() (err error) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ go utils.SendAlarmMsg("建立与易董的活动关联失败 GroupingActivityToYiDong"+err.Error(), 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ startDate := time.Now().AddDate(0, 0, -2).Format(utils.FormatDate)
|
|
|
+ endDate := time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
|
|
|
+
|
|
|
+ var token string
|
|
|
+ token, _ = GetYiDongToken()
|
|
|
+ url := utils.YiDongZhengTongYunUrl + "interact/activityManageApi/getRoadshowList?access_token=" + token
|
|
|
+ method := "POST"
|
|
|
+ payload := strings.NewReader(`{
|
|
|
+ "meetingStatus": "2",
|
|
|
+ "conveneStartStr": "` + startDate + `",
|
|
|
+ "conveneEndStr": "` + endDate + `"}`)
|
|
|
+ client := &http.Client{}
|
|
|
+ req, err := http.NewRequest(method, url, payload)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ utils.FileLog.Info(err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ req.Header.Add("Content-Type", "application/json")
|
|
|
+
|
|
|
+ res, err := client.Do(req)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ utils.FileLog.Info(err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer res.Body.Close()
|
|
|
+ var ApifoxModal *models.ApifoxModal
|
|
|
+ body, err := ioutil.ReadAll(res.Body)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ utils.FileLog.Info(err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加请求日志记录
|
|
|
+ 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())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //var itemsAdd []*models.CygxActivity
|
|
|
+ if len(ApifoxModal.Result) > 0 {
|
|
|
+ actList := ApifoxModal.Result
|
|
|
+ for _, v := range actList {
|
|
|
+ //同步有效性 1有效,0失效
|
|
|
+ if v.SyncFlag == "0" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ var yidongTitle string
|
|
|
+ titleSlice := strings.Split(v.Title, "】")
|
|
|
+
|
|
|
+ for _, vt := range titleSlice {
|
|
|
+ yidongTitle = vt
|
|
|
+ }
|
|
|
+
|
|
|
+ e := models.UpdateCygxActivityyidongActivityId(v.ID, v.Start, yidongTitle)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("UpdateCygxActivityyidongActivityId, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+
|
|
|
+}
|