wx

package
v0.0.0-...-29e02a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

* @Name: * @Descripttion: * @Warning: * @version: * @Author: moo * @Date: 2021-01-26 18:37:21 * @LastEditors: moo * @LastEditTime: 2021-02-01 15:58:11

Index

Constants

This section is empty.

Variables

View Source
var ACCESS_TOKEN_URI string = "https://api.weixin.qq.com/cgi-bin/token"
View Source
var CODE_URI string = "https://api.weixin.qq.com/sns/jscode2session"
View Source
var SUBSCRIBE_URI string = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=%s"

Functions

func Code2Session

func Code2Session(appid string, secret string, code string) (openID string, unionID string, sessionKey string, err error)

func GetJson

func GetJson(uri string, query map[string]string) ([]byte, error)

func PostJson

func PostJson(uri string, param map[string]interface{}) ([]byte, error)

func SendSubscribe

func SendSubscribe(sub SubMsg) error

Types

type AccessToken

type AccessToken struct {
	Token     string `json:"access_token"`
	ExpiresIn int    `json:"expires_in"`
	ErrCode   int    `json:"errcode"`
	ErrMsg    string `json:"errmsg"`
}

func GetAccessToken

func GetAccessToken(appid string, secret string) (*AccessToken, error)

type RspSubMsg

type RspSubMsg struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

type SubMsg

type SubMsg struct {
	AccessToken      string      `json:"access_token"`
	TOuser           string      `json:"touser"`
	FormID           string      `json:"form_id"`
	TemplateID       string      `json:"template_id"`
	Page             string      `json:"page"`
	Data             interface{} `json:"data"`
	MiniProgramState string      `json:"miniprogram_state"`
	Lang             string      `json:"lang"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL