feat(wechat): 支付成功后微信客服消息推回执(积分包/订阅购买)

用户扫码付款后(在 48h 互动窗口内),主动推一条客服消息回执:
到账积分/开通套餐 + 当前余额。只在 MarkOrderPaid changed=true 首次到账时推,
异步+超时隔离,失败只记日志、绝不影响入账。非微信用户自动跳过。

不做「周期刷新提醒」:客服消息受 48h 窗口限制,定时刷新那刻用户多半已超窗、
必然失败,那类隔天提醒须用模板消息(暂缓)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-21 11:23:41 +08:00
parent 83269e067a
commit 68608c1592
4 changed files with 129 additions and 2 deletions
@@ -0,0 +1,19 @@
package handler
import "testing"
// 回执里的积分数要给人看:整除去小数、非整留两位。
func TestCreditsFormat(t *testing.T) {
cases := map[int64]string{
0: "0",
1_000_000: "1",
5_000_000: "5",
1_500_000: "1.50",
2_340_000: "2.34",
}
for micro, want := range cases {
if got := credits(micro); got != want {
t.Fatalf("credits(%d)=%q want %q", micro, got, want)
}
}
}