|
@@ -14,6 +14,7 @@ import (
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
|
"net/url"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -44,6 +45,36 @@ var permissionMap map[string]string = map[string]string{
|
|
|
"黑色百家谈": "钢材,铁矿,双焦(焦煤、焦炭)",
|
|
|
}
|
|
|
|
|
|
+// permissionLabelMap 品种与同花顺标签的映射关系
|
|
|
+var permissionLabelMap = map[string]string{
|
|
|
+ "宏观经济": "宏观",
|
|
|
+ "利率债": "利率债",
|
|
|
+ "原油": "原油",
|
|
|
+ "PTA": "PTA",
|
|
|
+ "MEG": "MEG",
|
|
|
+ "织造终端": "织造终端",
|
|
|
+ "甲醇": "甲醇",
|
|
|
+ "聚烯烃": "聚烯烃",
|
|
|
+ "沥青": "沥青",
|
|
|
+ "纯苯+苯乙烯": "纯苯+苯乙烯",
|
|
|
+ "玻璃纯碱": "玻璃纯碱",
|
|
|
+ "钢材": "钢材",
|
|
|
+ "铁矿": "铁矿",
|
|
|
+ "双焦(焦煤、焦炭)": "双焦(焦煤、焦炭)",
|
|
|
+ "有色(锌)": "有色(锌)",
|
|
|
+ "有色(铜、铝)": "有色(铜、铝)",
|
|
|
+ "镍+不锈钢": "镍+不锈钢",
|
|
|
+ "PVC": "PVC",
|
|
|
+ "聚酯": "聚酯",
|
|
|
+ "钴锂": "钴锂",
|
|
|
+ "策略": "策略",
|
|
|
+ "苯乙烯": "纯苯+苯乙烯",
|
|
|
+ "锌": "有色(锌)",
|
|
|
+ "双焦": "双焦(焦煤、焦炭)",
|
|
|
+ "铜/铝": "有色(铜、铝)",
|
|
|
+ "镍/不锈钢": "镍+不锈钢",
|
|
|
+}
|
|
|
+
|
|
|
// TshResult 同花顺返回信息
|
|
|
type TshResult struct {
|
|
|
ErrorCode int `json:"error" description:"错误状态码"`
|
|
@@ -102,12 +133,24 @@ func SendThs(title, labelStr, abstract, jumpBaseUrl, logoUrl, dataType string) (
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 关联后的标签数据
|
|
|
+ newLabelList := make([]string, 0)
|
|
|
+ labelList := strings.Split(labelStr, ",")
|
|
|
+ for _, v := range labelList {
|
|
|
+ tmpLabel, ok := permissionLabelMap[v] //判断是否在关联标签里面
|
|
|
+ if !ok { //如果不在关联标签里面,那么就把原始的值赋值给
|
|
|
+ tmpLabel = v
|
|
|
+ }
|
|
|
+ newLabelList = append(newLabelList, tmpLabel)
|
|
|
+ }
|
|
|
+ labelStr = strings.Join(newLabelList, ",")
|
|
|
global.LOG.Info(fmt.Sprintf("labelStr:%s", labelStr))
|
|
|
label, err := gorsa.PublicEncrypt(labelStr, pubKey)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 跳转地址
|
|
|
jumpUrl, err := gorsa.PublicEncrypt(jumpBaseUrl, pubKey)
|
|
|
if err != nil {
|
|
|
return
|