wx

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// access_token 地址
	AccessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token"
	//获取无限制小程序二维码
	CreateUqrcodeUrl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit"
	//获取小程序二维码 适用于需要的码数量较少的业务场景 有数量限制:与 wxacode.createQRCode 总共生成的码数量限制为100,000
	CreateQrCodeUrl = "https://api.weixin.qq.com/wxa/getwxacode"
	//授权$code 访问地址
	CodeAccessUrl    = "https://api.weixin.qq.com/sns/jscode2session"
	TemplatedSendUrl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send"
	//获取授权页ticket
	GetticketUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"
	//获取授权页链接
	AuthUrl = "https://api.weixin.qq.com/card/invoice/getauthurl"
	//上传电子发票PDF文件
	SetpdfUrl = "https://api.weixin.qq.com/card/invoice/platform/setpdf"
	//将电子发票卡券插入用户卡包
	InvoiceInsertUrl = "https://api.weixin.qq.com/card/invoice/insert"
)

Variables

This section is empty.

Functions

func AesDecrypt added in v1.3.0

func AesDecrypt(crytedByte []byte, key []byte, iv []byte) []byte

@desc aes解密 @auth liuguoqiang 2020-04-21 @param @return

func AesEncrypt added in v1.3.0

func AesEncrypt(origData []byte, k []byte, iv []byte) string

@desc aes加密 @auth liuguoqiang 2020-04-21 @param @return

func DecryptData added in v1.3.0

func DecryptData(req *DecryptDataRequest) ([]byte, error)

@desc 检验数据的真实性,并且获取解密后的明文. @auth liuguoqiang 2020-04-08 @param @return

func PKCS7Padding added in v1.3.0

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

补码 AES加密数据块分组长度必须为128bit(byte[16]),密钥长度可以是128bit(byte[16])、192bit(byte[24])、256bit(byte[32])中的任意一个。 @desc @auth liuguoqiang 2020-04-21 @param @return

func PKCS7UnPadding added in v1.3.0

func PKCS7UnPadding(origData []byte) []byte

@desc 去码 @auth liuguoqiang 2020-04-21 @param @return

Types

type CheckLoginResponse added in v1.3.0

type CheckLoginResponse struct {
	OpenId     string `json:"openId"`
	SessionKey string `json:"session_key"`
}

type DecryptDataRequest added in v1.3.0

type DecryptDataRequest struct {
	SessionKey string
	Iv         string
	Data       string
}

type GetQRCodeRequest added in v1.3.5

type GetQRCodeRequest struct {
	Path  string `json:"path"`
	Width int64  `json:"width"`
}

type GetUnLimitQRCodeRequest

type GetUnLimitQRCodeRequest struct {
	Scene     string `json:"scene"`
	Page      string `json:"page"`
	AutoColor bool   `json:"auto_color"`
	IsHyaline bool   `json:"is_hyaline"`
	Width     int64  `json:"width"`
}

type SendRequest

type SendRequest struct {
	Openid          string `json:"touser"`
	TemplateId      string `json:"template_id"`
	Page            string `json:"page"`
	FormId          string `json:"form_id"`
	Data            string `json:"data"`
	EmphasisKeyword string `json:"emphasis_keyword"`
}

type Wx

type Wx struct {
	// contains filtered or unexported fields
}

func NewWx

func NewWx(appId, secret, grantType string, getRedis func() *redis.Client) *Wx

@desc 初始化 @auth liuguoqiang 2020-02-25 @param @return

func (*Wx) CheckLogin added in v1.3.0

func (s *Wx) CheckLogin(code string) (*CheckLoginResponse, error)

@desc 根据微信code获取授权信息 @auth liuguoqiang 2020-04-08 @param @return

func (*Wx) GetAuthUrl added in v1.3.0

func (s *Wx) GetAuthUrl(params map[string]interface{}, isFresh bool) ([]byte, error)

@desc 获取微信授权页链接 @auth liuguoqiang 2020-02-25 @param @return

func (*Wx) GetQRCode added in v1.3.5

func (s *Wx) GetQRCode(params *GetQRCodeRequest, isFresh bool) ([]byte, error)

@desc 获取二维码 适用于需要的码数量较少的业务场景 有数量限制 @auth ykq 2020-05-13 @param @return

func (*Wx) GetTicket added in v1.3.0

func (s *Wx) GetTicket(ticketType string, isFresh bool) ([]byte, error)

@desc 获取授权页面ticket @auth liuguoqiang 2020-02-25 @param @return

func (*Wx) GetUnLimitQRCode

func (s *Wx) GetUnLimitQRCode(params *GetUnLimitQRCodeRequest, isFresh bool) ([]byte, error)

@desc 获取二维码 @auth liuguoqiang 2020-02-25 @param @return

func (*Wx) InitAuthToken

func (s *Wx) InitAuthToken(isFresh bool) (string, error)

@desc 根据access_token值进行授权 @auth liuguoqiang 2020-02-25 @param $isFresh 是否刷新access_token @return

func (*Wx) InvoiceInsert added in v1.3.2

func (s *Wx) InvoiceInsert(params map[string]interface{}, isFresh bool) ([]byte, error)

@desc 电子发票插入微信卡包 @auth liuguoqiang 2020-04-24 @param @return

func (*Wx) Request

func (s *Wx) Request(urlParam map[string]string, bodyParams interface{}, paramUrl string, isFresh bool, isPost bool) ([]byte, error)

@desc 通用请求 @auth liuguoqiang 2020-02-25 @param @return

func (*Wx) Send

func (s *Wx) Send(params *SendRequest, isFresh bool) ([]byte, error)

@desc 发送模板 @auth liuguoqiang 2020-04-17 @param @return

func (*Wx) SetPdf added in v1.3.2

func (s *Wx) SetPdf(pdfPath string, isFresh bool) ([]byte, error)

@desc 上传pdf文件 @auth liuguoqiang 2020-02-25 @param @return

Jump to

Keyboard shortcuts

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