mini_program 0.5.0 → 0.9.0
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/lib/mini_program/client.rb +13 -7
- data/lib/mini_program/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be168c3a7438d2eb89f4beadc547c0ff5390f2d4cc85c36d66c34f354c49c190
|
4
|
+
data.tar.gz: 2cfc79f6ce983974259d1e85229e9f03e5fc80075572da43d371a4ab61265533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a66491684eb6ffd39a10bb229e98efa45fcb570a0e990b8f19d54088198468c4c5210002ce4b1a14a3f40c6d4188e8eadf3f1842202983cb70209f76269cafb7
|
7
|
+
data.tar.gz: ffb2187403073cfbc4c54a65ce23498e25f223fbab1718658f1733d757d8a351ed32838ddab662b47b562d2200242e13fef6e540520ea13ef0952cadf2e4f21b
|
data/lib/mini_program/client.rb
CHANGED
@@ -52,13 +52,13 @@ module MiniProgram
|
|
52
52
|
|
53
53
|
result = JSON.parse(response)
|
54
54
|
|
55
|
-
if result["errcode"].
|
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,
|
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
|
data/lib/mini_program/version.rb
CHANGED