eric_weixin 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/lib/eric_weixin.rb +2 -1
- data/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb +4 -7
- data/lib/eric_weixin/app/model/access_token.rb +20 -17
- data/lib/eric_weixin/app/model/message_log.rb +3 -3
- data/lib/eric_weixin/app/model/public_account.rb +175 -174
- data/lib/eric_weixin/app/model/reply_message_rule.rb +51 -31
- data/lib/eric_weixin/app/model/template_message_log.rb +12 -4
- data/lib/eric_weixin/app/model/two_dimension_code.rb +146 -0
- data/lib/eric_weixin/app/model/weixin_user.rb +13 -10
- data/lib/eric_weixin/app/moudles/mult_customer.rb +2 -2
- data/lib/eric_weixin/app/moudles/snsapi.rb +4 -4
- data/lib/eric_weixin/version.rb +1 -1
- metadata +3 -4
- data/.idea/workspace.xml +0 -935
- data/lib/eric_weixin/app/moudles/two_dimension_code.rb +0 -18
@@ -1,18 +0,0 @@
|
|
1
|
-
# 二维码
|
2
|
-
module EricWeixin::TwoDimensionCode
|
3
|
-
# 长URL转短URL
|
4
|
-
# ===参数说明:
|
5
|
-
# * app_id 微信公众账号的app_id
|
6
|
-
# * url 需要转短url的链接
|
7
|
-
# ===调用示例:
|
8
|
-
# EricWeixin::TwoDimensionCode.short_url app_id: 'wx4564afc37fac0ebf', url: 'http://mp.weixin.qq.com/wiki/10/165c9b15eddcfbd8699ac12b0bd89ae6.html'
|
9
|
-
def self.short_url options
|
10
|
-
access_token = EricWeixin::AccessToken.get_valid_access_token_by_app_id app_id: options[:app_id]
|
11
|
-
url = "https://api.weixin.qq.com/cgi-bin/shorturl?access_token=#{access_token}"
|
12
|
-
pp url
|
13
|
-
response = RestClient.post url, {action: "long2short", long_url: options[:url]}
|
14
|
-
response = JSON.parse(response.body)
|
15
|
-
pp response
|
16
|
-
response["short_url"]
|
17
|
-
end
|
18
|
-
end
|