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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f29f909c20410c0a61f11dfc44df76554a68386
4
- data.tar.gz: 44a3539640613c1c2281f49d1ccf2c88c5a0cc41
3
+ metadata.gz: ec075d14a655462edbc8bc024cf472a7bf13fbd8
4
+ data.tar.gz: e50d4adb4a858532fe4705161816b282e3030334
5
5
  SHA512:
6
- metadata.gz: 088e1eaaf3b8ad4e61894ec96f18b8c9e8f1c38527a6d9893cff879f429690ba8726d24fe7a14c97c68c3d6264ab37ad355b3a4bb502ee8ae01a6e3d4e5bf531
7
- data.tar.gz: 29c4be8c6cbe0edeff83c45892a82523dbd21ba27b7848137e355194773dd007f739129bf5383ad5663f6da725a7b65502025eabf080049ba89636da58a3836c
6
+ metadata.gz: 49d3719a1a0d3ea9b133c7831660249fe3b58fe53019f0d7e541b921dfc0126c8e108bbd9e6d22c2df3fc01875e35ef0761b8c1e59e80e8c965290eadd4ce512
7
+ data.tar.gz: 51328ca0e18e5d7afdf5739e44ff21259302c3e9d782084f3c82df0adfe64405beff44867d233451df7d8fa983a2e5323906f5e2dd45f111c2138b2921ffc153
data/.gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  *.gem
2
2
  *.rbc
3
3
  .bundle
4
- .ideal/
4
+ .idea/*
5
5
  .config
6
6
  .yardoc
7
7
  Gemfile.lock
data/lib/eric_weixin.rb CHANGED
@@ -11,12 +11,13 @@ require File.dirname(__FILE__) + '/eric_weixin/app/model/reply_message_rule.rb'
11
11
  require File.dirname(__FILE__) + '/eric_weixin/app/model/template_message_log.rb'
12
12
  require File.dirname(__FILE__) + '/eric_weixin/app/model/weixin_user.rb'
13
13
  require File.dirname(__FILE__) + '/eric_weixin/app/model/message_log.rb'
14
+ require File.dirname(__FILE__) + '/eric_weixin/app/model/two_dimension_code.rb'
14
15
 
15
16
  #加载moudle
16
17
  require File.dirname(__FILE__) + '/eric_weixin/app/moudles/reply_message.rb'
17
18
  require File.dirname(__FILE__) + '/eric_weixin/app/moudles/mult_customer.rb'
18
19
  require File.dirname(__FILE__) + '/eric_weixin/app/moudles/snsapi.rb'
19
- require File.dirname(__FILE__) + '/eric_weixin/app/moudles/two_dimension_code.rb'
20
+
20
21
 
21
22
  #加载controller
22
23
  require File.dirname(__FILE__) + '/eric_weixin/app/controllers/weixin/weixin_controller'
@@ -8,13 +8,11 @@ module EricWeixin
8
8
 
9
9
  def reply
10
10
  request_body = request.body.read
11
- weixin_secret_key = ::EricWeixin::PublicAccount.get_secret params[:app_id]
12
-
11
+ public_account = ::EricWeixin::PublicAccount.find_by_weixin_app_id params[:app_id]
13
12
  "message from wechat: ".to_logger
14
13
  request_body.to_logger
15
14
  weixin_message = MultiXml.parse(request_body).deep_symbolize_keys[:xml]
16
-
17
- message = ::EricWeixin::ReplyMessageRule.process_rule(weixin_message, weixin_secret_key)
15
+ message = ::EricWeixin::ReplyMessageRule.process_rule(weixin_message, public_account)
18
16
  render xml: message
19
17
  end
20
18
 
@@ -47,17 +45,16 @@ module EricWeixin
47
45
  return
48
46
  end
49
47
 
50
- pp '111111'
48
+
51
49
  response = RestClient.get "https://api.weixin.qq.com/sns/oauth2/access_token?appid=#{weixin_public_account.weixin_app_id}&secret=#{weixin_public_account.weixin_secret_key}&code=#{params[:code]}&grant_type=authorization_code"
52
50
  result_hash = JSON.parse(response.body)
53
-
54
51
  query_array << ["openid", result_hash['openid']]
55
52
  query_array << ["access_token", result_hash['access_token']]
56
53
  query_array << ["expires_in", result_hash['expires_in']]
57
54
  query_array << ['refresh_token', result_hash['refresh_token']]
58
55
  query_array << ['scope', result_hash['scope']]
59
56
  query_array << ['agree', 'yes']
60
- pp '3333333'
57
+
61
58
  response = RestClient.get "https://api.weixin.qq.com/sns/userinfo?access_token=#{result_hash['access_token']}&openid=#{result_hash['openid']}&lang=zh_CN"
62
59
  user_info_hash = JSON.parse(response.body)
63
60
  query_array << ["nickname", user_info_hash['nickname']]
@@ -1,31 +1,32 @@
1
1
  module EricWeixin
2
2
  class AccessToken < ActiveRecord::Base
3
3
 
4
+ belongs_to :public_account, :class_name => '::EricWeixin::PublicAccount', foreign_key: :experience_center_id
5
+
4
6
  self.table_name = "weixin_access_tokens"
5
7
 
6
8
  def self.get_valid_access_token_by_app_id options
7
- secret_key = ::EricWeixin::PublicAccount.get_secret options[:app_id]
8
- ::EricWeixin::AccessToken.get_valid_access_token weixin_secret_key: secret_key
9
+ pa = ::EricWeixin::PublicAccount.find_by_weixin_app_id options[:app_id]
10
+ ::EricWeixin::AccessToken.get_valid_access_token public_account_id: pa.id
9
11
  end
10
12
 
11
13
 
12
- # 获取有效的Token
13
- # 参数为: weixin_secret_key
14
- # ::EricWeixin::AccessToken.get_valid_access_token weixin_secret_key: 'bba7ba32bf3e1a60edd8bd8903ce33e5'
14
+ # 获取有效的Token
15
+ # 参数为: public_account_id
16
+ # ::EricWeixin::AccessToken.get_valid_access_token public_account_id: 1
15
17
  def self.get_valid_access_token options
16
18
  ::EricWeixin::AccessToken.transaction do
17
- access_token = ::EricWeixin::AccessToken.where(weixin_secret_key: options[:weixin_secret_key]).first
19
+ access_token = ::EricWeixin::AccessToken.find_by_public_account_id options[:public_account_id]
18
20
  if access_token.blank?
19
- public_account = ::EricWeixin::PublicAccount.find_by_weixin_secret_key(options[:weixin_secret_key]).first
20
- access_token = ::EricWeixin::AccessToken.new :weixin_secret_key => options[:weixin_secret_key],
21
- :access_token => get_new_token(options[:weixin_secret_key]),
22
- :expired_at => Time.now.to_i + 2*60*60,
23
- :public_account_id => public_account.id
21
+ public_account = ::EricWeixin::PublicAccount.find_by_id options[:public_account_id]
22
+ access_token = ::EricWeixin::AccessToken.new :access_token => get_new_token(options[:public_account_id]),
23
+ :expired_at => Time.now.to_i + 2*60*60,
24
+ :public_account_id => public_account.id
24
25
  access_token.save!
25
26
  end
26
27
 
27
28
  if Time.now.to_i > (access_token.expired_at.to_i - 30)
28
- access_token.access_token = get_new_token(options[:weixin_secret_key])
29
+ access_token.access_token = get_new_token(options[:public_account_id])
29
30
  access_token.expired_at = Time.now.to_i + 2*60*60
30
31
  access_token.save!
31
32
  end
@@ -35,12 +36,14 @@ module EricWeixin
35
36
  end
36
37
 
37
38
 
38
- private
39
- #::EricWeixin::AccessToken.get_new_token 'bba7ba32bf3e1a60edd8bd8903ce33e5'
40
- def self.get_new_token secret_key
41
- account = ::EricWeixin::PublicAccount.where(:weixin_secret_key => secret_key).first
39
+ #::EricWeixin::AccessToken.get_new_token '5e3b98ca0000959946657212739fd535'
40
+ def self.get_new_token public_account_id
41
+ account = ::EricWeixin::PublicAccount.find_by_id public_account_id
42
42
  BusinessException.raise 'account 不存在' if account.blank?
43
- response = RestClient.get "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=#{account.weixin_app_id}&secret=#{account.weixin_secret_key}"
43
+ url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=#{account.weixin_app_id}&secret=#{account.weixin_secret_key}"
44
+ response = RestClient.get url
45
+ pp '.........'
46
+ pp response
44
47
  JSON.parse(response)["access_token"]
45
48
  end
46
49
  end
@@ -3,20 +3,20 @@ class EricWeixin::MessageLog < ActiveRecord::Base
3
3
  class << self
4
4
 
5
5
  def create_public_account_receive_message_log options
6
- options = options.select{|k,v| [:openid, :app_id, :message_type, :message_id, :data, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
6
+ options = options.select{|k,v| [:openid,:event_key, :weixin_public_account_id, :message_type, :message_id, :data, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
7
7
  options[:account_receive_flg] = 0
8
8
  self.create_message_log options
9
9
  end
10
10
 
11
11
  def create_public_account_send_message_log options
12
- options = options.select{|k,v| [:openid, :app_id, :message_type, :message_id, :data, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
12
+ options = options.select{|k,v| [:openid, :event_key,:weixin_public_account_id, :message_type, :message_id, :data, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
13
13
  options[:account_receive_flg] = 1
14
14
  self.create_message_log options
15
15
  end
16
16
 
17
17
  def create_message_log options
18
18
  EricWeixin::MessageLog.transaction do
19
- log = EricWeixin::MessageLog.new options.select{|k,v| [:openid, :app_id, :message_type, :message_id, :data, :account_receive_flg, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
19
+ log = EricWeixin::MessageLog.new options.select{|k,v| [:openid,:event_key, :weixin_public_account_id, :message_type, :message_id, :data, :account_receive_flg, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
20
20
  log.save!
21
21
  log
22
22
  end
@@ -1,185 +1,186 @@
1
- module EricWeixin
2
- class PublicAccount < ActiveRecord::Base
3
- require "rest-client"
4
- self.table_name = "weixin_public_accounts"
5
- has_many :weixin_users, :class_name => 'WeixinUser', foreign_key: "weixin_public_account_id"
1
+ class EricWeixin::PublicAccount < ActiveRecord::Base
2
+ require "rest-client"
3
+ self.table_name = "weixin_public_accounts"
4
+ has_many :weixin_users, :class_name => '::EricWeixin::WeixinUser', foreign_key: "weixin_public_account_id"
5
+ has_many :two_dimension_codes, :class_name => '::EricWeixin::TwoDimensionCode', foreign_key: "weixin_public_account_id"
6
+ has_one :access_token, :class_name => '::EricWeixin::AccessToken', foreign_key: "public_account_id"
6
7
 
8
+ #
9
+ # def self.get_secret app_id
10
+ # account = ::EricWeixin::PublicAccount.where(weixin_app_id: app_id).first
11
+ # account.weixin_secret_key
12
+ # end
7
13
 
8
- def self.get_secret app_id
9
- account = ::EricWeixin::PublicAccount.where(weixin_app_id: app_id).first
10
- account.weixin_secret_key
11
- end
14
+ #::EricWeixin::PublicAccount.first.get_user_data_from_weixin_api 'osyUtswoeJ9d7p16RdpC5grOeukQ'
15
+ #返回Hash信息
16
+ def get_user_data_from_weixin_api openid
17
+ token = ::EricWeixin::AccessToken.get_valid_access_token public_account_id: self.id
18
+ response = RestClient.get "https://api.weixin.qq.com/cgi-bin/user/info?access_token=#{token}&openid=#{openid}&lang=zh_CN"
19
+ response = JSON.parse response.body
20
+ response["nickname"] = CGI::escape(response["nickname"]) if not response["nickname"].blank?
21
+ response
22
+ end
12
23
 
13
- #::EricWeixin::PublicAccount.first.get_user_data_from_weixin_api 'osyUtswoeJ9d7p16RdpC5grOeukQ'
14
- #返回Hash信息
15
- def get_user_data_from_weixin_api openid
16
- token = ::EricWeixin::AccessToken.get_valid_access_token weixin_secret_key: self.weixin_secret_key
17
- response = RestClient.get "https://api.weixin.qq.com/cgi-bin/user/info?access_token=#{token}&openid=#{openid}&lang=zh_CN"
18
- response = JSON.parse response.body
19
- response["nickname"] = CGI::escape(response["nickname"]) if not response["nickname"].blank?
20
- response
21
- end
24
+ #::EricWeixin::PublicAccount.first.weixin_menus
25
+ def weixin_menus
26
+ token = ::EricWeixin::AccessToken.get_valid_access_token public_account_id: self.id
27
+ response = RestClient.get "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=#{token}"
28
+ response = JSON.parse response.body
29
+ response['menu']
30
+ end
22
31
 
23
- #::EricWeixin::PublicAccount.first.weixin_menus
24
- def weixin_menus
25
- token = ::EricWeixin::AccessToken.get_valid_access_token weixin_secret_key: self.weixin_secret_key
26
- response = RestClient.get "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=#{token}"
32
+ #
33
+ # ::EricWeixin::PublicAccount.first.create_menu '{
34
+ # "button":[
35
+ # {
36
+ # "name":"俱乐部2",
37
+ # "sub_button":[
38
+ #
39
+ # {
40
+ # "type":"click",
41
+ # "name":"节目介绍",
42
+ # "key":"V1001_PROGRAMME_INTRODUCTION"
43
+ # }]
44
+ # },
45
+ # {
46
+ # "type":"view",
47
+ # "name":"创意社区",
48
+ # "url":"http://m.wsq.qq.com/264164362"
49
+ # },
50
+ # {
51
+ # "name":"辣妈奶爸", 13818518038 余老师
52
+ # "sub_button":[
53
+ # {
54
+ # "type":"click",
55
+ # "name":"百家言",
56
+ # "key":"V1001_BAIJIAYAN"
57
+ # },
58
+ # {
59
+ # "type":"view",
60
+ # "name":"辣妈养成记",
61
+ # "url":"http://m.wsq.qq.com/264164362/t/32"
62
+ # },
63
+ # {
64
+ # "type":"view",
65
+ # "name":"奶爸集中营4",
66
+ # "url":"http://m.wsq.qq.com/264164362/t/35"
67
+ # }]
68
+ # }]
69
+ # }'
70
+ def create_menu menu_json
71
+ ::EricWeixin::PublicAccount.transaction do
72
+ self.menu_json = menu_json
73
+ self.save!
74
+ token = ::EricWeixin::AccessToken.get_valid_access_token public_account_id: self.id
75
+ response = RestClient.post "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=#{token}", menu_json
27
76
  response = JSON.parse response.body
28
- response['menu']
29
- end
30
- #
31
- # ::EricWeixin::PublicAccount.first.create_menu '{
32
- # "button":[
33
- # {
34
- # "name":"俱乐部2",
35
- # "sub_button":[
36
- #
37
- # {
38
- # "type":"click",
39
- # "name":"节目介绍",
40
- # "key":"V1001_PROGRAMME_INTRODUCTION"
41
- # }]
42
- # },
43
- # {
44
- # "type":"view",
45
- # "name":"创意社区",
46
- # "url":"http://m.wsq.qq.com/264164362"
47
- # },
48
- # {
49
- # "name":"辣妈奶爸", 13818518038 余老师
50
- # "sub_button":[
51
- # {
52
- # "type":"click",
53
- # "name":"百家言",
54
- # "key":"V1001_BAIJIAYAN"
55
- # },
56
- # {
57
- # "type":"view",
58
- # "name":"辣妈养成记",
59
- # "url":"http://m.wsq.qq.com/264164362/t/32"
60
- # },
61
- # {
62
- # "type":"view",
63
- # "name":"奶爸集中营4",
64
- # "url":"http://m.wsq.qq.com/264164362/t/35"
65
- # }]
66
- # }]
67
- # }'
68
- def create_menu menu_json
69
- ::EricWeixin::PublicAccount.transaction do
70
- self.menu_json = menu_json
71
- self.save!
72
- token = ::EricWeixin::AccessToken.get_valid_access_token weixin_secret_key: self.weixin_secret_key
73
- response = RestClient.post "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=#{token}", menu_json
74
- response = JSON.parse response.body
75
- BusinessException.raise response["errmsg"] if response["errcode"].to_i!=0
76
- pp response
77
- return 0
78
- end
77
+ BusinessException.raise response["errmsg"] if response["errcode"].to_i!=0
78
+ pp response
79
+ return 0
79
80
  end
81
+ end
80
82
 
81
- # ::EricWeixin::PublicAccount.first.rebuild_users
82
- def rebuild_users next_openid = nil
83
- token = ::EricWeixin::AccessToken.get_valid_access_token weixin_secret_key: self.weixin_secret_key
84
- response = if next_openid.blank?
85
- RestClient.get "https://api.weixin.qq.com/cgi-bin/user/get?access_token=#{token}"
86
- else
87
- RestClient.get "https://api.weixin.qq.com/cgi-bin/user/get?access_token=#{token}&next_openid=#{next_openid}"
88
- end
89
- response = JSON.parse response.body
90
- if response["count"].to_i > 0
91
- response["data"]["openid"].each do |openid|
92
- ::EricWeixin::WeixinUser.create_weixin_user self.weixin_secret_key, openid
93
- end
94
- tmp_next_openid = response["next_openid"]
95
- self.rebuild_users tmp_next_openid unless tmp_next_openid.blank?
83
+ # ::EricWeixin::PublicAccount.first.rebuild_users
84
+ def rebuild_users next_openid = nil
85
+ token = ::EricWeixin::AccessToken.get_valid_access_token public_account_id: self.id
86
+ response = if next_openid.blank?
87
+ RestClient.get "https://api.weixin.qq.com/cgi-bin/user/get?access_token=#{token}"
88
+ else
89
+ RestClient.get "https://api.weixin.qq.com/cgi-bin/user/get?access_token=#{token}&next_openid=#{next_openid}"
90
+ end
91
+ response = JSON.parse response.body
92
+ if response["count"].to_i > 0
93
+ response["data"]["openid"].each do |openid|
94
+ ::EricWeixin::WeixinUser.create_weixin_user self.id, openid
96
95
  end
96
+ tmp_next_openid = response["next_openid"]
97
+ self.rebuild_users tmp_next_openid unless tmp_next_openid.blank?
97
98
  end
99
+ end
98
100
 
99
101
 
100
- GLOBAL_CODES = {
101
- -1 => "系统繁忙",
102
- 0 => "请求成功",
103
- 40001 => "获取access_token时AppSecret错误,或者access_token无效",
104
- 40002 => "不合法的凭证类型",
105
- 40003 => "不合法的OpenID",
106
- 40004 => "不合法的媒体文件类型",
107
- 40005 => "不合法的文件类型",
108
- 40006 => "不合法的文件大小",
109
- 40007 => "不合法的媒体文件id",
110
- 40008 => "不合法的消息类型",
111
- 40009 => "不合法的图片文件大小",
112
- 40010 => "不合法的语音文件大小",
113
- 40011 => "不合法的视频文件大小",
114
- 40012 => "不合法的缩略图文件大小",
115
- 40013 => "不合法的APPID",
116
- 40014 => "不合法的access_token",
117
- 40015 => "不合法的菜单类型",
118
- 40016 => "不合法的按钮个数",
119
- 40017 => "不合法的按钮个数",
120
- 40018 => "不合法的按钮名字长度",
121
- 40019 => "不合法的按钮KEY长度",
122
- 40020 => "不合法的按钮URL长度",
123
- 40021 => "不合法的菜单版本号",
124
- 40022 => "不合法的子菜单级数",
125
- 40023 => "不合法的子菜单按钮个数",
126
- 40024 => "不合法的子菜单按钮类型",
127
- 40025 => "不合法的子菜单按钮名字长度",
128
- 40026 => "不合法的子菜单按钮KEY长度",
129
- 40027 => "不合法的子菜单按钮URL长度",
130
- 40028 => "不合法的自定义菜单使用用户",
131
- 40029 => "不合法的oauth_code",
132
- 40030 => "不合法的refresh_token",
133
- 40031 => "不合法的openid列表",
134
- 40032 => "不合法的openid列表长度",
135
- 40033 => "不合法的请求字符,不能包含xxxx格式的字符",
136
- 40035 => "不合法的参数",
137
- 40038 => "不合法的请求格式",
138
- 40039 => "不合法的URL长度",
139
- 40050 => "不合法的分组id",
140
- 40051 => "分组名字不合法",
141
- 41001 => "缺少access_token参数",
142
- 41002 => "缺少appid参数",
143
- 41003 => "缺少refresh_token参数",
144
- 41004 => "缺少secret参数",
145
- 41005 => "缺少多媒体文件数据",
146
- 41006 => "缺少media_id参数",
147
- 41007 => "缺少子菜单数据",
148
- 41008 => "缺少oauth code",
149
- 41009 => "缺少openid",
150
- 42001 => "access_token超时",
151
- 42002 => "refresh_token超时",
152
- 42003 => "oauth_code超时",
153
- 43001 => "需要GET请求",
154
- 43002 => "需要POST请求",
155
- 43003 => "需要HTTPS请求",
156
- 43004 => "需要接收者关注",
157
- 43005 => "需要好友关系",
158
- 44001 => "多媒体文件为空",
159
- 44002 => "POST的数据包为空",
160
- 44003 => "图文消息内容为空",
161
- 44004 => "文本消息内容为空",
162
- 45001 => "多媒体文件大小超过限制",
163
- 45002 => "消息内容超过限制",
164
- 45003 => "标题字段超过限制",
165
- 45004 => "描述字段超过限制",
166
- 45005 => "链接字段超过限制",
167
- 45006 => "图片链接字段超过限制",
168
- 45007 => "语音播放时间超过限制",
169
- 45008 => "图文消息超过限制",
170
- 45009 => "接口调用超过限制",
171
- 45010 => "创建菜单个数超过限制",
172
- 45015 => "回复时间超过限制",
173
- 45016 => "系统分组,不允许修改",
174
- 45017 => "分组名字过长",
175
- 45018 => "分组数量超过上限",
176
- 46001 => "不存在媒体数据",
177
- 46002 => "不存在的菜单版本",
178
- 46003 => "不存在的菜单数据",
179
- 46004 => "不存在的用户",
180
- 47001 => "解析JSON/XML内容错误",
181
- 48001 => "api功能未授权",
182
- 50001 => "用户未授权该api"
183
- }
184
- end
185
- end
102
+ GLOBAL_CODES = {
103
+ -1 => "系统繁忙",
104
+ 0 => "请求成功",
105
+ 40001 => "获取access_token时AppSecret错误,或者access_token无效",
106
+ 40002 => "不合法的凭证类型",
107
+ 40003 => "不合法的OpenID",
108
+ 40004 => "不合法的媒体文件类型",
109
+ 40005 => "不合法的文件类型",
110
+ 40006 => "不合法的文件大小",
111
+ 40007 => "不合法的媒体文件id",
112
+ 40008 => "不合法的消息类型",
113
+ 40009 => "不合法的图片文件大小",
114
+ 40010 => "不合法的语音文件大小",
115
+ 40011 => "不合法的视频文件大小",
116
+ 40012 => "不合法的缩略图文件大小",
117
+ 40013 => "不合法的APPID",
118
+ 40014 => "不合法的access_token",
119
+ 40015 => "不合法的菜单类型",
120
+ 40016 => "不合法的按钮个数",
121
+ 40017 => "不合法的按钮个数",
122
+ 40018 => "不合法的按钮名字长度",
123
+ 40019 => "不合法的按钮KEY长度",
124
+ 40020 => "不合法的按钮URL长度",
125
+ 40021 => "不合法的菜单版本号",
126
+ 40022 => "不合法的子菜单级数",
127
+ 40023 => "不合法的子菜单按钮个数",
128
+ 40024 => "不合法的子菜单按钮类型",
129
+ 40025 => "不合法的子菜单按钮名字长度",
130
+ 40026 => "不合法的子菜单按钮KEY长度",
131
+ 40027 => "不合法的子菜单按钮URL长度",
132
+ 40028 => "不合法的自定义菜单使用用户",
133
+ 40029 => "不合法的oauth_code",
134
+ 40030 => "不合法的refresh_token",
135
+ 40031 => "不合法的openid列表",
136
+ 40032 => "不合法的openid列表长度",
137
+ 40033 => "不合法的请求字符,不能包含xxxx格式的字符",
138
+ 40035 => "不合法的参数",
139
+ 40038 => "不合法的请求格式",
140
+ 40039 => "不合法的URL长度",
141
+ 40050 => "不合法的分组id",
142
+ 40051 => "分组名字不合法",
143
+ 41001 => "缺少access_token参数",
144
+ 41002 => "缺少appid参数",
145
+ 41003 => "缺少refresh_token参数",
146
+ 41004 => "缺少secret参数",
147
+ 41005 => "缺少多媒体文件数据",
148
+ 41006 => "缺少media_id参数",
149
+ 41007 => "缺少子菜单数据",
150
+ 41008 => "缺少oauth code",
151
+ 41009 => "缺少openid",
152
+ 42001 => "access_token超时",
153
+ 42002 => "refresh_token超时",
154
+ 42003 => "oauth_code超时",
155
+ 43001 => "需要GET请求",
156
+ 43002 => "需要POST请求",
157
+ 43003 => "需要HTTPS请求",
158
+ 43004 => "需要接收者关注",
159
+ 43005 => "需要好友关系",
160
+ 44001 => "多媒体文件为空",
161
+ 44002 => "POST的数据包为空",
162
+ 44003 => "图文消息内容为空",
163
+ 44004 => "文本消息内容为空",
164
+ 45001 => "多媒体文件大小超过限制",
165
+ 45002 => "消息内容超过限制",
166
+ 45003 => "标题字段超过限制",
167
+ 45004 => "描述字段超过限制",
168
+ 45005 => "链接字段超过限制",
169
+ 45006 => "图片链接字段超过限制",
170
+ 45007 => "语音播放时间超过限制",
171
+ 45008 => "图文消息超过限制",
172
+ 45009 => "接口调用超过限制",
173
+ 45010 => "创建菜单个数超过限制",
174
+ 45015 => "回复时间超过限制",
175
+ 45016 => "系统分组,不允许修改",
176
+ 45017 => "分组名字过长",
177
+ 45018 => "分组数量超过上限",
178
+ 46001 => "不存在媒体数据",
179
+ 46002 => "不存在的菜单版本",
180
+ 46003 => "不存在的菜单数据",
181
+ 46004 => "不存在的用户",
182
+ 47001 => "解析JSON/XML内容错误",
183
+ 48001 => "api功能未授权",
184
+ 50001 => "用户未授权该api"
185
+ }
186
+ end