lhj-tools 0.1.35 → 0.1.36

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: acf5100c519b9b7580d251efae32f735575f9c827959517ca25cee51501f96ab
4
- data.tar.gz: eab05a25fd97bfc21902294ab0204eda81e25f85a29c01edd2b4c99c0563b3dc
3
+ metadata.gz: 224052a6a416f97ba5b9827cd4fdcb49d345d2ff30721062d3f7fbe6e3a7693a
4
+ data.tar.gz: f605d6eff40aa500c863e4dddf8dc532584e1ee4abf7505112679aa629888dab
5
5
  SHA512:
6
- metadata.gz: b35f861355ebc4bbc29a22e9c306c573e845d07a0642d9c795030fc86f93ea3c362ce857938f2fb352ca36b297db3df1cbe39d314787fef33461254cd98205e0
7
- data.tar.gz: '09797b52b0e1b82ce17fa386bd6c0f6f21ad5deb1aafd392a1c19cd0b2a2adcaf4b695453b51e8a9ee1ca64068ea4df1965d208ebc19404e572b1feb60329c9d'
6
+ metadata.gz: d6388d57ad1fee26262cbca46c2cf472059c27557b6c7ff5512299a89f75ee97093bf29792756ed5bb8072c0b86dceae68589408ab3cfd1fb3db5dcfa25a2e05
7
+ data.tar.gz: f8d1d882382c5853eb495a7a3cb9d75953c27c9bfe1af7a2a1f1d1ee6e3cb012648f22fb859554fd2bc0c845642d55bc56c9b26b913cc4a00766f052a24dee3a
@@ -0,0 +1,34 @@
1
+ module Lhj
2
+ class Command
3
+ class CodeTemplate < Command
4
+ self.summary = '生成源码模板'
5
+ self.description = '生成的代码模板'
6
+
7
+ CODE_TEMPLATE_INDEX = [{ name: 'dispatch Source 模板', template: 'dispatch_source.erb' },
8
+ { name: '另一个 模板', template: 'fffaaa' },
9
+ { name: '代码模板', template: 'fffbbb' }].freeze
10
+
11
+ def initialize(argv)
12
+ @cli = HighLine.new
13
+ super
14
+ end
15
+
16
+ def handle
17
+ CODE_TEMPLATE_INDEX.each_index do |i|
18
+ puts "#{i}.#{CODE_TEMPLATE_INDEX[i][:name]}".yellow
19
+ end
20
+ idx = @cli.ask('请选择查看代码模板: '.green).strip.to_i
21
+ item = CODE_TEMPLATE_INDEX[idx]
22
+ template_name = item[:template]
23
+ template_str = render_template(template_name)
24
+ puts template_str
25
+ end
26
+
27
+ def render_template(template_name)
28
+ temp_str = File.read(File.join(File.dirname(__FILE__), 'template', template_name))
29
+ Lhj::ErbFormatter::Service.new(self).render_template(temp_str)
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,36 @@
1
+ @implementation ODOrderTimerManager
2
+
3
+ + (instancetype)sharedInstance {
4
+ static dispatch_once_t onceToken;
5
+ static ODOrderTimerManager *instance = nil;
6
+ dispatch_once(&onceToken,^{
7
+ instance = [[ODOrderTimerManager alloc] init];
8
+ });
9
+ return instance;
10
+ }
11
+
12
+ - (void)calcOrderPay:(NSString *)orderId timeout:(NSInteger)timeout
13
+ {
14
+ self.leftTime = timeout;
15
+ self.orderId = orderId;
16
+ if(self.timer){
17
+ dispatch_source_cancel(self.timer);
18
+ }
19
+ if(timeout > 0){
20
+ self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0));
21
+ dispatch_source_set_timer(self.timer, DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC, 0);
22
+ __weak __typeof(self)weakSelf = self;
23
+ dispatch_source_set_event_handler(self.timer, ^{
24
+ if(weakSelf.leftTime <= 0){ //倒計時結束,關閉
25
+ [[NSNotificationCenter defaultCenter] postNotificationName:kOrderTimerFinishedNotification object:nil];
26
+ dispatch_source_cancel(weakSelf.timer);
27
+ }else{
28
+ [[NSNotificationCenter defaultCenter] postNotificationName:kOrderTimerProcessingNotification object:@(self.leftTime)];
29
+ weakSelf.leftTime--;
30
+ }
31
+ });
32
+ dispatch_resume(self.timer);
33
+ }
34
+ }
35
+
36
+ @end
File without changes
data/lib/lhj/command.rb CHANGED
@@ -17,7 +17,8 @@ module Lhj
17
17
  require 'lhj/command/oss/del'
18
18
  require 'lhj/command/oss/upload'
19
19
  require 'lhj/command/oss/list'
20
- require 'lhj/command/view'
20
+ require 'lhj/command/code/view'
21
+ require 'lhj/command/code/code_template'
21
22
  require 'lhj/command/rename_image'
22
23
  require 'lhj/command/trans'
23
24
  require 'lhj/command/yapi'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lhj
4
4
  module Tools
5
- VERSION = "0.1.35"
5
+ VERSION = "0.1.36"
6
6
  end
7
7
  end
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.35
4
+ version: 0.1.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-29 00:00:00.000000000 Z
11
+ date: 2022-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -294,6 +294,9 @@ files:
294
294
  - bin/lhj
295
295
  - lib/lhj/action/sh_helper.rb
296
296
  - lib/lhj/command.rb
297
+ - lib/lhj/command/code/code_template.rb
298
+ - lib/lhj/command/code/template/dispatch_source.erb
299
+ - lib/lhj/command/code/view.rb
297
300
  - lib/lhj/command/config.rb
298
301
  - lib/lhj/command/config/info.rb
299
302
  - lib/lhj/command/duplicate_imageset.rb
@@ -318,7 +321,6 @@ files:
318
321
  - lib/lhj/command/sync_pod_version.rb
319
322
  - lib/lhj/command/template.rb
320
323
  - lib/lhj/command/trans.rb
321
- - lib/lhj/command/view.rb
322
324
  - lib/lhj/command/yapi.rb
323
325
  - lib/lhj/command/yapi/formatters/base.rb
324
326
  - lib/lhj/command/yapi/formatters/command_context.rb