lhj-tools 0.1.85 → 0.1.87

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
  SHA256:
3
- metadata.gz: 85027c228917f15bde50036e543a1f1009f13419d7fef3d7ccaca6fecff03960
4
- data.tar.gz: 917639bf7426a52fde22c93816a1d33fdc5079075fb07bb96a93788bea2c7b0e
3
+ metadata.gz: 88a12084e737e12b3a0e10a428407cc1e83dfd29a6831709b40bbc330ce2c183
4
+ data.tar.gz: fb31614816bf573b70f2fd03fbdab218f8ce215b512e5d63acaf29001a357893
5
5
  SHA512:
6
- metadata.gz: c4cd7b9be22ec7347eb2f4f0f88633d4af91d79dd9dd7ba566ed478ec93008e45217061074d76333780859fb67187f44d3ea969820136b887c4b953a86449ebf
7
- data.tar.gz: 84865eb597d31ccf9e781656a60c671417ed024a38f49c0d5484fc3379e130ed328332a79487894168753b119b7d76cf934896a280e0644b261f59d0165aa389
6
+ metadata.gz: 344983fb4d1b4f9d60bf94f85279a17db67a1e12ee5dd5d20c1efd000d5f37ec472aec6d4a93dbd786d7cb84a033d83a96f02cc612894cf3142f5fa3169c7088
7
+ data.tar.gz: 4936c0a4f26d79e879737447ec9c7ca408925b007624a1eb7e78187021ad7069d2b1d9f7dc65130202609356e87a7f4975c41f7826ebea20cb2a6da77c3909b7
@@ -67,7 +67,7 @@ module Lhj
67
67
  # 2.print request json body
68
68
  req_models = print_req_body_model(res_body) if res_body['data']['req_body_is_json_schema']
69
69
  # 3.print request param
70
- print_req_query(res_body['data']) unless res_body['data']['req_body_is_json_schema']
70
+ req_models ||= print_req_query(res_body['data']) unless res_body['data']['req_body_is_json_schema']
71
71
  # 4.print request method
72
72
  service_code = print_http_method(res_body['data'], project_info)
73
73
  # print request mock data
@@ -124,7 +124,7 @@ module Lhj
124
124
  File.write(h_file, @h_file_array.join("\n")) if @h_file_array.count.positive?
125
125
  File.write(m_file, @m_file_array.join("\n")) if @m_file_array.count.positive?
126
126
  File.write(service_file, service_code) if service_code
127
- File.write(req_mock_file, @req_mock_array.join("\n")) if @req_mock_array.count.positive?
127
+ File.write(req_mock_file, @req_mock_array.join("\n")) if @req_mock_array&.count&.positive?
128
128
 
129
129
  puts "\n\n生成文件成功!所在路径:\n#{File.expand_path(h_file)} \n#{File.expand_path(m_file)}".green if @save && !@notify
130
130
  {
@@ -462,19 +462,17 @@ module Lhj
462
462
  def print_req_query(data)
463
463
  return unless data && data['req_query']
464
464
 
465
- case @language
466
- when 'oc'
467
- param_model_name = gen_model_name(nil, :req)
468
- puts_h "@interface #{param_model_name} : NSObject"
469
- data['req_query'].each do |h|
470
- des = h['desc']
471
- puts_h "///#{des} #{h['example']}"
472
- puts_h "@property (nonatomic, copy) NSString *#{h['name']};"
473
- end
474
- puts_h '@end'
475
- puts "\n\n"
476
- when 'java'
465
+ properties = []
466
+ data['req_query'].each do |h|
467
+ properties << { key: h['name'], type: 'string', description: h['desc'], default: '' }
477
468
  end
469
+ param_model_name = gen_model_name(nil, :req)
470
+ req_model = { name: param_model_name, properties: properties }
471
+
472
+ models = [req_model]
473
+ print_models(models)
474
+ print_models_impl(models)
475
+ models
478
476
  end
479
477
 
480
478
  def print_http_method(data, project_info)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.85"
5
+ VERSION = "0.1.87"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhj-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.85
4
+ version: 0.1.87
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian