|
|
|
@ -285,7 +285,35 @@ class WechatService
|
|
|
|
|
def create_class_notice(user_id, type, id, first, key1, key2, key3, remark="")
|
|
|
|
|
uw = UserWechat.where(user_id: user_id).first
|
|
|
|
|
unless uw.nil?
|
|
|
|
|
data = three_keys_template uw.openid,Wechat.config.create_class_notice, type, id, first, key1, key2, key3, remark
|
|
|
|
|
data = {
|
|
|
|
|
touser:uw.openid,
|
|
|
|
|
template_id:Wechat.config.create_class_notice,
|
|
|
|
|
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/class?id="+id.to_s,
|
|
|
|
|
topcolor:"#FF0000",
|
|
|
|
|
data:{
|
|
|
|
|
first: {
|
|
|
|
|
value:first,
|
|
|
|
|
color:"#707070"
|
|
|
|
|
},
|
|
|
|
|
keyword1:{
|
|
|
|
|
value:key1,
|
|
|
|
|
color:"#707070"
|
|
|
|
|
},
|
|
|
|
|
keyword2:{
|
|
|
|
|
value:key2,
|
|
|
|
|
color:"#707070"
|
|
|
|
|
},
|
|
|
|
|
keyword2:{
|
|
|
|
|
value:key3,
|
|
|
|
|
color:"#707070"
|
|
|
|
|
},
|
|
|
|
|
remark:{
|
|
|
|
|
value:remark,
|
|
|
|
|
color:"#707070"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#data = three_keys_template uw.openid,Wechat.config.create_class_notice, type, id, first, key1, key2, key3, remark
|
|
|
|
|
begin
|
|
|
|
|
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
|
|
|
|
|
rescue Exception => e
|
|
|
|
|