Skip to content

Commit

Permalink
feat(v3): add context and change to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Jan 8, 2023
1 parent 03150e2 commit e366d26
Show file tree
Hide file tree
Showing 54 changed files with 229 additions and 219 deletions.
2 changes: 1 addition & 1 deletion src/zh/mini-program/content-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ services.MiniProgramApp.Security.MediaCheckAsync(request.RequestSecurityMediaChe
3. 游戏类用户编辑上传的素材(如答题类小游戏用户上传的问题及答案)检测等。 *频率限制:单个 appId 调用上限为 4000 次/分钟,2,000,000 次/天**

``` go
services.MiniProgramApp.Security.MsgSecCheck(&request.RequestSecurityMsgSecCheck{
services.MiniProgramApp.Security.MsgSecCheck(ctx,&request.RequestSecurityMsgSecCheck{
OpenID: openID,
Scene: 1,
Version: 2,
Expand Down
24 changes: 12 additions & 12 deletions src/zh/mini-program/live.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: 使用PowerWeChat可以方便的管理小程序直播,包含直
### 创建直播间

``` go
MiniProgramApp.Broadcast.CreateRoom(&request.RequestBroadcastCreateRoom{
MiniProgramApp.Broadcast.CreateRoom(ctx,&request.RequestBroadcastCreateRoom{
Name: "直播测试3",
CoverImg: "xisnqd5vEly5mjX9r3VjW1XGinnZjyEHcv0czEKYw8SBff7lixnbCIrE0QkgStj4",
StartTime: 1631923200,
Expand All @@ -34,7 +34,7 @@ MiniProgramApp.Broadcast.CreateRoom(&request.RequestBroadcastCreateRoom{
### 直播间列表

```go
MiniProgramApp.Broadcast.GetLiveInfo(&request.RequestBroadcastGetLiveInfo{
MiniProgramApp.Broadcast.GetLiveInfo(ctx,&request.RequestBroadcastGetLiveInfo{
Start: 0,
Limit: 0,
})
Expand All @@ -47,7 +47,7 @@ MiniProgramApp.Broadcast.GetLiveInfo(&request.RequestBroadcastGetLiveInfo{
### 获取直播间回放

``` go
MiniProgramApp.Broadcast.GetLiveReplay(&request.RequestBroadcastGetLiveReplay{
MiniProgramApp.Broadcast.GetLiveReplay(ctx,&request.RequestBroadcastGetLiveReplay{
Action: "get_replay",
RoomID: 4,
Start: 0,
Expand All @@ -62,7 +62,7 @@ MiniProgramApp.Broadcast.GetLiveReplay(&request.RequestBroadcastGetLiveReplay{
### 直播间导入商品

``` go
MiniProgramApp.Broadcast.AddGoods(&request.RequestBroadcastAddGoods{
MiniProgramApp.Broadcast.AddGoods(ctx, &request.RequestBroadcastAddGoods{
IDs: []int{6, 7},
RoomID: 3,
})
Expand All @@ -83,7 +83,7 @@ MiniProgramApp.Broadcast.DeleteRoom(1)
### 编辑直播间

``` go
MiniProgramApp.Broadcast.EditRoom(&request.RequestBroadcastEditRoom{
MiniProgramApp.Broadcast.EditRoom(ctx, &request.RequestBroadcastEditRoom{
Id: 2,
Name: "直播测试",
CoverImg: "xisnqd5vEly5mjX9r3VjW1XGinnZjyEHcv0czEKYw8SBff7lixnbCIrE0QkgStj4",
Expand Down Expand Up @@ -134,7 +134,7 @@ MiniProgramApp.Broadcast.GetSharedCode(2, "a=1&b=2")
### 添加管理直播间小助手

``` go
MiniProgramApp.Broadcast.AddAssistant(&request.RequestBroadcastAddAssistant{
MiniProgramApp.Broadcast.AddAssistant(ctx, &request.RequestBroadcastAddAssistant{
RoomID: 4,
Users: []request.RequestBroadcastAddAssistantUser{
{
Expand All @@ -154,7 +154,7 @@ MiniProgramApp.Broadcast.AddAssistant(&request.RequestBroadcastAddAssistant{
## 修改管理直播间小助手

``` go
MiniProgramApp.Broadcast.ModifyAssistant(&request.RequestBroadcastModifyAssistant{
MiniProgramApp.Broadcast.ModifyAssistant(ctx, &request.RequestBroadcastModifyAssistant{
RoomID: 4,
UserName: "walle1",
NickName: "robot3",
Expand All @@ -166,7 +166,7 @@ MiniProgramApp.Broadcast.ModifyAssistant(&request.RequestBroadcastModifyAssistan
## 删除管理直播间小助手

``` go
MiniProgramApp.Broadcast.RemoveAssistant(&request.RequestBroadcastRemoveAssistant{
MiniProgramApp.Broadcast.RemoveAssistant(ctx, &request.RequestBroadcastRemoveAssistant{
RoomID: 4,
UserName: "walle1",
})
Expand Down Expand Up @@ -303,7 +303,7 @@ MiniProgramApp.Broadcast.GoodsVideo(1, 1) // roomId, goodsId
### 商品添加并提审

``` go
MiniProgramApp.Broadcast.GoodsAdd(&request.RequestBroadcastGoodsAdd{
MiniProgramApp.Broadcast.GoodsAdd(ctx, &request.RequestBroadcastGoodsAdd{
GoodsInfo: &request.RequestBroadcastGoodsAddInfo{
CoverImgUrl: "PZjGoGn7b27AahidBpD-UwJ9823ayNlJ2qliDcU9uQMFSpYkRLxmx_RK0F-iBKj5",
Name: "TIT茶杯",
Expand All @@ -320,7 +320,7 @@ MiniProgramApp.Broadcast.GoodsAdd(&request.RequestBroadcastGoodsAdd{
### 撤回商品审核

``` go
MiniProgramApp.Broadcast.GoodsResetAudit(&request.RequestBroadcastGoodsResetAudit{
MiniProgramApp.Broadcast.GoodsResetAudit(ctx, &request.RequestBroadcastGoodsResetAudit{
AuditID: 450889673,
GoodsID: 7,
})
Expand Down Expand Up @@ -349,7 +349,7 @@ MiniProgramApp.Broadcast.GoodsDelete(1) // goodsId
调用此接口可以更新商品信息,审核通过的商品仅允许更新价格类型与价格,审核中的商品不允许更新,未审核的商品允许更新所有字段, 只传入需要更新的字段。

``` go
MiniProgramApp.Broadcast.GoodsUpdate(&request.RequestBroadcastGoodsUpdate{
MiniProgramApp.Broadcast.GoodsUpdate(ctx, &request.RequestBroadcastGoodsUpdate{
GoodsInfo: &request.RequestBroadcastGoodsUpdateInfo{
GoodsId: 1,
CoverImgUrl: "PZjGoGn7b27AahidBpD-UwJ9823ayNlJ2qliDcU9uQMFSpYkRLxmx_RK0F-iBKj5",
Expand Down Expand Up @@ -406,7 +406,7 @@ MiniProgramApp.Broadcast.DeleteRole("Walle1", 1) // username, role
### 查询成员列表

``` go
MiniProgramApp.Broadcast.GetRoleList(&request.RequestBroadcastGetRoleList{
MiniProgramApp.Broadcast.GetRoleList(ctx, &request.RequestBroadcastGetRoleList{
Role: 1,
Offset: 0,
Limit: 10,
Expand Down
4 changes: 2 additions & 2 deletions src/zh/mini-program/miniprogram-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services.MiniProgramApp.WXACode.CreateQRCode("/page/index/index", 300)
获取小程序码,适用于需要的码数量较少的业务场景。**通过该接口生成的小程序码,永久有效,有数量限制**,详见[获取二维码](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/qr-code.html)

``` go
MiniProgramApp.WXACode.Get(&request.RequestQRCodeGet{
MiniProgramApp.WXACode.Get(ctx, &request.RequestQRCodeGet{
Path: path,
Width: 300,
AutoColor: false,
Expand All @@ -38,7 +38,7 @@ MiniProgramApp.WXACode.Get(&request.RequestQRCodeGet{
获取小程序码,适用于需要的码数量极多的业务场景。**通过该接口生成的小程序码,永久有效,数量暂无限制。** 更多用法详见 [获取二维码](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/qr-code.html)

``` go
MiniProgramApp.WXACode.GetUnlimited(&request.RequestQRCodeGetUnlimited{
MiniProgramApp.WXACode.GetUnlimited(ctx, &request.RequestQRCodeGetUnlimited{
Scene: "a=1",
Page: page,
Width: 430,
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/nearby-miniprogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: 使用PowerWeChat对附近的小程序进行地点添加、删除
## 添加地点

``` go
MiniProgramApp.NearbyPoi.Add(&request.RequestNearbyPoiAdd{
MiniProgramApp.NearbyPoi.Add(ctx, &request.RequestNearbyPoiAdd{
IsCommNearby: "1", //值固定
KfInfo: "{\"open_kf\":true,\"kf_headimg\":\"http://mmbiz.qpic.cn/mmbiz_jpg/kKMgNtnEfQzDKpLXYhgo3W3Gndl34gITqmP914zSwhajIEJzUPpx40P7R8fRe1QmicneQMhFzpZNhSLjrvU1pIA/0?wx_fmt=jpeg\",\"kf_name\":\"Harden\"}",
PicList: "{\"list\":[\"http://mmbiz.qpic.cn/mmbiz_jpg/kKMgNtnEfQzDKpLXYhgo3W3Gndl34gITqmP914zSwhajIEJzUPpx40P7R8fRe1QmicneQMhFzpZNhSLjrvU1pIA/0?wx_fmt=jpeg\",\"http://mmbiz.qpic.cn/mmbiz_jpg/kKMgNtnEfQzDKpLXYhgo3W3Gndl34gITRneE5FS9uYruXGMmrtmhsBySwddEWUGOibG8Ze2NT5E3Dyt79I0htNg/0?wx_fmt=jpeg\"]}",
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/service-market.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ serviceData := &power.HashMap{
"data_type": 3,
"ocr_type": 1,
}
services.AppMiniProgram.ServiceMarket.InvokeService(&request.RequestServiceMarket{
services.AppMiniProgram.ServiceMarket.InvokeService(ctx, &request.RequestServiceMarket{
Service: "SERVICEID",
Api: "APINAME",
ClientMsgID: "CLIENTMSGID",
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/service-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: 使用PowerWeChat处理小程序客服消息,回复用户文本

```go
// rs已经是一个标准的*http.Response,您可以直接使用流转发的形式给到浏览器
rs, err := MiniProgramApp.CustomerServiceMessage.GetTempMedia("[mediaID]")
rs, err := MiniProgramApp.CustomerServiceMessage.GetTempMedia(ctx,"[mediaID]")
// 例如: gin里面使用io.Copy
io.Copy(ctx.Writer, rs.Body)
```
Expand Down
4 changes: 2 additions & 2 deletions src/zh/mini-program/short-link.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ pageUrl := "/pages/index/index?query1=q1"
pageTitle := "Homework title"
isPermanent := false

MiniProgramApp.ShortLink.Generate(pageUrl, pageTitle, isPermanent)
MiniProgramApp.ShortLink.Generate(ctx,pageUrl, pageTitle, isPermanent)
```
[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/short-link/shortlink.generate.html)

## 使用示例

参考:[PowerWechatTutorial](https://github.com/ArtisanCloud/PowerWechatTutorial/blob/master/controllers/miniprogram/short-link.go)
参考:[PowerWechatTutorial](https://github.com/ArtisanCloud/PowerWechatTutorial/blob/master/controllers/miniprogram/short-link.go)
20 changes: 10 additions & 10 deletions src/zh/mini-program/statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: 通过PowerWeChat查询小程序的访问留存、访问趋势、
### 小程序日留存

```go
MiniProgramApp.DataCube.GetDailyRetainInfo("20170313", "20170313")
MiniProgramApp.DataCube.GetDailyRetainInfo(ctx,"20170313", "20170313")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getDailyRetain.html)
Expand All @@ -21,7 +21,7 @@ MiniProgramApp.DataCube.GetDailyRetainInfo("20170313", "20170313")
### 小程序月留存

```go
MiniProgramApp.DataCube.GetMonthlyRetainInfo("20210906", "20210912")
MiniProgramApp.DataCube.GetMonthlyRetainInfo(ctx,"20210906", "20210912")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getMonthlyRetain.html)
Expand All @@ -31,7 +31,7 @@ MiniProgramApp.DataCube.GetMonthlyRetainInfo("20210906", "20210912")
### 小程序周留存

```go
MiniProgramApp.DataCube.GetWeeklyRetainInfo("20170201", "20170228")
MiniProgramApp.DataCube.GetWeeklyRetainInfo(ctx,"20170201", "20170228")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-retain/analysis.getWeeklyRetain.html)
Expand All @@ -41,7 +41,7 @@ MiniProgramApp.DataCube.GetWeeklyRetainInfo("20170201", "20170228")
### 小程序数据概况

```go
MiniProgramApp.DataCube.GetDailySummary("20170313", "20170313")
MiniProgramApp.DataCube.GetDailySummary(ctx,"20170313", "20170313")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getDailySummary.html)
Expand All @@ -51,7 +51,7 @@ MiniProgramApp.DataCube.GetDailySummary("20170313", "20170313")
### 小程序数据日趋势

```go
MiniProgramApp.DataCube.GetDailyVisitTrend("20170313", "20170313")
MiniProgramApp.DataCube.GetDailyVisitTrend(ctx,"20170313", "20170313")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-trend/analysis.getDailyVisitTrend.html)
Expand All @@ -63,7 +63,7 @@ MiniProgramApp.DataCube.GetDailyVisitTrend("20170313", "20170313")
注:(能查询到的最新数据为上一个自然月的数据)

```go
MiniProgramApp.DataCube.GetMonthlyVisitTrend("20170301", "20170301")
MiniProgramApp.DataCube.GetMonthlyVisitTrend(ctx,"20170301", "20170301")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-trend/analysis.getMonthlyVisitTrend.html)
Expand All @@ -73,7 +73,7 @@ MiniProgramApp.DataCube.GetMonthlyVisitTrend("20170301", "20170301")
### 小程序数据周趋势

```go
MiniProgramApp.DataCube.GetWeeklyVisitTrend("20170306", "20170312")
MiniProgramApp.DataCube.GetWeeklyVisitTrend(ctx,"20170306", "20170312")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/visit-trend/analysis.getWeeklyVisitTrend.html)
Expand Down Expand Up @@ -115,23 +115,23 @@ MiniProgramApp.DataCube.GetPerformanceData(options)
from := "20210906"
to := "20210912"

MiniProgramApp.DataCube.GetUserPortrait("20170611", "20170617")
MiniProgramApp.DataCube.GetUserPortrait(ctx,"20170611", "20170617")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getUserPortrait.html)

## 访问分布数据

```go
MiniProgramApp.DataCube.GetVisitDistribution("20170313", "20170313")
MiniProgramApp.DataCube.GetVisitDistribution(ctx,"20170313", "20170313")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getVisitDistribution.html)

## 访问页面数据

```go
MiniProgramApp.DataCube.GetVisitPage("20170313", "20170313")
MiniProgramApp.DataCube.GetVisitPage(ctx,"20170313", "20170313")
```

[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getUserPortrait.html)
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/subscription-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data := &power.HashMap{
"value": "开课3小时前",
},
}
MiniProgramApp.SubscribeMessage.Send(&request.RequestSubscribeMessageSend{
MiniProgramApp.SubscribeMessage.Send(ctx, &request.RequestSubscribeMessageSend{
ToUser: "OPENID",
TemplateID: "Y1471771tIQyEogSHjqCgD1P7iy52N_JYH-q0Sw7EvQ",
Page: "/pages/index/index",
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/uniform-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: 下发小程序和公众号统一的服务消息
下发小程序和公众号统一的服务消息。

```go
MiniProgramApp.UniformMessage.Send(&request.RequestUniformMessageSend{
MiniProgramApp.UniformMessage.Send(ctx, &request.RequestUniformMessageSend{
ToUser: "openID",
WeAppTemplateMsg: &request.WeAppTemplateMsg{
TemplateID: "TEMPLATE_ID",
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/updatable-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services.AppMiniProgram.UpdatableMessage.CreateActivityID("[unionID]", "[openID]
修改被分享的动态消息。

```go
MiniProgramApp.UpdatableMessage.SetUpdatableMsg(&request.RequestSetUpdatableMsg{
MiniProgramApp.UpdatableMessage.SetUpdatableMsg(ctx, &request.RequestSetUpdatableMsg{
ActivityID: "[activityID]",
TargetState: 0,
TemplateInfo: &request.TemplateInfo{
Expand Down
4 changes: 2 additions & 2 deletions src/zh/mini-program/url-link.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 小程序 URL Link

``` go
MiniProgramApp.URLLink.Generate(&request.URLLinkGenerate{
MiniProgramApp.URLLink.Generate(ctx, &request.URLLinkGenerate{
EnvVersion: "release",
ExpireInterval: 1606737600,
Path: "pages/index/index",
Expand All @@ -15,4 +15,4 @@ MiniProgramApp.URLLink.Generate(&request.URLLinkGenerate{

## 使用示例

参考:[PowerWechatTutorial](https://github.com/ArtisanCloud/PowerWechatTutorial/blob/master/controllers/miniprogram/url-link.go)
参考:[PowerWechatTutorial](https://github.com/ArtisanCloud/PowerWechatTutorial/blob/master/controllers/miniprogram/url-link.go)
4 changes: 2 additions & 2 deletions src/zh/mini-program/url-scheme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: 使用PowerWeChat生成小程序scheme码用于短信、邮件、
获取小程序 scheme 码,适用于短信、邮件、外部网页、微信内等拉起小程序的业务场景。**通过该接口,可以选择生成到期失效和永久有效的小程序码,有数量限制**,目前仅针对国内非个人主体的小程序开放,详见[获取 URL scheme](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-scheme.html)

``` go
MiniProgramApp.URLLink.Generate(&request.URLLinkGenerate{
MiniProgramApp.URLLink.Generate(ctx, &request.URLLinkGenerate{
EnvVersion: "release",
ExpireInterval: 1606737600,
Path: "pages/index/index",
Expand All @@ -22,4 +22,4 @@ MiniProgramApp.URLLink.Generate(&request.URLLinkGenerate{
[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html)

## 使用示例
参考:[PowerWechatTutorial](https://github.com/ArtisanCloud/PowerWechatTutorial/blob/master/controllers/miniprogram/url-scheme.go)
参考:[PowerWechatTutorial](https://github.com/ArtisanCloud/PowerWechatTutorial/blob/master/controllers/miniprogram/url-scheme.go)
2 changes: 1 addition & 1 deletion src/zh/mini-program/user-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ hash := hashByte[:]
用户支付完成后,获取该用户的 [UnionId](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html),无需用户授权。本接口支持[第三方平台代理查询](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=215453152075Ry2s&token=&lang=zh_CN)

``` go
MiniProgramApp.Base.GetPaidUnionID(&request.RequestGetPaidUnionID{
MiniProgramApp.Base.GetPaidUnionID(ctx, &request.RequestGetPaidUnionID{
OpenID: openid,
// TransactionID: "",
// MchID: "",
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/verify-signature.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: 使用PowerWechat完成TouchID(指纹认证)、FaceID(面容)、声
生物认证是可以支持`TouchID(指纹认证)``FaceID(面容)``声纹`等认证。

``` go
MiniProgramApp.Soter.VerifySignature(&request.RequestSoter{
MiniProgramApp.Soter.VerifySignature(ctx, &request.RequestSoter{
OpenID: openID,
JsonString: jsonString,
JsonSignature: jsonSignature,
Expand Down
2 changes: 1 addition & 1 deletion src/zh/mini-program/wechat-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MiniProgramApp.Base.CheckEncryptedData("hsSuSUsePBqSQw2rYMtf9Nvha603xX8f2BMQBcYR


``` go
MiniProgramApp.Base.GetPaidUnionID(&request.RequestGetPaidUnionID{
MiniProgramApp.Base.GetPaidUnionID(ctx, &request.RequestGetPaidUnionID{
OpenID: openid,
// TransactionID: "",
// MchID: "",
Expand Down
2 changes: 1 addition & 1 deletion src/zh/official-account/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OfficialAccountApp.Base.ClearQuota()

## 获取微信服务器 IP (或IP段)
```go
OfficialAccountApp.Base.GetCallbackIP()
OfficialAccountApp.Base.GetCallbackIP(ctx)
```

## 使用示例
Expand Down
Loading

0 comments on commit e366d26

Please sign in to comment.