Skip to content

Commit

Permalink
Merge pull request #140 from daggerjames/master
Browse files Browse the repository at this point in the history
fix misleadings on sending template message, close #139
  • Loading branch information
Eric-Guo authored Aug 4, 2016
2 parents c944bae + 734f42b commit 541fa19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ production:
development:
<<: *default
trusted_domain_fullname: "http://your_dev.proxy.qqbrowser.cc"
test:
<<: *default
```
Expand Down Expand Up @@ -242,7 +242,7 @@ end

`wechat_oauth2`封装了OAuth2.0验证接口和cookie处理逻辑,用户仅需提供业务代码块即可。userid指的是微信企业成员UserID,openid是关注该公众号的用户openid。

注意:
注意:
* 如果使用 `wechat_responder`, 请不要在 Controller 里定义 `show``create` 方法, 否则会报错。
* 如果遇到“redirect_uri参数错误”的错误信息,请登录服务号管理后台,查看“开发者中心/网页服务/网页授权获取用户基本信息”的授权回调页面域名已正确配置。

Expand Down Expand Up @@ -497,15 +497,15 @@ $ wechat template_message oCfEht9oM*********** template.yml
在代码中可以这样使用:

```ruby
template = YAML.load(File.read(template_yaml_path)).symbolize_keys
Wechat.api.template_message_send Wechat::Message.to(openid).template(template)
template = YAML.load(File.read(template_yaml_path))
Wechat.api.template_message_send Wechat::Message.to(openid).template(template['template'])
```

若在Controller中使用wechat_api或者wechat_responder,可以使用wechat:

```ruby
template = YAML.load(File.read(template_yaml_path)).symbolize_keys
wechat.template_message_send Wechat::Message.to(openid).template(template)
template = YAML.load(File.read(template_yaml_path))
wechat.template_message_send Wechat::Message.to(openid).template(template['template'])
```

## wechat_api - Rails Controller Wechat API
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Wechat provides OAuth2.0 authentication method `wechat_oauth2`, possibly the eas

There is official [weui](https://github.com/weui/weui), which corresponding Rails gems called [weui-rails](https://github.com/Eric-Guo/weui-rails) available, if you prefer following the same UI design as wechat.

For web page only wechat application, please use [`wechat_api`](#wechat_api---rails-controller-wechat-api), which only contains web feature compare with traditional message type [`wechat_responder`](#wechat_responder---rails-responder-controller-dsl).
For web page only wechat application, please use [`wechat_api`](#wechat_api---rails-controller-wechat-api), which only contains web feature compare with traditional message type [`wechat_responder`](#wechat_responder---rails-responder-controller-dsl).

There is a more complete [wechat-starter](https://github.com/goofansu/wechat-starter) demo available, even include the payment SDK feature.

Expand Down Expand Up @@ -156,7 +156,7 @@ default: &default
token: ""
encoding_aes_key: ""
jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket"
production:
corpid: <%= ENV['WECHAT_CORPID'] %>
corpsecret: <%= ENV['WECHAT_CORPSECRET'] %>
Expand Down Expand Up @@ -255,7 +255,7 @@ end

`wechat_oauth2` already implement the necessory OAuth2.0 and cookie logic. userid defined as the enterprise member UserID. openid defined as the user who following the public account, also notice openid will be different for the same user for different following public account.

Notice:
Notice:
* If you use `wechat_responder` in your controller, you cannot use `create` and `show` action in your controller, otherwise will throw errors.
* If you get *redirect_uri parameter error* message, make sure you set the correct callback site url value in wechat management console with path *Development center / Webpage service / Webpage authorization for retrieving user basic informaiton*.

Expand Down Expand Up @@ -512,15 +512,15 @@ $ wechat template_message oCfEht9oM*********** template.yml
In code:

```ruby
template = YAML.load(File.read(template_yaml_path)).symbolize_keys
Wechat.api.template_message_send Wechat::Message.to(openid).template(template)
template = YAML.load(File.read(template_yaml_path))
Wechat.api.template_message_send Wechat::Message.to(openid).template(template["template"])
```

If using wechat_api or wechat_responder in Controller, can alse use wechat as shortcut(Support multi account):

```ruby
template = YAML.load(File.read(template_yaml_path)).symbolize_keys
wechat.template_message_send Wechat::Message.to(openid).template(template)
template = YAML.load(File.read(template_yaml_path))
wechat.template_message_send Wechat::Message.to(openid).template(template["template"])
```

## wechat_api - Rails Controller Wechat API
Expand Down

0 comments on commit 541fa19

Please sign in to comment.