Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小程序消息推送 #713

Merged
merged 15 commits into from Aug 27, 2023
Merged

Conversation

ccfish86
Copy link
Contributor

小程序消息推送(服务器端)

token:="123456446545"
aeskey:="789134566"

messageReceiver := miniProgramPlatform.GetMessageReceiver(token, aesKey)

	msgType, eventType, pushData, err := messageReceiver.GetMsgData(c.Request)
	if err != nil {
		global.GVA_LOG.Warnf("消息接收异常 %s, %s, %s ", msgType, eventType, zap.Error(err))
		return "error", nil
	}

	if msgType == message.MsgTypeEvent {
		switch eventType {
		case message.EventTypeWxaMediaCheck:
			// 业务处理

		case message.EventTypeTradeManageRemindAccessApi:
			// 业务处理

		case message.EventTypeTradeManageRemindShipping:
			// 业务处理

		case message.EventTypeTradeManageOrderSettlement:

			// 业务处理

		default:
			global.GVA_LOG.Warnf("消息未处理 %s, %s", msgType, eventType)
		}
	} else {
		global.GVA_LOG.Warnf("消息未处理 %s, %s", msgType, eventType)
	}

	return "success", nil

@houseme
Copy link
Collaborator

houseme commented Aug 24, 2023

please fix ci ,可以参考 golangci-lint action的提示

@ccfish86
Copy link
Contributor Author

please fix ci ,可以参考 golangci-lint action的提示

差一个,实在找不到了

@houseme
Copy link
Collaborator

houseme commented Aug 25, 2023

please fix ci ,可以参考 golangci-lint action的提示

差一个,实在找不到了

if _, rawMsgBytes, err := util.DecryptMsg(receiver.AppID, reqData.Encrypt, receiver.AesKey); err != nil {
	return nil, err
} else {
	return rawMsgBytes, nil
}

修改:

var rawMsgBytes []byte
if _, rawMsgBytes, err := util.DecryptMsg(receiver.AppID, reqData.Encrypt, receiver.AesKey); err != nil {
	return nil, err
} 
return rawMsgBytes, nil

@houseme
Copy link
Collaborator

houseme commented Aug 25, 2023

@ccfish86 辛苦处理一下冲突,是不是还有配置信息需要加进去,可以参考一下这个同学的 pr #429

以及这里还有新的消息推送类型:
短剧审核:
https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/mini-drama/mini_drama.html#_5-%E4%BA%8B%E4%BB%B6%E9%80%9A%E7%9F%A5

虚拟支付:
https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html#_2-4-%E7%AD%BE%E5%90%8D%E8%AF%A6%E8%A7%A3
签名详解的上面有 2 个类型,如下:

道具发货推送xpay_goods_deliver_notify

代币支付推送xpay_coin_pay_notify

@silenceper
Copy link
Owner

麻烦解决一下冲突

// 小程序完成账期授权时/小程序产生第一笔交易时/已产生交易但从未发货的小程序,每天一次
EventTypeTradeManageRemindAccessAPI EventType = "trade_manage_remind_access_api"
// EventTypeTradeManageRemindShipping 提醒需要上传发货信息
// 曾经发过货的小程序,订单超过48小时未发货时
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个注释完善一下

@houseme
Copy link
Collaborator

houseme commented Aug 27, 2023

@ccfish86 辛苦解决一下冲突

@ccfish86
Copy link
Contributor Author

在外边,晚会 修复下冲突

@houseme
Copy link
Collaborator

houseme commented Aug 27, 2023

https://github.com/silenceper/wechat/blob/e02af1dc0ff5c635b9f94ea5b8e9dfc222e2a2df/.golangci.yml#L58C5-L58C15

目前最多 40 语句,把上面的 40 改成 50,不然就需要优化一下代码了。 @ccfish86

@ccfish86
Copy link
Contributor Author

https://github.com/silenceper/wechat/blob/e02af1dc0ff5c635b9f94ea5b8e9dfc222e2a2df/.golangci.yml#L58C5-L58C15

目前最多 40 语句,把上面的 40 改成 50,不然就需要优化一下代码了。 @ccfish86

问题是还有一些事件没有写完,后面还是得优化一下,等加xml支持时一起做吧。

@houseme houseme merged commit dea33e0 into silenceper:v2 Aug 27, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants