lhj-tools 0.1.45 → 0.1.49

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: fad00b53bac9c95b946a8ef6a87632b0b0f7d2be620b2112332460b891a08a62
4
- data.tar.gz: 8a846f51f4cd67c437e4d8b16f693cd81f68216bae542d97932d1c0440259087
3
+ metadata.gz: 7d7518e273318146bfc0d2f735c25826d778c77ce9bd594c07caef20a666a413
4
+ data.tar.gz: 0c10a6f9df643fe2c7eba3c167eb19a08eac57569134e69288d8df62ae578552
5
5
  SHA512:
6
- metadata.gz: 2ac614b5f510059e17f143cfadf91d7003da0a8178e9e64793ef0ae971d92946a7c1ba05311db3ec917dfac933ed83ce7fcaf46c4d4307ec5dc5e1693709b00a
7
- data.tar.gz: da907ab9b3ee43e9dfcb6fd2013ef9a9967e88e1a2f193ef464e9b918c18c2e2161913715cade5328d1c181a2d0f8d20add0a7005ee873d8df755f388216650a
6
+ metadata.gz: 32799cc62fdc694c03859a7a047186848ae4d1fb6b4d2684806191f405ff10ce9501481d631d62c227cfa9047ba980e19023730321c58246aa003b5459ac438a
7
+ data.tar.gz: 9401529e2375db05d724d377697d0e315b9d72aaf4203a7ee308c07914d0347ea2260fbad9a9cfe4db295956b24f89a414a08ba3f330b2601539c85f2785d8fa
@@ -39,7 +39,7 @@ module Lhj
39
39
  end
40
40
 
41
41
  def pod_folder_name
42
- File.join(@current_path, 'MacauLife', 'CustomPods')
42
+ File.join(@current_path, 'CustomPods')
43
43
  end
44
44
 
45
45
  def child_dir
@@ -52,6 +52,7 @@ module Lhj
52
52
  message = message.gsub('seconds ', '秒')
53
53
  message = message.gsub('minutes ', '分钟')
54
54
  message = message.gsub('hours ', '小时')
55
+ message = message.gsub('weeks ', '周')
55
56
  message = message.gsub('days ', '天')
56
57
  message = message.gsub('ago ', '前')
57
58
  Lhj::TeamMemberConfig.config.each do |key, value|
@@ -42,6 +42,19 @@ module Lhj
42
42
  end
43
43
  end
44
44
 
45
+ def self.shortcut_url(env = :uat)
46
+ case env
47
+ when :release
48
+ config['release_shortcut_url']
49
+ when :gray
50
+ config['gray_shortcut_url']
51
+ when :uat
52
+ config['uat_shortcut_url']
53
+ else
54
+ config['shortcut_url']
55
+ end
56
+ end
57
+
45
58
  def self.password(env = :uat)
46
59
  config['password']
47
60
  end
@@ -80,12 +80,13 @@ module Lhj
80
80
  # step 1
81
81
  folder_path_dir = path
82
82
  rand_key = rand(100) % 3
83
- zipped_path = "Life_i_#{rand_key}.zip"
84
- zipped_path = "Life_a_#{rand_key}.zip" unless file.end_with?('.ipa')
85
- Actions.sh(%(cd "#{folder_path_dir}" && zip -r "#{zipped_path}" "#{folder_path_dir}"/* -x="#{folder_path_dir}"/Code/MacauLife.ipa), log: false)
83
+ zipped_name = "archive_#{rand_key}.zip"
84
+ zipped_name = "archive_a_#{rand_key}.zip" unless file.end_with?('.ipa')
85
+ command = %(cd #{folder_path_dir} && zip -r #{zipped_name} ./* -x "*.ipa" -x "*.dSYM.zip")
86
+ Actions.sh(command, log: false)
86
87
  # step 2
87
- oss_key = "code/#{zipped_path}"
88
- oss_file = File.join(folder_path_dir, zipped_path)
88
+ oss_key = "code/#{zipped_name}"
89
+ oss_file = File.join(folder_path_dir, zipped_name)
89
90
  file_exists = File.exist?(oss_file)
90
91
  return unless file_exists
91
92
 
@@ -0,0 +1,67 @@
1
+
2
+ # frozen_string_literal: true
3
+ require "uri"
4
+ require "net/http"
5
+ require 'lhj/helper/pgyer_config'
6
+
7
+ module Lhj
8
+ # pgyer upload
9
+ class PgyerShortcut
10
+ API_SHORTCUT_HOST = 'https://www.pgyer.com/apiv2/app/getByShortcut'
11
+
12
+ attr_reader :api_key, :user_key, :password, :shortcut_url
13
+
14
+ def initialize(env = :uat)
15
+ @api_key = Lhj::PgyerConfig.api_key(env)
16
+ @user_key = Lhj::PgyerConfig.user_key(env)
17
+ @shortcut_url = Lhj::PgyerConfig.shortcut_url(env)
18
+ end
19
+
20
+ def request_shortcut_body
21
+ url = URI(API_SHORTCUT_HOST)
22
+
23
+ https = Net::HTTP.new(url.host, url.port)
24
+ https.use_ssl = true
25
+
26
+ request = Net::HTTP::Post.new(url)
27
+ request['Content-Type'] = 'application/x-www-form-urlencoded'
28
+ request.body = "_api_key=#{@api_key}&buildShortcutUrl=#{@shortcut_url}"
29
+
30
+ response = https.request(request)
31
+ response.read_body
32
+ end
33
+
34
+ def res_body
35
+ body = request_shortcut_body unless @res_body
36
+ @res_body ||= JSON.parse(body)
37
+ end
38
+
39
+ def build_version
40
+ res_json = res_body
41
+ res = ''
42
+ res = res_json['data']['buildBuildVersion'] if res_json['code'].to_i.zero?
43
+ res
44
+ end
45
+
46
+ def build_updated
47
+ res_json = res_body
48
+ res = ''
49
+ res = res_json['data']['buildUpdated'] if res_json['code'].to_i.zero?
50
+ res
51
+ end
52
+
53
+ def build_app_version
54
+ res_json = res_body
55
+ res = ''
56
+ res = res_json['data']['buildVersion'] if res_json['code'].to_i.zero?
57
+ res
58
+ end
59
+
60
+ def build_app_version_no
61
+ res_json = res_body
62
+ res = ''
63
+ res = res_json['data']['buildVersionNo'] if res_json['code'].to_i.zero?
64
+ res
65
+ end
66
+ end
67
+ end
@@ -16,10 +16,12 @@ module Lhj
16
16
 
17
17
  QUERY_RECORDS_API_URL = 'https://api.vika.cn/fusion/v1/datasheets/dstid/records?viewId=viwid'.freeze
18
18
 
19
- QUERY_RECORDS_FIELD_KEY_API_URL = 'https://api.vika.cn/fusion/v1/datasheets/dstid/records?viewId=viwid&fieldKey=id&pageSize=500'.freeze
19
+ QUERY_RECORDS_FIELD_KEY_API_URL = 'https://api.vika.cn/fusion/v1/datasheets/dstid/records?viewId=viwid&fieldKey=id&pageSize=page_size&pageNum=page_num'.freeze
20
20
 
21
21
  RECORD_LINK_URL = 'https://vika.cn/workbench/dstid/viwid/recid'.freeze
22
22
 
23
+ QUERY_RECORDS_PAGE_SIZE = 100
24
+
23
25
  def self.trans_vika(note)
24
26
  str = note.dup
25
27
  if /#.+#/ =~ str
@@ -120,13 +122,17 @@ module Lhj
120
122
 
121
123
  res['data']['views'].each do |viw|
122
124
  viw_id = viw['id']
123
- request_records(dst_id, viw_id)
125
+ request_records(1, dst_id, viw_id)
124
126
  end
125
127
  end
126
128
 
127
- def self.request_records(dst_id, viw_id)
128
- response = fetch_result(:records_key, dst_id, viw_id)
129
- handle_records_response(dst_id, viw_id, response)
129
+ def self.request_records(page_num, dst_id, viw_id)
130
+ url = url_with_kind(:records_key, dst_id, viw_id)
131
+ url = url.gsub('page_size', QUERY_RECORDS_PAGE_SIZE.to_s)
132
+ url = url.gsub('page_num', page_num.to_s)
133
+ response = get_with_url(url)
134
+ page_size = handle_records_response(dst_id, viw_id, response)
135
+ request_records(page_num + 1, dst_id, viw_id) if page_size == QUERY_RECORDS_PAGE_SIZE
130
136
  end
131
137
 
132
138
  def self.handle_records_response(dst_id, viw_id, res)
@@ -146,6 +152,7 @@ module Lhj
146
152
  data_source[ds_key] = ds_value
147
153
  end
148
154
  end
155
+ res['data']['pageSize'].to_i
149
156
  end
150
157
 
151
158
  def self.link_url(dst_id, viw_id, rec_id)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.45"
5
+ VERSION = "0.1.49"
6
6
  end
7
7
  end
data/lib/lhj/tools.rb CHANGED
@@ -14,6 +14,7 @@ module Lhj
14
14
  require 'lhj/helper/pod_repo_config'
15
15
  require 'lhj/helper/git_branch_feature_config'
16
16
  require 'lhj/helper/pgyer_helper'
17
+ require 'lhj/helper/pgyer_shortcut_helper'
17
18
  require 'lhj/helper/dingtalk_helper'
18
19
  require 'lhj/helper/tb_helper'
19
20
  require 'lhj/action/sh_helper'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhj-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.45
4
+ version: 0.1.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -344,6 +344,7 @@ files:
344
344
  - lib/lhj/helper/oss_helper.rb
345
345
  - lib/lhj/helper/pgyer_config.rb
346
346
  - lib/lhj/helper/pgyer_helper.rb
347
+ - lib/lhj/helper/pgyer_shortcut_helper.rb
347
348
  - lib/lhj/helper/pod_repo_config.rb
348
349
  - lib/lhj/helper/tb_config.rb
349
350
  - lib/lhj/helper/tb_helper.rb