微信模板消息的颜色、去掉模板消息的最后一行

This commit is contained in:
cxt 2016-04-25 11:12:34 +08:00
parent 8f62cccfd6
commit 9a6ea9757d
2 changed files with 15 additions and 15 deletions

View File

@ -1 +1 @@
{"access_token":"x7GUTe-MLoVPMzId82-3VSdCsO6sq5cOJZCmIN-yUjDcohfI00t2lzPkNKdRhETLUBptZRQ--v-IBQTG-o5iRZZv-EelOBX7K96DcPMFt9rdzwNu7XerNnZw_ncGYncSLHXeACAQMC","expires_in":7200,"got_token_at":1461133885} {"access_token":"03kBJXYaoncSoMkMC_GyNNhKmx6rzK3DbzN0_VxgOJO9_Xtp2F5pSYw0X2HdTWg5sUf0zw3oY1O8ZPVF3TbLGwYP5-kj9AlpS4F2fqEY03BE95y5hPRlVv3g_VegHP25VINhAJAIVA","expires_in":7200,"got_token_at":1461306222}

View File

@ -1,7 +1,7 @@
#encoding: utf-8 #encoding: utf-8
class WechatService class WechatService
def template_data(openid, template_id, type, id, first, key1, key2, key3, remark="具体内容请点击详情查看网站") def template_data(openid, template_id, type, id, first, key1, key2, key3, remark="")
data = { data = {
touser:openid, touser:openid,
template_id:template_id, template_id:template_id,
@ -10,30 +10,30 @@ class WechatService
data:{ data:{
first: { first: {
value:first, value:first,
color:"#173177" color:"#CCCCCC"
}, },
keyword1:{ keyword1:{
value:key1, value:key1,
color:"#173177" color:"#CCCCCC"
}, },
keyword2:{ keyword2:{
value:key2, value:key2,
color:"#173177" color:"#CCCCCC"
}, },
keyword3:{ keyword3:{
value:key3, value:key3,
color:"#173177" color:"#CCCCCC"
}, },
remark:{ remark:{
value:remark, value:remark,
color:"#173177" color:"#CCCCCC"
} }
} }
} }
data data
end end
def homework_template(user_id, type, id, first, key1, key2, key3, remark="具体内容请点击详情查看网站") def homework_template(user_id, type, id, first, key1, key2, key3, remark="")
uw = UserWechat.where(user_id: user_id).first uw = UserWechat.where(user_id: user_id).first
unless uw.nil? unless uw.nil?
data = template_data uw.openid,"3e5Dj2GIx8MOcMyRKpTUEQnM7Tg0ASSCNc01NS9HCGI", type, id, first, key1, key2, key3, remark data = template_data uw.openid,"3e5Dj2GIx8MOcMyRKpTUEQnM7Tg0ASSCNc01NS9HCGI", type, id, first, key1, key2, key3, remark
@ -47,7 +47,7 @@ class WechatService
Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect" Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
end end
def topic_publish_template(user_id, type, id, first, key1, key2, key3, remark="具体内容请点击详情查看网站") def topic_publish_template(user_id, type, id, first, key1, key2, key3, remark="")
uw = UserWechat.where(user_id: user_id).first uw = UserWechat.where(user_id: user_id).first
unless uw.nil? unless uw.nil?
data = template_data uw.openid,"oKzFCdk7bsIHnGbscA__N8LPQrBkUShvpjV3-kuwWDQ", type, id,first, key1, key2, key3, remark data = template_data uw.openid,"oKzFCdk7bsIHnGbscA__N8LPQrBkUShvpjV3-kuwWDQ", type, id,first, key1, key2, key3, remark
@ -62,7 +62,7 @@ class WechatService
Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect" Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
end end
def comment_template(user_id,type, id, first, key1, key2, key3, remark="具体内容请点击详情查看网站") def comment_template(user_id,type, id, first, key1, key2, key3, remark="")
uw = UserWechat.where(user_id: user_id).first uw = UserWechat.where(user_id: user_id).first
unless uw.nil? unless uw.nil?
data = template_data uw.openid,"A_3f5v90-zK73V9Kijm-paDkl9S-NuM8Cf-1UJi92_c",type, id,first, key1, key2, key3, remark data = template_data uw.openid,"A_3f5v90-zK73V9Kijm-paDkl9S-NuM8Cf-1UJi92_c",type, id,first, key1, key2, key3, remark
@ -77,7 +77,7 @@ class WechatService
Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect" Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect"
end end
def message_update_template(user_id, type, id, first, key1, key2, remark="具体内容请点击详情查看网站") def message_update_template(user_id, type, id, first, key1, key2, remark="")
uw = UserWechat.where(user_id: user_id).first uw = UserWechat.where(user_id: user_id).first
unless uw.nil? unless uw.nil?
data = { data = {
@ -88,19 +88,19 @@ class WechatService
data:{ data:{
first: { first: {
value:first, value:first,
color:"#173177" color:"#CCCCCC"
}, },
keyword1:{ keyword1:{
value:key1, value:key1,
color:"#173177" color:"#CCCCCC"
}, },
keyword2:{ keyword2:{
value:key2, value:key2,
color:"#173177" color:"#CCCCCC"
}, },
remark:{ remark:{
value:remark, value:remark,
color:"#173177" color:"#CCCCCC"
} }
} }
} }