This article has included programming study notes . Covers PHP, JavaScript, Linux, Golang, MySQL, Redis, open source tools and more.
Recently, I was going to develop WeChat mini-programs in Go language, and found that many server-side interfaces of WeChat mini-programs will be called, and they also need to be packaged by themselves. So I thought about going to GitHub to see if there are third-party ready-made SDKs to use directly, and found two very good third-party libraries, which I will share with you here.
SDK standard
Here are a few points. I am using some standard versions of third-party open source libraries for your reference:
- The function is stable, and there are cases in the production environment. To avoid SDK problems, developers need to solve them by themselves.
- The development team is stable and continuously updated. To avoid bugs that are not repaired in the later stage, an open source project similar to KPI appears.
- Powerful enough. After all, the use of open source SDK is to reduce the development of some additional functions by myself, and to spend more on business realization.
- Complete documentation. No matter how good an open source project is, if it does not have a complete document, this will undoubtedly increase a threshold for users, but also reduce the development efficiency, and it will not achieve the purpose of directly using third-party SDKs.
easywechat
If you have developed WeChat ecological products with PHP, you probably know that easywechat is an open source, unofficial third-party SDK. Powerful, easy to install and use because it's a standard Composer package, which means that any PHP project that supports Composer that meets the following installation conditions can use it. Use the following command directly, the installation can be used normally.
composer require overtrue/wechat
powerwechat
PowerWeChat is an easy-to-use WeChat SDK for Golang. Currently, it has covered WeChat Official Accounts, WeChat Mini Programs, WeChat Payments, and Enterprise WeChat. The functions are very powerful, and almost all the products of the WeChat ecosystem are included. It was chosen mainly for the following purposes:
- Powerful and complete WeChat ecological coverage. It covers WeChat official account, WeChat applet, WeChat enterprise account and WeChat payment. Basically, the WeChat development we are in contact with is also in these categories. So it's enough for us to use.
- The development team is stable. PowerWechat is developed by the Artisan Cloud team and is being continuously updated and improved.
Complete documentation. PowerWechat has its own official website, whether it is WeChat public account, WeChat applet, WeChat enterprise account and WeChat payment, there are independent modules to introduce how to use it, and there are also complete sample codes. The following WeChat enterprise account development, how to configure each parameter definition has a good description.
package main import ( "log" ) func main() { WeComApp, err := work.NewWork(&work.UserConfig{ CorpID: "app_id", // 企业微信的app id,所有企业微信共用一个。 AgentID: 100001, // 内部应用的app id Secret: "wecom_secret", // 内部应用的app secret OAuth: work.OAuth{ Callback: "https://wecom.artisan-cloud.com/callback", Scopes: nil, }, HttpDebug: true, }) if err != nil { panic(err) } response := WeComApp.Base.GetCallbackIp() log.Println(response) }
go-wechat-miniapp-sdk
go-wechat-miniapp-sdk is a set of WeChat applet official interface SDK packaged in golang language based on WeChat applet related interface package. The following functions are supported:
- Login|User Information
- Subscribe to news
- Customer service message
- Unified Service Messaging
- Get the applet code
- ...
The SDK is also very simple to use and can be used quickly.
The following is how to install the SDK.
go get github.com/dgb8901/go-wechat-miniapp-sdk
The following is the basic information configuration.
package helper
import (
"github.com/dgb8901/go-wechat-miniapp-sdk/config"
"github.com/dgb8901/go-wechat-miniapp-sdk/service"
)
type wxaHelper struct {
wxaService *service.WxaService
}
var helper = &wxaHelper{}
func Init() {
cfg := &config.Cfg{
AppId: "AppId",
Secret: "Secret",
Token: "Token",
AesKey: "AesKey",
MsgDataFormat: "DataFormat",
}
// wxaConfig := config.NewInRedis(cfg,"127.0.0.1:6379","123456")
// wxaService := service.NewInRedis(redisConfig)
wxaConfig := config.NewInMemory(cfg)
wxaService := service.NewService(wxaConfig)
helper.wxaService = wxaService
}
func GetWxaService() *service.WxaService {
return wxaHelper.wxaService
}
Through the records submitted by GitHub, it can be seen that this SDK should belong to personal development. There is no complete documentation, and it has been updated for a long time. It is not recommended for production environments. If you want to learn how to encapsulate by yourself, or you want to implement your own SDK on this basis, you can learn from this SDK.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。