|
@@ -1,8 +1,10 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
"fmt"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
+ "hongze/hongze_cygx/utils"
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
|
"strings"
|
|
@@ -41,16 +43,29 @@ func (this *BaseYidongController) GetToken() {
|
|
|
}
|
|
|
defer res.Body.Close()
|
|
|
|
|
|
+ type Ydtoklen struct {
|
|
|
+ Success string `json:"success"`
|
|
|
+ ExpiresIn int `json:"expires_in"`
|
|
|
+ AccessToken string `json:"access_token"`
|
|
|
+ }
|
|
|
+ var ydtoklen Ydtoklen
|
|
|
body, err := ioutil.ReadAll(res.Body)
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
|
return
|
|
|
}
|
|
|
+ //fmt.Println(body)
|
|
|
+ err = json.Unmarshal(body, &ydtoklen)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("Getres.PublicGetDate Err:", err.Error())
|
|
|
+ }
|
|
|
+ utils.FileLog.Info(string(body))
|
|
|
+ //fmt.Println(body)
|
|
|
fmt.Println(string(body))
|
|
|
br.Msg = "获取成功!"
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
- br.Data = body
|
|
|
+ br.Data = ydtoklen
|
|
|
}
|
|
|
|
|
|
// @Title 获取搜索推荐词
|