Created
October 7, 2018 07:46
-
-
Save 85636682/a4787f6ee9a28f001b807ebd4520ce43 to your computer and use it in GitHub Desktop.
微信短信模板代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
activity_bonus_record = ActivityBonusRecord.create( | |
activity_id: activity_user.activity_id, | |
user_id: parent.id, | |
bonus: bonus, | |
response: response, | |
redpack_url: response["redpack_url"], | |
redpack_sn: response["redpack_sn"] | |
) | |
template = { | |
"template_id" => "DBsfQoDzQdanLD-y3qrR7UeXMogEuj0fhus-1IU2QF0", | |
"url" => response["redpack_url"], | |
"data" => { | |
"first" => { | |
"value" => "恭喜你获取一个红包" | |
}, | |
"keyword1" => { | |
"value" => format("%.2f", bonus).to_f | |
}, | |
"keyword2" => { | |
"value" => DateTime.parse(activity_bonus_record.created_at.iso8601).strftime('%Y年%m月%d日 %H:%M') | |
}, | |
"remark" => { | |
"value" => "万人团购节,感谢你的参与!" | |
} | |
} | |
} | |
wechat.template_message_send Wechat::Message.to(openid).template(template) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
您好