1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-14 09:42:27 +08:00

[feature] Format the code and improve Mini Program authorization to o… (#473)

* [feature] Format the code and improve Mini Program authorization to obtain openid(miniprogram/auth/auth.go Code2Session)

* [feature] CheckEncryptedData (https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html)

* upgrade json error

* upgrade json error

Co-authored-by: houseme <houseme@outlook.com>
This commit is contained in:
houseme
2021-09-08 11:03:23 +08:00
committed by GitHub
parent 47adf42208
commit 96c1f98944
90 changed files with 787 additions and 760 deletions

View File

@@ -15,10 +15,10 @@ func writeContextType(w http.ResponseWriter, value []string) {
}
}
//Render render from bytes
// Render render from bytes
func (srv *Server) Render(bytes []byte) {
//debug
//fmt.Println("response msg = ", string(bytes))
// debug
// fmt.Println("response msg = ", string(bytes))
srv.Writer.WriteHeader(200)
_, err := srv.Writer.Write(bytes)
if err != nil {
@@ -26,13 +26,13 @@ func (srv *Server) Render(bytes []byte) {
}
}
//String render from string
// String render from string
func (srv *Server) String(str string) {
writeContextType(srv.Writer, plainContentType)
srv.Render([]byte(str))
}
//XML render to xml
// XML render to xml
func (srv *Server) XML(obj interface{}) {
writeContextType(srv.Writer, xmlContentType)
bytes, err := xml.Marshal(obj)