|
@@ -148,36 +148,6 @@ func CreateAndUploadSunCode(page, scene, version string) (imgUrl string, err err
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// GetRddpShareImg 获取日度点评分享图
|
|
|
|
-func GetRddpShareImg(title string) (imgUrl string, err error) {
|
|
|
|
- if title == "" {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- template := fmt.Sprint("static/htm2img/rddp-share.html")
|
|
|
|
- contentByte, e := ioutil.ReadFile(template)
|
|
|
|
- if e != nil {
|
|
|
|
- err = errors.New("读取模板失败, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- contentStr := string(contentByte)
|
|
|
|
- contentStr = strings.Replace(contentStr, "{{TITLE}}", title, 1)
|
|
|
|
- htm2ImgReq := make(map[string]interface{})
|
|
|
|
- htm2ImgReq["html_content"] = contentStr
|
|
|
|
- htm2ImgReq["width"] = 1000
|
|
|
|
- htm2ImgReq["height"] = 800
|
|
|
|
- res, e := postHtml2Img(htm2ImgReq)
|
|
|
|
- if e != nil || res == nil {
|
|
|
|
- err = errors.New("html转图片请求失败")
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if res.Code != 200 {
|
|
|
|
- err = errors.New("html转图片请求失败: " + res.Msg)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- imgUrl = res.Data
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// CreatePosterFromSourceV2 生成分享海报(通过配置获取相关信息)
|
|
// CreatePosterFromSourceV2 生成分享海报(通过配置获取相关信息)
|
|
func CreatePosterFromSourceV2(codePage, codeScene, source, version, pars string) (imgUrl string, err error) {
|
|
func CreatePosterFromSourceV2(codePage, codeScene, source, version, pars string) (imgUrl string, err error) {
|
|
var errMsg string
|
|
var errMsg string
|
|
@@ -439,4 +409,4 @@ func GetDynamicShareImg(source, pars string) (imgUrl string, err error) {
|
|
}
|
|
}
|
|
imgUrl = res.Data
|
|
imgUrl = res.Data
|
|
return
|
|
return
|
|
-}
|
|
|
|
|
|
+}
|