Skip to content

Commit 00f28a3

Browse files
committed
rebuild
1 parent 19152da commit 00f28a3

File tree

80 files changed

+9118
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+9118
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on: push
2+
name: golang-ci
3+
jobs:
4+
checks:
5+
name: run
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@main
9+
- name: run
10+
uses: cedrickring/golang-action@1.5.2
11+
env:
12+
GO111MODULE: "on"
13+
- name: Use Go 1.13
14+
uses: cedrickring/golang-action/go1.13@1.5.2
15+
env:
16+
GO111MODULE: "on"

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
.idea/
3+
book/
4+
*tmp.go
5+
TODO

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
# miniprogram
1+
# fastwego/miniprogram
2+
3+
A fast wechat miniprogram development framework written in Golang
4+
5+
## 演示 Demo
6+
7+
[https://github.com/fastwego/miniprogram-demo](https://github.com/fastwego/miniprogram-demo)
8+
9+
## 架构设计
10+
11+
![sdk](./doc/img/sdk.jpg)
12+
13+
## 框架特点
14+
15+
### 快速
16+
17+
「快」作为框架设计的核心理念,体现在方方面面:
18+
19+
- 使用 Go 语言,开发快、编译快、部署快、运行快,轻松服务海量用户
20+
- 丰富的文档、教程和演示代码,快速上手,5 分钟即可搭建一套完整的微信公众号服务
21+
- 独立清晰的模块划分,快速熟悉整个框架,没有意外,一切都是你期望的样子
22+
- 甚至连框架自身的大部分代码也是自动生成的,维护更新快到超乎想象
23+
24+
### 符合直觉
25+
26+
作为第三方开发框架,尽可能贴合官方文档和设计,不引入新的概念,不给开发者添加学习负担
27+
28+
### 官方文档就是最好的文档
29+
30+
每个接口的注释都附带官方文档的链接,让你随时翻阅,省时省心
31+
32+
### 完备的单元测试
33+
34+
100% 覆盖每一个接口,让你每一次调用都信心满满
35+
36+
### 详细的日志
37+
38+
每个关键环节都为你完整记录,Debug 倍轻松,你可以自由定义日志输出,甚至可以关闭日志
39+
40+
### 多账号支持
41+
42+
一套服务支持多个账号,轻松成为第三方开发服务平台,业务节节高
43+
44+
### 支持服务集群
45+
46+
单台服务器支撑不住访问流量/想提高服务可用性?
47+
48+
只需重载 GetAccessTokenFunc 方法,从中控服务获取 AccessToken,即可解决多实例刷新冲突/覆盖的问题
49+
50+
### 活跃的开发者社区
51+
52+
FastWeGo 是一套完整的微信开发框架,包括公众号、开放平台、微信支付、企业微信、小程序、小游戏等微信服务,拥有庞大的开发者用户群体
53+
54+
你遇到的所有问题几乎都可以在社区找到解决方案
55+
56+
## 接口列表
57+
58+
[doc/apilist.md](doc/apilist.md)
59+
60+
## 参与贡献
61+
62+
欢迎提交 pull request / issue / 文档,一起让微信开发更快更好!
63+
64+
Faster we go together!

apis/ad/ad.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2020 FastWeGo
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package ad 广告
16+
package ad
17+
18+
const ()

apis/ad/ad_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2020 FastWeGo
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package ad
16+
17+
import (
18+
"os"
19+
"testing"
20+
21+
"github.com/fastwego/miniprogram/test"
22+
)
23+
24+
func TestMain(m *testing.M) {
25+
test.Setup()
26+
os.Exit(m.Run())
27+
}

apis/ad/example_ad_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2020 FastWeGo
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package ad_test
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Copyright 2020 FastWeGo
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package customer_message 客服消息
16+
package customer_message
17+
18+
import (
19+
"bytes"
20+
"net/url"
21+
22+
"github.com/fastwego/miniprogram"
23+
)
24+
25+
const (
26+
apiGetTempMedia = "/cgi-bin/media/get"
27+
apiSend = "/cgi-bin/message/custom/send"
28+
apiSetTyping = "/cgi-bin/message/custom/typing"
29+
apiUploadTempMedia = "/cgi-bin/media/upload"
30+
)
31+
32+
/*
33+
获取客服消息内的临时素材。即下载临时的多媒体文件。目前小程序仅支持下载图片文件。
34+
35+
36+
37+
See: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.getTempMedia.html
38+
39+
GET https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID
40+
*/
41+
func GetTempMedia(ctx *miniprogram.Miniprogram, params url.Values) (resp []byte, err error) {
42+
return ctx.Client.HTTPGet(apiGetTempMedia + "?" + params.Encode())
43+
}
44+
45+
/*
46+
发送客服消息给用户。详细规则见 发送客服消息
47+
48+
49+
50+
See: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.send.html
51+
52+
POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
53+
*/
54+
func Send(ctx *miniprogram.Miniprogram, payload []byte) (resp []byte, err error) {
55+
return ctx.Client.HTTPPost(apiSend, bytes.NewReader(payload), "application/json;charset=utf-8")
56+
}
57+
58+
/*
59+
下发客服当前输入状态给用户。详见 客服消息输入状态
60+
61+
62+
63+
See: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.setTyping.html
64+
65+
POST https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN
66+
*/
67+
func SetTyping(ctx *miniprogram.Miniprogram, payload []byte) (resp []byte, err error) {
68+
return ctx.Client.HTTPPost(apiSetTyping, bytes.NewReader(payload), "application/json;charset=utf-8")
69+
}
70+
71+
/*
72+
把媒体文件上传到微信服务器。目前仅支持图片。用于发送客服消息或被动回复用户消息。
73+
74+
75+
76+
See: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.uploadTempMedia.html
77+
78+
POST https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE
79+
*/
80+
func UploadTempMedia(ctx *miniprogram.Miniprogram, payload []byte, params url.Values) (resp []byte, err error) {
81+
return ctx.Client.HTTPPost(apiUploadTempMedia+"?"+params.Encode(), bytes.NewReader(payload), "application/json;charset=utf-8")
82+
}

0 commit comments

Comments
 (0)