mini_program 0.5.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23bafb601ea050095760002789ef3590e6df2981679d355df662768624552cdd
4
- data.tar.gz: 6acbe223672e48396c6676c204287af957b8334e9156717234a426196ff4ba49
3
+ metadata.gz: be168c3a7438d2eb89f4beadc547c0ff5390f2d4cc85c36d66c34f354c49c190
4
+ data.tar.gz: 2cfc79f6ce983974259d1e85229e9f03e5fc80075572da43d371a4ab61265533
5
5
  SHA512:
6
- metadata.gz: 3788d52cb3693b88d1ef9ac20b225a22586ad9f9afdea9458f6e6aafd9cec1b3941537cf1058043397b7145c71fa9c8e044065f96a5c24325212ab58cd9e55da
7
- data.tar.gz: d96736dec9872c2ce506299dec7074c9a8d7a96ac939a4aa9ee6804b25f0fdb76021fb210ea2dbf9b6b00206993fba8b2fce205b2f70fc1ff3d31dd5a9ebb768
6
+ metadata.gz: a66491684eb6ffd39a10bb229e98efa45fcb570a0e990b8f19d54088198468c4c5210002ce4b1a14a3f40c6d4188e8eadf3f1842202983cb70209f76269cafb7
7
+ data.tar.gz: ffb2187403073cfbc4c54a65ce23498e25f223fbab1718658f1733d757d8a351ed32838ddab662b47b562d2200242e13fef6e540520ea13ef0952cadf2e4f21b
@@ -52,13 +52,13 @@ module MiniProgram
52
52
 
53
53
  result = JSON.parse(response)
54
54
 
55
- if result["errcode"].present?
55
+ if result["errcode"] && result["errcode"].to_s != "0"
56
56
  logger.error <<~ERROR
57
57
  Get access token failed.
58
58
  api: #{api}
59
59
  error: #{result}
60
60
  ERROR
61
- return MiniProgram::ServiceResult.new(success: false, data: result, message: result["errmsg"])
61
+ return MiniProgram::ServiceResult.new(success: false, errors: result, message: result["errmsg"])
62
62
  end
63
63
 
64
64
  MiniProgram::ServiceResult.new(success: true, data: result)
@@ -80,7 +80,7 @@ module MiniProgram
80
80
 
81
81
  result = JSON.parse(response)
82
82
 
83
- if result["errcode"]
83
+ if result["errcode"].to_s != "0"
84
84
  logger.error <<~ERROR
85
85
  Get session key failed.
86
86
  api: #{api}
@@ -92,10 +92,6 @@ module MiniProgram
92
92
  MiniProgram::ServiceResult.new(success: true, data: result)
93
93
  end
94
94
 
95
- def mini_program_login
96
-
97
- end
98
-
99
95
  # 发送订阅消息
100
96
  # @param [MiniProgram::Msg] msg
101
97
  # @param [String] to 用户的open id
@@ -113,6 +109,11 @@ module MiniProgram
113
109
  api = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=#{get_token_result["access_token"]}"
114
110
  result = post(api, payload)
115
111
 
112
+ if result["errcode"].to_s != "0"
113
+ msg_logger.error {"{params: #{payload}, response: #{result}}"}
114
+ return MiniProgram::ServiceResult.new(success: false, errors: result["errmsg"])
115
+ end
116
+
116
117
  msg_logger.info {"{params: #{payload}, response: #{result}}"}
117
118
  MiniProgram::ServiceResult.new(success: true, data: result)
118
119
  end
@@ -137,6 +138,11 @@ module MiniProgram
137
138
  mp_template_msg: payload
138
139
  })
139
140
 
141
+ if result["errcode"].to_s != "0"
142
+ msg_logger.error {"{params: #{payload}, response: #{result}}"}
143
+ return MiniProgram::ServiceResult.new(success: false, errors: result["errmsg"])
144
+ end
145
+
140
146
  msg_logger.info { "{params: #{payload}, response: #{result}}"}
141
147
  MiniProgram::ServiceResult.new(success: true, data: result)
142
148
  end
@@ -1,3 +1,3 @@
1
1
  module MiniProgram
2
- VERSION = '0.5.0'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_program
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ian