|
@@ -72,7 +72,10 @@ func (ht *HTMiniFacade) Collect(req facade.BaseRequest) (err error) {
|
|
|
utils.FileLog.Error("收藏失败,获取图表信息失败:%v", err.Error())
|
|
|
return err
|
|
|
}
|
|
|
- url := fmt.Sprintf("%s%s", utils.GetMiniUrl(target), bookMarkUrl)
|
|
|
+ url, err := generateUrl(bookMarkUrl)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
resp, err := ht.Post(url, param, req.Auth)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Error("收藏失败,err:%v,resp:%v", err, resp)
|
|
@@ -86,7 +89,10 @@ func (ht *HTMiniFacade) UnCollect(req facade.BaseRequest) (err error) {
|
|
|
utils.FileLog.Error("收藏失败,获取图表信息失败:%v", err.Error())
|
|
|
return err
|
|
|
}
|
|
|
- url := fmt.Sprintf("%s%s", utils.GetMiniUrl(target), unBookMarkUrl)
|
|
|
+ url, err := generateUrl(unBookMarkUrl)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
resp, err := ht.Post(url, param, req.Auth)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Error("取消收藏失败,err:%v,resp:%v", err, resp)
|
|
@@ -94,14 +100,26 @@ func (ht *HTMiniFacade) UnCollect(req facade.BaseRequest) (err error) {
|
|
|
_, err = parseResult(resp)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+func generateUrl(path string) (url string, err error) {
|
|
|
+ configPath := utils.GetMiniUrl(target)
|
|
|
+ if url == "" {
|
|
|
+ utils.FileLog.Error("获取mini接口地址失败", err)
|
|
|
+ err = errors.New("获取mini接口地址失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ url = fmt.Sprintf("%s%s", configPath, path)
|
|
|
+ return
|
|
|
+}
|
|
|
func (ht *HTMiniFacade) IsCollect(req facade.BaseRequest) bool {
|
|
|
param, err := dealChartInfo(req)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Error("获取是否收藏失败,获取图表信息失败:%v", err.Error())
|
|
|
return false
|
|
|
}
|
|
|
- url := fmt.Sprintf("%s%s", utils.GetMiniUrl(target), checkBookMarkUrl)
|
|
|
+ url, err := generateUrl(checkBookMarkUrl)
|
|
|
+ if err != nil {
|
|
|
+ return false
|
|
|
+ }
|
|
|
resp, err := ht.Post(url, param, req.Auth)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Error("获取是否收藏失败,err:%v,resp:%v", err, resp)
|