|
@@ -352,3 +352,64 @@ func ComeinUpdateActivityPublish(activityId int, action string) {
|
|
|
fmt.Println(string(body))
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 重点公司报告更新,同步到进门财经
|
|
|
+func ComeinUpdateReportSelectionPublish(articleId int, action string) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ go alarm_msg.SendAlarmMsg(fmt.Sprint("活动更新,同步到进门财经接口失败,articleId:", articleId, "action", action)+err.Error(), 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ postUrl := utils.COMEIN_ACTIVITY_URL + "/open-brm/hz-data/change-notice"
|
|
|
+ params := ComeinUpdateActivityPublishReq{
|
|
|
+ Action: action,
|
|
|
+ Module: "key_company_reports",
|
|
|
+ EntityId: articleId,
|
|
|
+ }
|
|
|
+ postData, e := json.Marshal(params)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New(fmt.Sprint("重点公司报告更新,同步到进门财经失败 Marshal:", e.Error()))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ method := "POST"
|
|
|
+ client := &http.Client{}
|
|
|
+ req, e := http.NewRequest(method, postUrl, strings.NewReader(string(postData)))
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New(fmt.Sprint("重点公司报告更新,同步到进门财经失败 NewRequest:", e.Error()))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ req.Header.Add("Content-Type", "application/json")
|
|
|
+ res, e := client.Do(req)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New(fmt.Sprint("重点公司报告更新,同步到进门财经失败 client:", e.Error()))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer res.Body.Close()
|
|
|
+ body, e := ioutil.ReadAll(res.Body)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New(fmt.Sprint("重点公司报告更新,同步到进门财经失败 ReadAll:", e.Error()))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ itemApiLog := new(cygx.CygxThreeApiLog)
|
|
|
+ itemApiLog.CreateTime = time.Now()
|
|
|
+ itemApiLog.Source = 1
|
|
|
+ itemApiLog.Url = postUrl
|
|
|
+ itemApiLog.Body = string(postData)
|
|
|
+ itemApiLog.Result = string(body)
|
|
|
+ go cygx.AddCygxThreeApiLog(itemApiLog)
|
|
|
+ var ComeinResp *ComeinUpdateActivityPublishResp
|
|
|
+ e = json.Unmarshal(body, &ComeinResp)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New(fmt.Sprint("重点公司报告更新,同步到进门财经失败 Unmarshal:", e.Error()))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if ComeinResp.Code != "0" {
|
|
|
+ err = errors.New(fmt.Sprint("重点公司报告更新,同步到进门财经失败 Code:", ComeinResp.Code))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println(string(body))
|
|
|
+ return
|
|
|
+}
|