1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-06 13:42:26 +08:00
This commit is contained in:
houseme
2024-07-19 12:04:04 +08:00
parent ba0a1477eb
commit d8fde54f2d
118 changed files with 974 additions and 867 deletions

View File

@@ -53,7 +53,7 @@ func (basic *Basic) GetAccountBasicInfo() (*AccountBasicInfo, error) {
return result, nil
}
// modify_domain设置服务器域名
// modify_domain 设置服务器域名
// TODO
// func (encryptor *Basic) modifyDomain() {
// }
@@ -87,7 +87,7 @@ func (basic *Basic) CheckNickName(nickname string) (*CheckNickNameResp, error) {
// SetNickNameResp 设置小程序名称结果
type SetNickNameResp struct {
util.CommonError
AuditID int64 `json:"audit_id"` // 审核单Id通过用于查询改名审核状态
AuditID int64 `json:"audit_id"` // 审核单 Id通过用于查询改名审核状态
Wording string `json:"wording"` // 材料说明
}
@@ -221,7 +221,7 @@ func (basic *Basic) SetHeadImage(imgMediaID string) error {
}
// SetHeadImageFull 修改小程序头像
// 新增临时素材: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html
// 新增临时素材https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html
// ref: https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/basic-info-management/setHeadImage.html
func (basic *Basic) SetHeadImageFull(param *SetHeadImageParam) error {
ak, err := basic.GetAuthrAccessToken(basic.AppID)

View File

@@ -25,7 +25,7 @@ func NewComponent(opContext *openContext.Context) *Component {
type RegisterMiniProgramParam struct {
Name string `json:"name"` // 企业名
Code string `json:"code"` // 企业代码
CodeType string `json:"code_type"` // 企业代码类型 1统一社会信用代码18 位) 2组织机构代码9 位 xxxxxxxx-x 3营业执照注册号(15 位)
CodeType string `json:"code_type"` // 企业代码类型 1统一社会信用代码18 位2组织机构代码9 位 xxxxxxxx-x3营业执照注册号 (15 位)
LegalPersonaWechat string `json:"legal_persona_wechat"` // 法人微信号
LegalPersonaName string `json:"legal_persona_name"` // 法人姓名(绑定银行卡)
ComponentPhone string `json:"component_phone"` // 第三方联系电话(方便法人与第三方联系)
@@ -54,7 +54,7 @@ type GetRegistrationStatusParam struct {
}
// GetRegistrationStatus 查询创建任务状态.
// GetRegistrationStatus 查询创建任务状态
func (component *Component) GetRegistrationStatus(param *GetRegistrationStatusParam) error {
componentAK, err := component.GetComponentAccessToken()
if err != nil {

View File

@@ -21,7 +21,7 @@ type MiniProgram struct {
authorizerRefreshToken string
}
// GetAccessToken 获取ak
// GetAccessToken 获取 ak
func (miniProgram *MiniProgram) GetAccessToken() (string, error) {
ak, akErr := miniProgram.openContext.GetAuthrAccessToken(miniProgram.AppID)
if akErr == nil {
@@ -37,7 +37,7 @@ func (miniProgram *MiniProgram) GetAccessToken() (string, error) {
return akRes.AccessToken, nil
}
// SetAuthorizerRefreshToken 设置代执操作业务授权账号authorizer_refresh_token
// SetAuthorizerRefreshToken 设置代执操作业务授权账号 authorizer_refresh_token
func (miniProgram *MiniProgram) SetAuthorizerRefreshToken(authorizerRefreshToken string) *MiniProgram {
miniProgram.authorizerRefreshToken = authorizerRefreshToken
return miniProgram
@@ -49,7 +49,7 @@ func NewMiniProgram(opCtx *openContext.Context, appID string) *MiniProgram {
AppID: opCtx.AppID,
Cache: opCtx.Cache,
})
// 设置获取access_token的函数
// 设置获取 access_token 的函数
miniProgram.SetAccessTokenHandle(NewDefaultAuthrAccessToken(opCtx, appID))
return &MiniProgram{AppID: appID, MiniProgram: miniProgram, openContext: opCtx}
}
@@ -65,20 +65,20 @@ func (miniProgram *MiniProgram) GetBasic() *basic.Basic {
return basic.NewBasic(miniProgram.openContext, miniProgram.AppID)
}
// GetURLLink 小程序URL Link接口 调用前需确认已调用 SetAuthorizerRefreshToken 避免由于缓存中 authorizer_access_token 过期执行中断
// GetURLLink 小程序 URL Link 接口 调用前需确认已调用 SetAuthorizerRefreshToken 避免由于缓存中 authorizer_access_token 过期执行中断
func (miniProgram *MiniProgram) GetURLLink() *urllink.URLLink {
return urllink.NewURLLink(&miniContext.Context{
AccessTokenHandle: miniProgram,
})
}
// DefaultAuthrAccessToken 默认获取授权ak的方法
// DefaultAuthrAccessToken 默认获取授权 ak 的方法
type DefaultAuthrAccessToken struct {
opCtx *openContext.Context
appID string
}
// NewDefaultAuthrAccessToken 设置access_token
// NewDefaultAuthrAccessToken 设置 access_token
func NewDefaultAuthrAccessToken(opCtx *openContext.Context, appID string) credential.AccessTokenHandle {
return &DefaultAuthrAccessToken{
opCtx: opCtx,
@@ -86,7 +86,7 @@ func NewDefaultAuthrAccessToken(opCtx *openContext.Context, appID string) creden
}
}
// GetAccessToken 获取ak
// GetAccessToken 获取 ak
func (ak *DefaultAuthrAccessToken) GetAccessToken() (string, error) {
return ak.opCtx.GetAuthrAccessToken(ak.appID)
}