lhj-tools 0.1.36 → 0.1.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhj/command/code/code_template.rb +2 -2
- data/lib/lhj/command/code/template/dispatch_source.erb +6 -6
- data/lib/lhj/command/code/template/message_query.erb +58 -0
- data/lib/lhj/command/oss/del.rb +12 -29
- data/lib/lhj/command/oss/list.rb +2 -2
- data/lib/lhj/command/oss/upload.rb +13 -19
- data/lib/lhj/command/refactor_rename.rb +2 -0
- data/lib/lhj/command/trans.rb +2 -1
- data/lib/lhj/tools/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00bcfbfc57ef29c17ccb992fe52decd1dc169a2f4595c6c291edc99e8d5516b4
|
4
|
+
data.tar.gz: 48ea09b1938d81b27293719247d9382d1b92627ccb4e9544a312d0c00029a942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19fa3572c6c8cf794f74299710c5b2a0a0e24d4ac25abec6a7d0e5bce4ef339d039aa86418a228c039b999fb63b2e00423674c584e9e1ee8cc476597da5cb180
|
7
|
+
data.tar.gz: d65ecfea427f73d635670475c9b811e4f998358de57ac1a27e9091489bf877d998008c9454e2e207e6661e74a8201192701c3e1c9d97998e61a665b84e38d90d
|
@@ -5,8 +5,8 @@ module Lhj
|
|
5
5
|
self.description = '生成的代码模板'
|
6
6
|
|
7
7
|
CODE_TEMPLATE_INDEX = [{ name: 'dispatch Source 模板', template: 'dispatch_source.erb' },
|
8
|
-
{ name: '
|
9
|
-
{ name: '代码模板', template: '
|
8
|
+
{ name: '消息队列', template: 'message_query.erb' },
|
9
|
+
{ name: '代码模板', template: 'test.erb' }].freeze
|
10
10
|
|
11
11
|
def initialize(argv)
|
12
12
|
@cli = HighLine.new
|
@@ -1,12 +1,12 @@
|
|
1
1
|
@implementation ODOrderTimerManager
|
2
2
|
|
3
3
|
+ (instancetype)sharedInstance {
|
4
|
-
static dispatch_once_t onceToken;
|
5
|
-
static ODOrderTimerManager *instance = nil;
|
6
|
-
dispatch_once(&onceToken,^{
|
7
|
-
|
8
|
-
});
|
9
|
-
return instance;
|
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
10
|
}
|
11
11
|
|
12
12
|
- (void)calcOrderPay:(NSString *)orderId timeout:(NSInteger)timeout
|
@@ -0,0 +1,58 @@
|
|
1
|
+
- (void)handleWithBlock:(void (^)(AMGoodsSellingMessageModel *, void(^completion)(BOOL finished, AMGoodsSellingMessageModel *current)))block completion:(void (^)(AMGoodsSellingMessageModel *, void(^)(BOOL)))completion
|
2
|
+
{
|
3
|
+
dispatch_once(&onceMessageQueueManagerToken, ^{
|
4
|
+
[self processWithPreModel:nil block:block completion:completion];
|
5
|
+
});
|
6
|
+
}
|
7
|
+
|
8
|
+
- (void)processWithPreModel:(AMGoodsSellingMessageModel *)preModel block:(void (^)(AMGoodsSellingMessageModel *, void(^completion)(BOOL finished, AMGoodsSellingMessageModel *current)))block completion:(void (^)(AMGoodsSellingMessageModel *, void(^)(BOOL)))completion
|
9
|
+
{
|
10
|
+
AMGoodsSellingMessageModel *next = [self popModel];
|
11
|
+
if(next && block){
|
12
|
+
__weak __typeof(self)weakSelf = self;
|
13
|
+
if(preModel){
|
14
|
+
if(![next isEqual:preModel]){
|
15
|
+
next.animationType = AMMessageAnimationTypeReShowAndAnimation;
|
16
|
+
next.currentNum = MAX(1, [next.sellingNumber integerValue]);
|
17
|
+
}else{
|
18
|
+
next.animationType = AMMessageAnimationTypeAnimation;
|
19
|
+
NSInteger num = MAX(1, [next.sellingNumber integerValue]);
|
20
|
+
next.currentNum = preModel.currentNum + num;
|
21
|
+
}
|
22
|
+
}else{
|
23
|
+
next.animationType = AMMessageAnimationTypeShowAndAnimation;
|
24
|
+
next.currentNum = MAX(1, [next.sellingNumber integerValue]);
|
25
|
+
}
|
26
|
+
next.displayNumber = [NSString stringWithFormat:@"%ld", next.currentNum];
|
27
|
+
block(next, ^(BOOL finished, AMGoodsSellingMessageModel *current){
|
28
|
+
if(finished){
|
29
|
+
[weakSelf processWithPreModel:next block:block completion:completion];
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}else{
|
33
|
+
if(completion){
|
34
|
+
completion(preModel, ^(BOOL finished){
|
35
|
+
onceMessageQueueManagerToken = 0;
|
36
|
+
});
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
-(void)beginProductSoldOutAnimation
|
42
|
+
{
|
43
|
+
__weak __typeof(self)weakSelf = self;
|
44
|
+
[[AMMessageQueueManager sharedInstance] handleWithBlock:^(AMGoodsSellingMessageModel * model, void (^ _Nonnull completion)(BOOL ,AMGoodsSellingMessageModel *)) {
|
45
|
+
if(model){
|
46
|
+
[weakSelf productSoldOutViewAnimation:model completion:^(BOOL finished, AMGoodsSellingMessageModel *current) {
|
47
|
+
completion(finished, current);
|
48
|
+
}];
|
49
|
+
}
|
50
|
+
} completion:^(AMGoodsSellingMessageModel *preModel, void (^ _Nonnull finishCallback)(BOOL)) {
|
51
|
+
NSInteger des = preModel ? preModel.dismissSec : 3;
|
52
|
+
[[AMMessageTimerManager sharedInstance] scheduledWithMessageType:AMCustomMessageTypeGoodsSelling timeout:des completion:^{
|
53
|
+
[weakSelf hideProductSoldOutView:^(BOOL finished) {
|
54
|
+
finishCallback(finished);
|
55
|
+
}];
|
56
|
+
}];
|
57
|
+
}];
|
58
|
+
}
|
data/lib/lhj/command/oss/del.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'lhj/helper/oss_helper'
|
3
|
+
require 'highline'
|
3
4
|
|
4
5
|
module Lhj
|
5
6
|
class Command
|
@@ -7,42 +8,24 @@ module Lhj
|
|
7
8
|
class Del < OSS
|
8
9
|
self.summary = '删除OSS的key'
|
9
10
|
|
10
|
-
self.arguments = [
|
11
|
-
CLAide::Argument.new('--key=XX', true),
|
12
|
-
CLAide::Argument.new('--type=XX', true)
|
13
|
-
]
|
14
|
-
|
15
|
-
def self.options
|
16
|
-
[
|
17
|
-
%w[--key OSS对应的key],
|
18
|
-
%w[--type OSS对应的类型]
|
19
|
-
]
|
20
|
-
end
|
21
|
-
|
22
11
|
def initialize(argv)
|
23
|
-
@
|
24
|
-
@type = argv.option('type')
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
|
-
def validate!
|
29
|
-
help! '请输入key或者类型' unless @key || @type
|
12
|
+
@cli = HighLine.new
|
30
13
|
super
|
31
14
|
end
|
32
15
|
|
33
16
|
def handle
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Lhj::OSS::Helper.instance.delete(o.key)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
else
|
43
|
-
Lhj::OSS::Helper.instance.delete(@key)
|
17
|
+
objects = Lhj::OSS::Helper.instance.list
|
18
|
+
obj_keys = []
|
19
|
+
objects.each_with_index do |o, i|
|
20
|
+
obj_keys << o.key
|
21
|
+
puts "#{i}.#{o.key}".yellow
|
44
22
|
end
|
23
|
+
idx = @cli.ask('请选择删除的key: '.green).strip.to_i
|
24
|
+
oss_key = obj_keys[idx]
|
25
|
+
puts "删除的key为:#{oss_key}".red
|
26
|
+
Lhj::OSS::Helper.instance.delete(oss_key)
|
45
27
|
end
|
28
|
+
|
46
29
|
end
|
47
30
|
end
|
48
31
|
end
|
data/lib/lhj/command/oss/list.rb
CHANGED
@@ -10,8 +10,8 @@ module Lhj
|
|
10
10
|
def handle
|
11
11
|
objects = Lhj::OSS::Helper.instance.list
|
12
12
|
rows = []
|
13
|
-
objects.
|
14
|
-
path = "#{Lhj::OSS::Helper.instance.url_path}/#{o.key}"
|
13
|
+
objects.each_with_index do |o, i|
|
14
|
+
path = "#{i}.#{Lhj::OSS::Helper.instance.url_path}/#{o.key}"
|
15
15
|
rows << [path]
|
16
16
|
end
|
17
17
|
table = Terminal::Table.new title: 'OSS List', headings: ['URL'], rows: rows
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'lhj/helper/oss_helper'
|
4
|
+
require 'highline'
|
4
5
|
|
5
6
|
module Lhj
|
6
7
|
class Command
|
@@ -10,41 +11,34 @@ module Lhj
|
|
10
11
|
self.summary = '上传文件'
|
11
12
|
|
12
13
|
self.arguments = [
|
13
|
-
CLAide::Argument.new('type', false),
|
14
|
-
CLAide::Argument.new('name', false),
|
15
14
|
CLAide::Argument.new('tag', false)
|
16
15
|
]
|
17
16
|
|
18
17
|
def self.options
|
19
18
|
[
|
20
|
-
%w[--type 文件类型],
|
21
|
-
%w[--name 文件名],
|
22
19
|
%w[--tag 标签]
|
23
20
|
]
|
24
21
|
end
|
25
22
|
|
26
|
-
def validate!
|
27
|
-
super
|
28
|
-
help! '类型或名字必须输入' unless @name || @type
|
29
|
-
end
|
30
|
-
|
31
23
|
def initialize(argv)
|
32
24
|
@current_path = argv.shift_argument || Dir.pwd
|
33
|
-
@type = argv.option('type')
|
34
|
-
@name = argv.option('name')
|
35
25
|
@tag = argv.option('tag')
|
26
|
+
@cli = HighLine.new
|
36
27
|
super
|
37
28
|
end
|
38
29
|
|
39
30
|
def handle
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
31
|
+
file_list = []
|
32
|
+
file_name_list = []
|
33
|
+
Dir.glob("#{@current_path}/*").each_with_index do |f, i|
|
34
|
+
file_base_name = File.basename(f)
|
35
|
+
file_list << f
|
36
|
+
file_name_list << file_base_name
|
37
|
+
puts "#{i}.#{file_base_name}".yellow
|
47
38
|
end
|
39
|
+
idx = @cli.ask('请选择上传文件序号: '.green).strip.to_i
|
40
|
+
puts "上传的文件名:#{file_name_list[idx]}".yellow
|
41
|
+
upload(file_list[idx], file_name_list[idx])
|
48
42
|
end
|
49
43
|
|
50
44
|
private
|
@@ -54,7 +48,7 @@ module Lhj
|
|
54
48
|
oss_key = "#{@tag}/#{file_name}" if @tag
|
55
49
|
Lhj::OSS::Helper.instance.upload(oss_key, file)
|
56
50
|
url = Lhj::OSS::Helper.instance.object_url(oss_key)
|
57
|
-
puts "云端上传成功:#{url}\n"
|
51
|
+
puts "云端上传成功:#{url}\n".yellow
|
58
52
|
end
|
59
53
|
end
|
60
54
|
end
|
data/lib/lhj/command/trans.rb
CHANGED
data/lib/lhj/tools/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|
@@ -296,6 +296,7 @@ files:
|
|
296
296
|
- lib/lhj/command.rb
|
297
297
|
- lib/lhj/command/code/code_template.rb
|
298
298
|
- lib/lhj/command/code/template/dispatch_source.erb
|
299
|
+
- lib/lhj/command/code/template/message_query.erb
|
299
300
|
- lib/lhj/command/code/view.rb
|
300
301
|
- lib/lhj/command/config.rb
|
301
302
|
- lib/lhj/command/config/info.rb
|