Wechat template message push message queue.
注:需要先到微信公众平台添加worker端IP白名单
go build
修改config.yml.sample改名为config.yml,修改相关配置即可。
增加下列环境变量,对应参数参考env.yml.sample文件
HTTP
DB_TYPE
DB_PREFIX
DB_USER
DB_PASS
DB_HOST
DB_PORT
DB_NAME
DB_CHARSET
WECHAT_APPID
WECHAT_APPSECRET
WECHAT_TEMPLATE
WECHAT_REMARK
./queue -c config.yml httpServer
./queue -c config.yml worker
1. 心跳检测
检测HTTP Server是否健康,该接口不返回任何数据,只返回HTTP 200
[http://localhost:5000/heartbeat)
GET
|参数|必选|类型|说明| |:----- |:-------|:-----|----- | |- |- |-|- |
2. 推送队列
发起请求后将会开始查询所有符合推送条件的数据并进行推送
[http://localhost:5000//pushJob)
POST FORM-DATA
|参数|必选|类型|说明| |:----- |:-------|:-----|----- | |type |ture |string|通知类型:1指定ID,2分类 | |data |true |string |数据:使用逗号分隔,如果type等于2,则此字段值填1-5| |employer |true |string |需求方名称| |time |true |string |截止时间| |url |true |string |模板消息跳转URL|
success
- HTTP异步响应,减少Client耗时。√
- 获取用户openid时增加查询缓存,提高查询效率。
- HTTP Server增加鉴权机制,不允许白名单之外的Client访问调用。
- 优化配置方式。
- 模板消息DEMO:https://github.com/GanEasy/wechatSendTemplateMessage
- Queue-machinery:https://github.com/RichardKnop/machinery
- ORM-GoRose:https://github.com/gohouse/gorose