weixin

package
v0.2.25 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GETTICKETURL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=wx_card&access_token="
	GETJSURL     = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token="
)
View Source
const (
	PAY_SUCCESS    = 1  //支付成功
	PAY_REFUND     = 2  //转入退款
	PAY_CLOSED     = 3  //已关闭
	PAY_NOTPAY     = 4  //未支付
	PAY_REVOKED    = 5  //已撤销
	PAY_USERPAYING = 6  //支付中
	PAY_ERROR      = -1 //支付失败
)

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken() (access_token string, err error)

获取微信accesstoken

func GetApiTicket

func GetApiTicket() (ticket string, err error)

获取微信卡券ticket

func GetJsTicket

func GetJsTicket() (ticket string, err error)

获取微信js ticket

func OnSelectData

func OnSelectData(open_id, order_id string) (int, message.MessageBody)

统一查询接口 open_id:用户唯一标识 order_id : 商户订单号

func RefundPay

func RefundPay(open_id, order_id, refund_no string, total_fee, refund_fee int) (bool, message.MessageBody)

申请退款 open_id:用户唯一标识 order_id : 商户订单号 refund_no:商户退款单号 total_fee: 订单总金额 分 refund_fee: 退款总金额 分

func SmallAppOauth

func SmallAppOauth(jscode string) string

小程序授权

func SmallAppUnifiedorder

func SmallAppUnifiedorder(open_id string, price int, price_body, order_id, client_ip string) message.MessageBody

小程序统一下单接口 open_id:用户唯一标识 price : 预支付价钱 price_body : 支付描述 order_id : 商户订单号

func WxEnterprisePay

func WxEnterprisePay(open_id, trade_no, desc, ipAddr string, amount int) bool

企业付款 open_id:用户唯一标识 trade_no : 商户订单号 desc : 操作说明 amount:付款金额 分

Types

type ApiTicket

type ApiTicket struct {
	Errcode    int    `json:"errcode"`
	Errmsg     string `json:"errmsg"`
	Ticket     string `json:"ticket"`
	Expires_in int    `json:"expires_in"`
}

type Gocache

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

Memcache struct contains *memcache.Client

func NewGocache

func NewGocache(server string) *Gocache

NewGocache create new cache2go

func (*Gocache) Delete

func (mem *Gocache) Delete(key string) error

Delete value in memcache.

func (*Gocache) Get

func (mem *Gocache) Get(key string) interface{}

Get return cached value

func (*Gocache) IsExist

func (mem *Gocache) IsExist(key string) bool

IsExist check value exists in memcache.

func (*Gocache) Set

func (mem *Gocache) Set(key string, val interface{}, timeout time.Duration) (err error)

Set cached value with key and expire time.

type UserInfo

type UserInfo struct {
	OpenID     string   `json:"openid"`
	Nickname   string   `json:"nickname"`
	Sex        int32    `json:"sex"`
	Province   string   `json:"province"`
	City       string   `json:"city"`
	Country    string   `json:"country"`
	HeadImgURL string   `json:"headimgurl"`
	Privilege  []string `json:"privilege"`
	Unionid    string   `json:"unionid"`
}

Jump to

Keyboard shortcuts

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