2
2
3
3
# require 'byebug'
4
4
5
+ require_relative './third_notifier_module'
5
6
require_relative './qiniu_uploader'
6
7
require_relative './ali_uploader'
7
8
require_relative '../util/feishu_helper'
8
9
require_relative '../util/dingtalk_helper'
9
10
10
11
module FIR
11
12
module Publish
13
+ include FIR ::ThirdNotifierModule
12
14
def publish ( *args , options )
13
15
initialize_publish_options ( args , options )
14
16
logger_info_publishing_message
@@ -30,9 +32,7 @@ def publish(*args, options)
30
32
31
33
qrcode_path = build_qrcode download_url
32
34
33
- dingtalk_notifier ( download_url , qrcode_path )
34
- feishu_notifier ( download_url , qrcode_path )
35
- wxwork_notifier ( download_url )
35
+ notify_to_thirds ( download_url , qrcode_path )
36
36
37
37
upload_mapping_file_with_publish
38
38
@@ -195,34 +195,6 @@ def force_pin_release(release_id)
195
195
api_token : @token
196
196
end
197
197
198
- def dingtalk_notifier ( download_url , qrcode_path )
199
- DingtalkHelper . new ( @app_info , options , qrcode_path , download_url ) . send_msg
200
- end
201
-
202
- def feishu_notifier ( download_url , qrcode_path )
203
- FeishuHelper . new ( @app_info , options , qrcode_path , download_url ) . send_msg
204
- end
205
-
206
- def wxwork_notifier ( download_url )
207
- return if options [ :wxwork_webhook ] . blank? && options [ :wxwork_access_token ] . blank?
208
-
209
- webhook_url = options [ :wxwork_webhook ]
210
- webhook_url ||= "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=#{ options [ :wxwork_access_token ] } "
211
-
212
- title = "#{ @app_info [ :name ] } -#{ @app_info [ :version ] } (Build #{ @app_info [ :build ] } )"
213
- payload = {
214
- "msgtype" : 'news' ,
215
- "news" : {
216
- "articles" : [ {
217
- "title" : "#{ title } uploaded" ,
218
- "description" : "#{ title } uploaded at #{ Time . now } \n url: #{ download_url } \n #{ options [ :wxwork_custom_message ] } \n " ,
219
- "url" : download_url ,
220
- "picurl" : options [ :wxwork_pic_url ]
221
- } ]
222
- }
223
- }
224
- DefaultRest . post ( webhook_url , payload )
225
- end
226
198
227
199
def initialize_publish_options ( args , options )
228
200
@options = options
0 commit comments