123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package ppt2img
- import (
- "encoding/json"
- "errors"
- "fmt"
- "github.com/rdlucklib/rdluck_tools/http"
- "hongze/hongze_ETA_mobile_api/utils"
- )
- type Ppt2ImgResponse struct {
- Ret int
- Msg string
- ErrMsg string
- ErrCode string
- Data []string
- Success bool `description:"true 执行成功,false 执行失败"`
- IsSendEmail bool `description:"true 发送邮件,false 不发送邮件"`
- }
- // Ppt2Img ppt转图片
- // @params pptUrl ppt的在线url
- func Ppt2Img(pptUrl string) (resourceUrlList []string, err error) {
- params := make(map[string]interface{})
- params["PptUrl"] = pptUrl
- param, err := json.Marshal(params)
- if err != nil {
- utils.FileLog.Info("Ppt2Img json.Marshal Err:" + err.Error())
- return
- }
- body, err := http.Post(utils.Ppt2ImageUrl, string(param))
- var result Ppt2ImgResponse
- err = json.Unmarshal(body, &result)
- if err != nil {
- fmt.Println("err:" + err.Error())
- return
- }
- if result.Ret != 200 {
- err = errors.New("获取token失败,Err:" + result.Msg)
- return
- }
- resourceUrlList = result.Data
- return
- }
|