Documentation
¶
Index ¶
Constants ¶
const SecurityErrCode = 87014
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MiniProgram ¶
func NewMiniProgram ¶
func NewMiniProgram(cache cache.Provider, log *log.Slf4g, cfg MiniProgramConfig) *MiniProgram
func (*MiniProgram) Code2Session ¶
func (mp *MiniProgram) Code2Session(code string) (t bool, sm SessionModel)
Code2Session 登录凭证校验。通过 wx.login 接口获得临时登录凭证 code 后传到开发者服务器调用此接口完成登录流程 请求地址 GET https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code 请求参数 属性 类型 必填 说明 appid string 是 小程序appId secret string 是 小程序appSecret js_code string 是 登录时获取的code grant_type string 是 授权类型,此处只需填写 authorization_code
返回详情: SecurityModel
func (*MiniProgram) TextSecurityCheck ¶
func (mp *MiniProgram) TextSecurityCheck(txt string) (t bool, em common.ErrorModel)
TextSecurityCheck 检查一段文本是否含有违法违规内容 应用场景举例: 用户个人资料违规文字检测; 媒体新闻类用户发表文章,评论内容检测; 等等 请求地址 POST https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN 请求参数 属性 类型 必填 说明 access_token string 是 接口调用凭证 content string 是 要检测的文本内容,长度不超过 500KB
返回详情: common.ErrorModel
type MiniProgramConfig ¶
type SecurityModel ¶
type SecurityModel struct {
common.ErrorModel
}
SecurityModel 内容审核结果 errcode 的合法值
值 说明 0 内容正常 87014 内容含有违法违规内容
type SessionModel ¶
type SessionModel struct { UserAuthorization common.ErrorModel }
SessionModel 登陆凭证校验接口返回参数说明 属性 类型 说明 openid string 用户唯一标识 session_key string 会话密钥 unionid string 用户在开放平台的唯一标识符,在满足 UnionID 下发条件的情况下会返回,详见 UnionID 机制说明。 errcode number 错误码 errmsg string 错误信息 code码对应错误(-1:系统繁忙,此时请开发者稍候再试, 0:请求成功, 40029:code 无效, 45011:频率限制,每个用户每分钟100次)