|
@@ -2,11 +2,15 @@ package controllers
|
|
|
|
|
|
import (
|
|
import (
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ //"github.com/silenceper/wechat"
|
|
|
|
+ //"github.com/silenceper/wechat/cache"
|
|
"hongze/hongze_api/models"
|
|
"hongze/hongze_api/models"
|
|
"hongze/hongze_api/services"
|
|
"hongze/hongze_api/services"
|
|
"hongze/hongze_api/utils"
|
|
"hongze/hongze_api/utils"
|
|
"strconv"
|
|
"strconv"
|
|
"time"
|
|
"time"
|
|
|
|
+
|
|
|
|
+ //offConfig "github.com/silenceper/wechat/v2/officialaccount/config"
|
|
)
|
|
)
|
|
|
|
|
|
type WechatController struct {
|
|
type WechatController struct {
|
|
@@ -148,6 +152,52 @@ func (this *WechatCommonController) WechatLogin() {
|
|
br.Data = resp
|
|
br.Data = resp
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//
|
|
|
|
+//// @Title 微信登录接口
|
|
|
|
+//// @Description 微信登录接口
|
|
|
|
+//// @Param Url query string true "url地址"
|
|
|
|
+//// @Success 200 {object} models.WxLoginResp
|
|
|
|
+//// @router /getWxSign [get]
|
|
|
|
+//func (this *WechatController) GetWxSign() {
|
|
|
|
+// br := new(models.BaseResponse).Init()
|
|
|
|
+// defer func() {
|
|
|
|
+// this.Data["json"] = br
|
|
|
|
+// this.ServeJSON()
|
|
|
|
+// }()
|
|
|
|
+// getUrl := this.GetString("Url")
|
|
|
|
+//
|
|
|
|
+// accessToken, err := services.WxGetAccessToken()
|
|
|
|
+// if err != nil {
|
|
|
|
+// br.Msg = "获取用户信息失败"
|
|
|
|
+// br.ErrMsg = "获取access_token失败,err:" + err.Error()
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// wc := wechat.NewWechat()
|
|
|
|
+// memory := cache.NewMemory()
|
|
|
|
+//
|
|
|
|
+// cfg := &offConfig.Config{
|
|
|
|
+// AppID: utils.WxAppId,
|
|
|
|
+// AppSecret: utils.WxAppSecret,
|
|
|
|
+// Token: accessToken,
|
|
|
|
+// Cache: memory,
|
|
|
|
+// }
|
|
|
|
+// oa := wc.GetOfficialAccount(cfg)
|
|
|
|
+// j:=oa.GetJs()
|
|
|
|
+// config,err:=j.GetConfig(getUrl)
|
|
|
|
+// if err!=nil {
|
|
|
|
+// fmt.Println("获取失败:Err:"+err.Error())
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+// fmt.Println(config)
|
|
|
|
+// resp := new(models.WxLoginResp)
|
|
|
|
+// br.Ret = 200
|
|
|
|
+// br.Success = true
|
|
|
|
+// br.Msg = "获取签名成功"
|
|
|
|
+// br.Data = resp
|
|
|
|
+//}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
/*
|
|
/*
|
|
$app->bag('api/wechat/getWxSign',"WechatController@getWxSign");
|
|
$app->bag('api/wechat/getWxSign',"WechatController@getWxSign");
|