Documentation ¶
Index ¶
- Constants
- func AesCBCDncrypt(encryptData, key, iv []byte) ([]byte, error)
- func CreateACode(access_token string, param ACodeParam) ([]byte, error)
- func CreateACodeUnlimited(access_token string, param ACodeParam) ([]byte, error)
- func CreateQCode(access_token string, page string, width int) ([]byte, error)
- func CreateShortLink(access_token string, param ShortLinkReq) (string, error)
- func CreateShortLinkPermanent(access_token string, page_url string, page_title string) (string, error)
- func CreateShortLinkTemp(access_token string, page_url string, page_title string) (string, error)
- func CreateUrlLink(access_token string, param UrlLinkReq) (string, error)
- func CreateUrlScheme(access_token string, param WxUrlSchemeReq) (string, error)
- func GenIMUserSig(sdkappid int, key string, identifier string, expire int) (string, error)
- func GenSessionString(openid string, hash_key string) string
- func GetAccessToken(appid string, secret string) (string, error)
- func GetNonceStr(n int) string
- func GetPluginPid(access_token string, code string) (string, error)
- func GetTempMedia(access_token string, media_id string) ([]byte, error)
- func PKCS7UnPadding(origData []byte) []byte
- func PostFileByFormData(url string, params map[string]string, file_path string, file_key string) (string, error)
- func SendCustomAppPage(access_token string, touser string, title, pagepath, thumb_media_id string) error
- func SendCustomImage(access_token string, touser string, media_id string) error
- func SendCustomLink(access_token string, touser string, title, description, url, thumb_url string) error
- func SendCustomMessage(access_token string, param CustomerMessage) error
- func SendCustomText(access_token string, touser string, text string) error
- func SendCustomTyping(access_token string, touser, command string) error
- func SendSubscribeMsg(access_token string, param SubscribeMsgReq) error
- func SignSHA1(signstr string) string
- func UpdateActivity(access_token string, param UpdateActivityReq) error
- func WeixinCheck(p WeixinParam) string
- func WxApiGet(wx_addr string) ([]byte, error)
- func WxApiPost(wx_addr string, data []byte) ([]byte, error)
- func WxApiPostStruct(wx_addr string, param interface{}) ([]byte, error)
- func WxDncrypt(rawData, key, iv string) (string, error)
- type ACodeParam
- type CMType
- type CheckDetail
- type CheckMediaReq
- type CheckMediaRet
- type CheckResult
- type CheckTextReq
- type CheckTextRet
- type CloudParam
- type CreateActivityRet
- type CreateQCodeReq
- type CustomTypingReq
- type CustomerMessage
- type EncryptedCheckRet
- type GetPaidInfoReq
- type GetPaidInfoRet
- type GetPhoneNumberRet
- type GetPluginPidRet
- type MediaImage
- type MediaLink
- type MediaRecive
- type MediaText
- type MediaType
- type MediaWxApp
- type PhoneInfo
- type RGBColor
- type SceneType
- type SchemeInfo
- type SchemeQueryRet
- type SchemeQuot
- type ShortLinkReq
- type ShortLinkRet
- type SubscribeMsgReq
- type TemplData
- type TemplInfo
- type TemplItem
- type TemplValue
- type TokenCache
- type TokenGetFunc
- type TokenInfo
- type UpdateActivityReq
- type UploadTempMediaRet
- type UrlLinkInfo
- type UrlLinkQueryRet
- type UrlLinkQuot
- type UrlLinkReq
- type UrlLinkRet
- type WeixinApp
- func (app *WeixinApp) CheckMedia(param CheckMediaReq) (CheckMediaRet, error)
- func (app *WeixinApp) CheckText(param CheckTextReq) (CheckTextRet, error)
- func (app *WeixinApp) CreateACode(param ACodeParam) ([]byte, error)
- func (app *WeixinApp) CreateACodeUnlimited(param ACodeParam) ([]byte, error)
- func (app *WeixinApp) CreateActivity(userid string, is_unionid bool) (CreateActivityRet, error)
- func (app *WeixinApp) CreateQCode(page string, width int) ([]byte, error)
- func (app *WeixinApp) CreateShortLink(param ShortLinkReq) (string, error)
- func (app *WeixinApp) CreateShortLinkPermanent(page_url string, page_title string) (string, error)
- func (app *WeixinApp) CreateShortLinkTemp(page_url string, page_title string) (string, error)
- func (app *WeixinApp) CreateUrlLink(param UrlLinkReq) (string, error)
- func (app *WeixinApp) CreateUrlScheme(param WxUrlSchemeReq) (string, error)
- func (app *WeixinApp) DecodePhoneNumber(rawData, key, iv string) (PhoneInfo, error)
- func (app *WeixinApp) EncryptedCheck(encrypted_msg_hash string) (EncryptedCheckRet, error)
- func (app *WeixinApp) GenIMUserSig(sdkappid int, key string, identifier string, expire int) (string, error)
- func (app *WeixinApp) GetOpenIdByCode(code string) (WxSessionData, error)
- func (app *WeixinApp) GetPaidInfo(param GetPaidInfoReq) (GetPaidInfoRet, error)
- func (app *WeixinApp) GetPhoneNumber(code string) (GetPhoneNumberRet, error)
- func (app *WeixinApp) GetSchemeInfo(scheme string) (SchemeQueryRet, error)
- func (app *WeixinApp) GetTempMedia(media_id string) ([]byte, error)
- func (app *WeixinApp) GetUrlLinkInfo(url_link string) (UrlLinkQueryRet, error)
- func (app *WeixinApp) SendCustomAppPage(touser string, title, pagepath, thumb_media_id string) error
- func (app *WeixinApp) SendCustomImage(touser string, media_id string) error
- func (app *WeixinApp) SendCustomLink(touser string, title, description, url, thumb_url string) error
- func (app *WeixinApp) SendCustomMessage(param CustomerMessage) error
- func (app *WeixinApp) SendCustomText(touser string, text string) error
- func (app *WeixinApp) SendCustomTyping(touser, command string) error
- func (app *WeixinApp) SendSubscribeMsg(param SubscribeMsgReq) error
- func (app *WeixinApp) UpdateActivity(param UpdateActivityReq) error
- func (app *WeixinApp) UploadTempMedia(file_path string) (UploadTempMediaRet, error)
- func (app *WeixinApp) WxDncrypt(rawData, iv string) (string, error)
- type WeixinParam
- type WxApiRet
- type WxApiTokenRet
- type WxJumpWxa
- type WxSessionData
- type WxUrlSchemeReq
- type WxUrlSchemeRet
- type WxWaterMark
Constants ¶
const ENV_D = "develop"
const ENV_R = "release"
const ENV_T = "trial"
const FLUSH_TOKEN_TM int64 = 240
access_token 的有效期通过返回的 expires_in 来传达,目前是7200秒之内的值,中控服务器需要根据这个有效时间提前去刷新 在刷新过程中,中控服务器可对外继续输出的老 access_token,此时公众平台后台会保证在5分钟内,新老 access_token 都可用 设置240秒(<5分钟)刷新一次,确保能够获取有效的access_token
Variables ¶
This section is empty.
Functions ¶
func CreateACode ¶
func CreateACode(access_token string, param ACodeParam) ([]byte, error)
获取小程序码 适用于需要的码数量较少的业务场景。 通过该接口生成的小程序码,永久有效,有数量限制
func CreateACodeUnlimited ¶
func CreateACodeUnlimited(access_token string, param ACodeParam) ([]byte, error)
获取小程序码, 适用于需要的码数量极多的业务场景。 通过该接口生成的小程序码,永久有效,数量暂无限制
func CreateQCode ¶
生成页面二维码 page:扫码进入的小程序页面路径,最大长度 128 字节 width:二维码的宽度,单位 px。最小 280px,最大 1280px
func CreateShortLink ¶
func CreateShortLink(access_token string, param ShortLinkReq) (string, error)
获取小程序 Short Link, 适用于微信内拉起小程序的业务场景。 通过该接口,可以选择生成到期失效和永久有效的小程序短链
func CreateShortLinkTemp ¶
func CreateUrlLink ¶
func CreateUrlLink(access_token string, param UrlLinkReq) (string, error)
获取小程序 URL Link, 适用于短信、邮件、网页、微信内等拉起小程序的业务场景 通过该接口,可以选择生成到期失效和永久有效的小程序链接,有数量限制
func CreateUrlScheme ¶
func CreateUrlScheme(access_token string, param WxUrlSchemeReq) (string, error)
生成页面Scheme码 适用于短信、邮件、外部网页、微信内等拉起小程序的业务场景。 通过该接口,可以选择生成到期失效和永久有效的小程序码,有数量限制
func GenIMUserSig ¶
*
*【功能说明】用于签发 TRTC 和 IM 服务中必须要使用的 UserSig 鉴权票据 * sdkappid - 应用id * key - 计算 usersig 用的加密密钥,控制台可获取 * userid - 用户id,限制长度为32字节,只允许包含大小写英文字母(a-zA-Z)、数字(0-9)及下划线和连词符。 * expire - UserSig 票据的过期时间,单位是秒,比如 86400 代表生成的 UserSig 票据在一天后就无法再使用了。
func GenSessionString ¶
func GetNonceStr ¶
func GetPluginPid ¶
通过 wx.pluginLogin 接口获得插件用户标志凭证 code 后传到开发者服务器,开发者服务器调用此接口换取插件用户的唯一标识 openpid。
func GetTempMedia ¶
获取客服消息内的临时素材。即下载临时的多媒体文件。目前小程序仅支持下载图片文件。 如果调用成功,会直接返回图片二进制内容,如果请求失败,会返回 JSON 格式的数据。
func PostFileByFormData ¶
func PostFileByFormData(url string, params map[string]string, file_path string, file_key string) (string, error)
使用multipart/form-data发送文件
func SendCustomAppPage ¶
func SendCustomImage ¶
func SendCustomLink ¶
func SendCustomMessage ¶
func SendCustomMessage(access_token string, param CustomerMessage) error
发送客服消息给用户
func SendCustomTyping ¶
下发客服当前输入状态给用户
func SendSubscribeMsg ¶
func SendSubscribeMsg(access_token string, param SubscribeMsgReq) error
发送微信订阅消息
func UpdateActivity ¶
func UpdateActivity(access_token string, param UpdateActivityReq) error
修改被分享的动态消息 消息有两个状态(target_state),分别有其对应的文字内容和颜色。文字内容模板和颜色不支持变更。 0 "成员正在加入,当前 {member_count}/{room_limit} 人" 1 "已开始"
func WxApiPostStruct ¶
Types ¶
type ACodeParam ¶
type ACodeParam struct { //扫码进入的小程序页面路径,最大长度 128 字节 Path string `json:"path"` //最大32个可见字符,只支持数字,大小写英文以及部分特殊字符 Scene string `json:"scene,omitempty"` //检查 page 是否存在,为 true 时 page 必须是已经发布的小程序存在的页面(否则报错); //为 false 时允许小程序未发布或者 page 不存在, 但 page 有数量上限 CheckPath string `json:"check_path,omitempty"` //要打开的小程序版本。正式版为 release,体验版为 trial,开发版为 develop AppEnv string `json:"env_version,omitempty"` //二维码的宽度,单位 px。最小 280px,最大 1280px Width int `json:"width,omitempty"` //自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 AutoColor bool `json:"auto_color,omitempty"` //auto_color 为 false 时生效,使用 rgb 设置颜色 LineColor RGBColor `json:"line_color,omitempty"` //是否需要透明底色,为 true 时,生成透明底色的小程序码 IdHyaline bool `json:"is_hyaline,omitempty"` }
type CheckDetail ¶
type CheckDetail struct { //唯一请求标识,标记单次请求 Strategy string `json:"strategy"` //详细检测结果 Errcode string `json:"errcode"` //建议,有risky、pass、review三种值 Suggest string `json:"suggest"` //命中标签枚举值,100 正常;10001 广告;20001 时政;20002 色情;20003 辱骂;20006 违法犯罪;20008 欺诈;20012 低俗;20013 版权;21000 其他 Label string `json:"label"` //唯一请求标识,标记单次请求 Prob int `json:"prob"` //命中的自定义关键词 Keyword string `json:"keyword"` }
type CheckMediaReq ¶
type CheckMediaReq struct { //要检测的图片或音频的url MediaUrl string `json:"media_url"` //1:音频;2:图片 MediaType MediaType `json:"media_type"` //接口版本号,2.0版本为固定值2 Version string `json:"version"` //用户的openid(用户需在近两小时访问过小程序) OpenId string `json:"openid"` //场景枚举值(1 资料;2 评论;3 论坛;4 社交日志) Scene SceneType `json:"scene"` }
type CheckMediaRet ¶
func CheckMedia ¶
func CheckMedia(access_token string, param CheckMediaReq) (CheckMediaRet, error)
异步校验图片/音频是否含有违法违规内容。 异步检测结果在 30 分钟内会推送到你的消息接收服务器
type CheckResult ¶
type CheckTextReq ¶
type CheckTextReq struct { //接口版本号,2.0版本为固定值2 Version string `json:"version"` //用户的openid(用户需在近两小时访问过小程序) OpenId string `json:"openid"` //场景枚举值(1 资料;2 评论;3 论坛;4 社交日志) Scene SceneType `json:"scene"` //需检测的文本内容,文本字数的上限为2500字,需使用UTF-8编码 Content string `json:"content"` //用户昵称,需使用UTF-8编码 NickName string `json:"nickname"` //文本标题,需使用UTF-8编码 Title string `json:"title"` //个性签名,该参数仅在资料类场景有效(scene=1),需使用UTF-8编码 Signature string `json:"signature"` }
type CheckTextRet ¶
type CheckTextRet struct { WxApiRet //唯一请求标识,标记单次请求 TraceId string `json:"trace_id"` //综合结果 Result CheckResult `json:"result"` //详细检测结果 Detail []CheckDetail `json:"detail"` }
func CheckText ¶
func CheckText(access_token string, param CheckTextReq) (CheckTextRet, error)
检查一段文本是否含有违法违规内容。
type CloudParam ¶
type CloudParam struct { //云开发环境 Env string `json:"env"` //静态网站自定义域名,不填则使用默认域名 Domain string `json:"domain"` //云开发静态网站 H5 页面路径,不可携带 query Path string `json:"path"` //云开发静态网站 H5 页面 query 参数,最大 1024 个字符,只支持数字,大小写英文以及部分特殊字符 Query string `json:"query"` //第三方批量代云开发时必填,表示创建该 env 的 appid ResourceAppId string `json:"resource_appid"` }
type CreateActivityRet ¶
type CreateActivityRet struct { WxApiRet //动态消息的 ID ActivityId string `json:"activity_id"` //activity_id 的过期时间戳。默认24小时后过期。 ExpirationTime int64 `json:"expiration_time"` }
func CreateActivity ¶
func CreateActivity(access_token string, userid string, is_unionid bool) (CreateActivityRet, error)
创建被分享动态消息或私密消息的 activity_id,
type CreateQCodeReq ¶ added in v0.0.2
type CustomTypingReq ¶
type CustomTypingReq struct { //用户的 OpenID ToUser string `json:"touser"` //命令 Command string `json:"command"` }
发送客服消息给用户
type CustomerMessage ¶
type CustomerMessage struct { //用户的 OpenID ToUser string `json:"touser"` //消息类型 MsgType CMType `json:"msgtype"` //文本消息,msgtype="text" 时必填 Text *MediaText `json:"text,omitempty"` //图片消息,msgtype="image" 时必填 Image *MediaImage `json:"image,omitempty"` //图文链接,msgtype="link" 时必填 Link *MediaLink `json:"link,omitempty"` //小程序卡片,msgtype="miniprogrampage" 时必填 AppPage *MediaWxApp `json:"miniprogrampage,omitempty"` }
发送客服消息给用户
type EncryptedCheckRet ¶
type EncryptedCheckRet struct { WxApiRet //是否是合法的数据 Vaild bool `json:"vaild"` //加密数据生成的时间戳 CreateTime int64 `json:"create_time"` }
func EncryptedCheck ¶
func EncryptedCheck(access_token string, encrypted_msg_hash string) (EncryptedCheckRet, error)
检查加密信息是否由微信生成(当前只支持手机号加密数据),只能检测最近3天生成的加密数据
type GetPaidInfoReq ¶
type GetPaidInfoRet ¶
func GetPaidInfo ¶
func GetPaidInfo(access_token string, param GetPaidInfoReq) (GetPaidInfoRet, error)
用户支付完成后,获取该用户的 UnionId,无需用户授权
type GetPhoneNumberRet ¶
func GetPhoneNumber ¶
func GetPhoneNumber(access_token string, code string) (GetPhoneNumberRet, error)
code换取用户手机号。 每个code只能使用一次,code的有效期为5min
type GetPluginPidRet ¶
type MediaImage ¶
type MediaImage struct { //发送的图片的媒体ID,通过 新增素材接口 上传图片文件获得 MediaId string `json:"media_id"` }
微信消息内容对应的结构:图片消息
type MediaLink ¶
type MediaLink struct { //消息标题 Title string `json:"title"` //图文链接消息 Description string `json:"description"` //图文链接消息被点击后跳转的链接 Url string `json:"url"` //图文链接消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 640 X 320,小图 80 X 80 ThumbUrl string `json:"thumb_url"` }
微信消息内容对应的结构:图文链接
type MediaRecive ¶
type MediaRecive struct { ToUserName string `json:"ToUserName"` FromUserName string `json:"FromUserName"` CreateTime int64 `json:"CreateTime"` MsgType string `json:"MsgType"` MsgId int64 `json:"MsgId"` Content string `json:"Content"` PicUrl string `json:"PicUrl"` MediaId string `json:"MediaId"` }
微信用户消息
type MediaText ¶
type MediaText struct { //文本消息内容 Content string `json:"content"` }
微信消息内容对应的结构:文本消息
type MediaWxApp ¶
type MediaWxApp struct { //消息标题 Title string `json:"title"` //小程序的页面路径,跟app.json对齐,支持参数,比如pages/index/index?foo=bar PagePath string `json:"pagepath"` //小程序消息卡片的封面, image 类型的 media_id,通过 新增素材接口 上传图片文件获得 ThumbMediaId string `json:"thumb_media_id"` }
微信消息内容对应的结构:小程序卡片
type PhoneInfo ¶
type PhoneInfo struct { //用户绑定的手机号(国外手机号会有区号) PhoneNumber string `json:"phoneNumber"` //没有区号的手机号 PurePhoneNumber string `json:"purePhoneNumber"` //区号 CountryCode string `json:"countryCode"` WaterMark WxWaterMark `json:"watermark"` }
func DecodePhoneNumber ¶
解密用户手机号数据
type SchemeInfo ¶
type SchemeInfo struct { //小程序 appid。 AppId string `json:"appid"` //小程序页面路径。 Path string `json:"path"` //小程序页面query。 Query string `json:"query"` //创建时间,为 Unix 时间戳。 CreateTime int64 `json:"expire_time"` //到期失效时间,为 Unix 时间戳,0 表示永久生效。 ExpireTime int64 `json:"expire_time"` //要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop"。 AppEnv string `json:"env_version"` }
type SchemeQueryRet ¶
type SchemeQueryRet struct { WxApiRet SchemeInfo SchemeInfo `json:"scheme_info"` SchemeQuot SchemeQuot `json:"scheme_quota"` }
func GetSchemeInfo ¶
func GetSchemeInfo(access_token string, scheme string) (SchemeQueryRet, error)
查询小程序 scheme 码,及长期有效 quota
type SchemeQuot ¶
type ShortLinkReq ¶
type ShortLinkRet ¶
type SubscribeMsgReq ¶
type SubscribeMsgReq struct { //接收者(用户)的 openid Touser string `json:"touser"` //所需下发的订阅模板id TemplID string `json:"template_id"` //点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。 Page string `json:"page"` //模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } } TemplData TemplData `json:"data"` //跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版 AppEnv string `json:"miniprogram_state"` //支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN Lang string `json:"lang"` }
type TemplInfo ¶
type TemplInfo struct { //模板中需要修改的参数 Items []TemplValue `json:"parameter_list"` }
type TemplValue ¶
member_count target_state = 0 时必填,文字内容模板中 member_count 的值 room_limit target_state = 0 时必填,文字内容模板中 room_limit 的值 path target_state = 1 时必填,点击「进入」启动小程序时使用的路径。 version_type target_state = 1 时必填,有效参数值为:develop(开发版),trial(体验版),release(正式版)
type TokenCache ¶
type TokenCache struct {
// contains filtered or unexported fields
}
func (*TokenCache) GetAccessToken ¶
func (cache *TokenCache) GetAccessToken(appid string, secret string) (string, error)
type TokenGetFunc ¶
建议使用中控服务器统一获取和刷新 access_token,因此采用自定义逻辑去获取 access_token
type UpdateActivityReq ¶
type UploadTempMediaRet ¶
type UploadTempMediaRet struct { WxApiRet FileType string `json:"type"` MediaId string `json:"media_id"` CreatedTime int64 `json:"created_at"` }
媒体文件上传返回结果
func UploadTempMedia ¶
func UploadTempMedia(access_token string, file_path string) (UploadTempMediaRet, error)
把媒体文件上传到微信服务器,目前仅支持图片
type UrlLinkInfo ¶
type UrlLinkInfo struct { //小程序 appid。 AppId string `json:"appid"` //小程序页面路径。 Path string `json:"path"` //小程序页面query。 Query string `json:"query"` //创建时间,为 Unix 时间戳。 CreateTime int64 `json:"expire_time"` //到期失效时间,为 Unix 时间戳,0 表示永久生效。 ExpireTime int64 `json:"expire_time"` //要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop"。 AppEnv string `json:"env_version"` //云开发静态网站自定义 H5 配置参数,可配置中转的云开发 H5 页面。不填默认用官方 H5 页面 CloudBase CloudParam `json:"cloud_base"` }
type UrlLinkQueryRet ¶
type UrlLinkQueryRet struct { ErrCode int64 `json:"errcode"` ErrMsg string `json:"errmsg"` UrlLinkInfo UrlLinkInfo `json:"url_link_info"` UrlLinkQuot UrlLinkQuot `json:"url_link_quota"` }
func GetUrlLinkInfo ¶
func GetUrlLinkInfo(access_token string, url_link string) (UrlLinkQueryRet, error)
查询小程序 url_link 配置,及长期有效 quota
type UrlLinkQuot ¶
type UrlLinkReq ¶
type UrlLinkReq struct { //通过 URL Link 进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query 。path 为空时会跳转小程序主页 Path string `json:"path"` //通过 URL Link 进入小程序时的query,最大1024个字符,只支持数字,大小写英文以及部分特殊字符 Query string `json:"query"` //要打开的小程序版本。正式版为 release,体验版为 trial,开发版为 develop AppEnv string `json:"env_version"` //生成的 URL Link 类型,到期失效:true,永久有效:false。 IsExpire bool `json:"is_expire"` //小程序 URL Link 失效类型,失效时间:0,失效间隔天数:1 ExpireType int64 `json:"expire_type"` //到期失效的 scheme 码的失效时间,为 Unix 时间戳 ExpireTime int64 `json:"expire_time"` //到期失效的 scheme 码的失效间隔天数 ExpireInterval int64 `json:"expire_interval"` //云开发静态网站自定义 H5 配置参数,可配置中转的云开发 H5 页面。不填默认用官方 H5 页面 CloudBase CloudParam `json:"cloud_base"` }
type UrlLinkRet ¶
type WeixinApp ¶
type WeixinApp struct { AppID string AppSecret string AccessToken string TokenGetter TokenGetFunc TokenTime int64 // contains filtered or unexported fields }
func NewWeixinApp ¶
func NewWeixinApp(appid string, secret string, fn TokenGetFunc) *WeixinApp
func (*WeixinApp) CheckMedia ¶
func (app *WeixinApp) CheckMedia(param CheckMediaReq) (CheckMediaRet, error)
异步校验图片/音频是否含有违法违规内容。
func (*WeixinApp) CheckText ¶
func (app *WeixinApp) CheckText(param CheckTextReq) (CheckTextRet, error)
检查一段文本是否含有违法违规内容。
func (*WeixinApp) CreateACode ¶
func (app *WeixinApp) CreateACode(param ACodeParam) ([]byte, error)
通过该接口生成的小程序码,永久有效,有数量限制
func (*WeixinApp) CreateACodeUnlimited ¶
func (app *WeixinApp) CreateACodeUnlimited(param ACodeParam) ([]byte, error)
通过该接口生成的小程序码,永久有效,数量暂无限制
func (*WeixinApp) CreateActivity ¶
func (app *WeixinApp) CreateActivity(userid string, is_unionid bool) (CreateActivityRet, error)
创建被分享动态消息或私密消息的 activity_id,
func (*WeixinApp) CreateQCode ¶
生成页面二维码
func (*WeixinApp) CreateShortLink ¶
func (app *WeixinApp) CreateShortLink(param ShortLinkReq) (string, error)
生成小程序shortLink
func (*WeixinApp) CreateShortLinkPermanent ¶
生成永久shortLink
func (*WeixinApp) CreateShortLinkTemp ¶
生成临时shortLink
func (*WeixinApp) CreateUrlLink ¶
func (app *WeixinApp) CreateUrlLink(param UrlLinkReq) (string, error)
生成小程序URL Link,
func (*WeixinApp) CreateUrlScheme ¶
func (app *WeixinApp) CreateUrlScheme(param WxUrlSchemeReq) (string, error)
生成页面Scheme码
func (*WeixinApp) DecodePhoneNumber ¶
解密用户手机号数据
func (*WeixinApp) EncryptedCheck ¶
func (app *WeixinApp) EncryptedCheck(encrypted_msg_hash string) (EncryptedCheckRet, error)
检查加密信息是否由微信生成(当前只支持手机号加密数据),只能检测最近3天生成的加密数据
func (*WeixinApp) GenIMUserSig ¶
func (app *WeixinApp) GenIMUserSig(sdkappid int, key string, identifier string, expire int) (string, error)
用于签发 TRTC 和 IM 服务中必须要使用的 UserSig 鉴权票据
func (*WeixinApp) GetOpenIdByCode ¶
func (app *WeixinApp) GetOpenIdByCode(code string) (WxSessionData, error)
根据登录凭证code获取opendid以及session_key
func (*WeixinApp) GetPaidInfo ¶
func (app *WeixinApp) GetPaidInfo(param GetPaidInfoReq) (GetPaidInfoRet, error)
用户支付完成后,获取该用户的 UnionId,无需用户授权
func (*WeixinApp) GetPhoneNumber ¶
func (app *WeixinApp) GetPhoneNumber(code string) (GetPhoneNumberRet, error)
code换取用户手机号
func (*WeixinApp) GetSchemeInfo ¶
func (app *WeixinApp) GetSchemeInfo(scheme string) (SchemeQueryRet, error)
查询小程序 scheme 码,及长期有效 quota
func (*WeixinApp) GetTempMedia ¶
获取客服消息内的临时素材。即下载临时的多媒体文件。目前小程序仅支持下载图片文件。
func (*WeixinApp) GetUrlLinkInfo ¶
func (app *WeixinApp) GetUrlLinkInfo(url_link string) (UrlLinkQueryRet, error)
查询小程序 url_link 配置,及长期有效 quota
func (*WeixinApp) SendCustomAppPage ¶
func (app *WeixinApp) SendCustomAppPage(touser string, title, pagepath, thumb_media_id string) error
发送客服消息给用户:小程序卡片
func (*WeixinApp) SendCustomImage ¶
发送客服消息给用户:图片消息
func (*WeixinApp) SendCustomLink ¶
func (app *WeixinApp) SendCustomLink(touser string, title, description, url, thumb_url string) error
发送客服消息给用户:图文链接
func (*WeixinApp) SendCustomMessage ¶
func (app *WeixinApp) SendCustomMessage(param CustomerMessage) error
发送客服消息给用户
func (*WeixinApp) SendCustomText ¶
发送客服消息给用户:文本消息
func (*WeixinApp) SendCustomTyping ¶
下发客服当前输入状态给用户
func (*WeixinApp) SendSubscribeMsg ¶
func (app *WeixinApp) SendSubscribeMsg(param SubscribeMsgReq) error
发送微信订阅消息
func (*WeixinApp) UpdateActivity ¶
func (app *WeixinApp) UpdateActivity(param UpdateActivityReq) error
修改被分享的动态消息
func (*WeixinApp) UploadTempMedia ¶
func (app *WeixinApp) UploadTempMedia(file_path string) (UploadTempMediaRet, error)
把媒体文件上传到微信服务器,目前仅支持图片
type WeixinParam ¶
type WeixinParam struct {
// contains filtered or unexported fields
}
type WxApiTokenRet ¶
type WxSessionData ¶
type WxSessionData struct { WxApiRet OpenId string `json:"openid"` UnionId string `json:"unionid"` Sessionkey string `json:"session_key"` }
func GetOpenIdByCode ¶
func GetOpenIdByCode(appid string, secret string, code string) (WxSessionData, error)
登录凭证校验。 通过 wx.login 接口获得临时登录凭证 code 后传到开发者服务器调用此接口完成登录流程。 根据code获取opendid以及session_key
type WxUrlSchemeReq ¶
type WxUrlSchemeReq struct { //跳转到的目标小程序信息 Jump_wxa WxJumpWxa `json:"jump_wxa"` //到期失效:true,永久有效:false IsExpire bool `json:"is_expire"` //失效时间:0,失效间隔天数:1 ExpireType int `json:"expire_type"` //到期失效的 scheme 码的失效时间,为 Unix 时间戳 ExpireTime int64 `json:"expire_time"` //到期失效的 scheme 码的失效间隔天数 ExpireInterval int64 `json:"expire_interval"` }