|
@@ -477,7 +477,6 @@ func SendReportMiniToThs(reportId int) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// SendYbPriceDrivenToThs 推送研报小程序价格驱动客群消息
|
|
|
func SendYbPriceDrivenToThs(priceDrivenId int) (err error) {
|
|
|
defer func() {
|
|
@@ -528,9 +527,9 @@ func SendYbCommunityVideoToThs(videoId int) (err error) {
|
|
|
err = errors.New("获取视频信息失败, Err:" + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- permissionName := "宏观" // 所有客群都推
|
|
|
+ permissionName := "宏观" // 所有客群都推
|
|
|
title := video.Title
|
|
|
- jumpUrl := fmt.Sprint(utils.WxYbAppId + `/pages/video/videoList?videoId=`, videoId)
|
|
|
+ jumpUrl := fmt.Sprint(utils.WxYbAppId+`/pages/video/videoList?videoId=`, videoId)
|
|
|
logoUrl := `https://hongze.oss-cn-shanghai.aliyuncs.com/hzyj.png`
|
|
|
// 推送至同花顺
|
|
|
dataType := "2"
|
|
@@ -550,12 +549,83 @@ func SendYbVoiceBroadcastToThs(voiceId int) (err error) {
|
|
|
err = errors.New("获取语音播报信息失败, Err:" + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- permissionName := "宏观" // 所有客群都推
|
|
|
+ permissionName := "宏观" // 所有客群都推
|
|
|
title := voice.BroadcastName
|
|
|
- jumpUrl := fmt.Sprint(utils.WxYbAppId + `/pages-voice/voiceDetail?voiceId=`, voiceId)
|
|
|
+ jumpUrl := fmt.Sprint(utils.WxYbAppId+`/pages-voice/voiceDetail?voiceId=`, voiceId)
|
|
|
logoUrl := `https://hongze.oss-cn-shanghai.aliyuncs.com/hzyj.png`
|
|
|
// 推送至同花顺
|
|
|
dataType := "2"
|
|
|
err = SendThs(title, permissionName, title, jumpUrl, logoUrl, dataType)
|
|
|
return
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+//TshListResult 同花顺返回信息
|
|
|
+type TshListResult struct {
|
|
|
+ ErrorCode int `json:"error" description:"错误状态码"`
|
|
|
+ Message string `json:"message" description:"提示信息"`
|
|
|
+}
|
|
|
+
|
|
|
+// ThsReportList 同花顺列表接口
|
|
|
+func ThsReportList() (err error) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ //fmt.Println(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "发送消息至同花顺失败 ErrMsg:"+err.Error(), utils.EmailSendToUsers)
|
|
|
+ //go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "发送消息至同花顺失败 ErrMsg:"+err.Error(), utils.EmailSendToUsers)
|
|
|
+ go alarm_msg.SendAlarmMsg("发送消息至同花顺失败 ErrMsg:"+err.Error(), 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ pubKey := utils.THS_PubKey
|
|
|
+ sendUrl := utils.THS_SyncWxGroupUrl
|
|
|
+ //fmt.Println("sendUrl:", sendUrl)
|
|
|
+
|
|
|
+ pageNumStr := "10"
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("pageNum:%s", pageNumStr))
|
|
|
+ pageNumStr, err = gorsa.PublicEncrypt(pageNumStr, pubKey)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ numPerPageStr := "1" // 页码;默认1
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("numPerPage:%s", numPerPageStr))
|
|
|
+ numPerPageStr, err = gorsa.PublicEncrypt(numPerPageStr, pubKey)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //pageNum int 页码;默认1 否
|
|
|
+ //numPerPage int 每页数量;默认10 否
|
|
|
+ //title String 标题 否
|
|
|
+ //startDate String 开始日期;如2022-08-12 否
|
|
|
+ //endDate String 结束日期;如2022-08-12 否
|
|
|
+
|
|
|
+ //开始发送
|
|
|
+ client := http.Client{}
|
|
|
+ form := url.Values{}
|
|
|
+ form.Add("pageNum", pageNumStr)
|
|
|
+ form.Add("numPerPage", numPerPageStr)
|
|
|
+
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("Ths List parms:%s", form.Encode()))
|
|
|
+ resp, err := client.PostForm(sendUrl, form)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer resp.Body.Close()
|
|
|
+
|
|
|
+ body, _ := ioutil.ReadAll(resp.Body)
|
|
|
+
|
|
|
+ //fmt.Println(string(body))
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("Ths List Result parms:%s", string(body)))
|
|
|
+
|
|
|
+ //同花顺接口返回数据
|
|
|
+ var tshResult TshResult
|
|
|
+ err = json.Unmarshal(body, &tshResult)
|
|
|
+ if err != nil {
|
|
|
+ err = errors.New(fmt.Sprint("同花顺接口返回数据转换成结构体异常,Err:", err))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if tshResult.ErrorCode != 1 {
|
|
|
+ err = errors.New(fmt.Sprint("发送数据到同花顺接口异常,result:", string(body)))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|