Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
a0d8c448
Z
zendata
项目概览
易企天创
/
zendata
9 个月 前同步成功
通知
17
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a0d8c448
编写于
8月 25, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
close task about account and domain
上级
2aba686f
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
300 addition
and
87 deletion
+300
-87
data/domain/esp.v1.txt
data/domain/esp.v1.txt
+0
-8
data/domain/self.v1.txt
data/domain/self.v1.txt
+0
-2
demo/default.yaml
demo/default.yaml
+1
-1
demo/test/test.yaml
demo/test/test.yaml
+69
-49
src/gen/generator.go
src/gen/generator.go
+9
-0
src/gen/list.go
src/gen/list.go
+10
-2
src/gen/res.go
src/gen/res.go
+37
-18
src/utils/vari/var.go
src/utils/vari/var.go
+3
-0
yaml/base/domain/domain.v1.yaml
yaml/base/domain/domain.v1.yaml
+158
-6
yaml/base/domain/esp.v1.yaml
yaml/base/domain/esp.v1.yaml
+12
-0
yaml/base/domain/postfix.v1.yaml
yaml/base/domain/postfix.v1.yaml
+1
-1
yaml/base/email/email.v1.yaml
yaml/base/email/email.v1.yaml
+0
-0
未找到文件。
data/domain/esp.v1.txt
已删除
100644 → 0
浏览文件 @
2aba686f
qq.com
163.com
263.net
aliyun.com
126.com
gmail.com
outlook.com
hotmail.com
\ No newline at end of file
data/domain/self.v1.txt
已删除
100644 → 0
浏览文件 @
2aba686f
ngtesting.com
testfarm.net
\ No newline at end of file
demo/default.yaml
浏览文件 @
a0d8c448
...
...
@@ -140,5 +140,5 @@ fields:
fields
:
-
field
:
field_grandson
prefix
:
int_
range
:
10-20
range
:
10-20
:R
postfix
:
demo/test/test.yaml
浏览文件 @
a0d8c448
...
...
@@ -114,52 +114,72 @@ fields:
prefix
:
"
["
postfix
:
"
]
\t
"
-
field
:
test20
from
:
base.domain.domain.name.v1.yaml
use
:
number_with_esp
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test21
from
:
base.domain.domain.name.v1.yaml
use
:
number_with_self
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test22
from
:
base.domain.domain.name.v1.yaml
use
:
letter_with_esp
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test23
from
:
base.domain.domain.name.v1.yaml
use
:
letter_with_self
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test24
from
:
base.domain.domain.name.v1.yaml
use
:
western_with_esp
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test25
from
:
base.domain.domain.name.v1.yaml
use
:
western_with_self
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test26
from
:
base.domain.domain.name.v1.yaml
use
:
pinyin_with_esp
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test27
from
:
base.domain.domain.name.v1.yaml
use
:
pinyin_with_self
prefix
:
"
"
postfix
:
"
\t
"
-
field
:
test28
from
:
base.domain.domain.name.v1.yaml
use
:
western_with_custom
prefix
:
"
"
postfix
:
"
\t
"
# - field: test20
# from: base.domain.domain.v1.yaml
# use: one_number_at_common
# prefix: ""
# postfix: "\t"
# - field: test21
# from: base.domain.domain.v1.yaml
# use: one_number_at_cn
# prefix: ""
# postfix: "\t"
# - field: test22
# from: base.domain.domain.v1.yaml
# use: one_number_at_new
# prefix: ""
# postfix: "\t"
#
# - field: test23
# from: base.domain.domain.v1.yaml
# use: one_letter_at_common
# prefix: ""
# postfix: "\t"
# - field: test24
# from: base.domain.domain.v1.yaml
# use: one_letter_at_cn
# prefix: ""
# postfix: "\t"
# - field: test25
# from: base.domain.domain.v1.yaml
# use: one_letter_at_new
# prefix: ""
# postfix: "\t"
#
# - field: test26
# from: base.domain.domain.v1.yaml
# use: numbers_at_common
# prefix: ""
# postfix: "\t"
# - field: test27
# from: base.domain.domain.v1.yaml
# use: numbers_at_cn
# prefix: ""
# postfix: "\t"
# - field: test28
# from: base.domain.domain.v1.yaml
# use: numbers_at_new
# prefix: ""
# postfix: "\t"
#
# - field: test29
# from: base.domain.domain.v1.yaml
# use: mixed_at_common
# prefix: ""
# postfix: "\t"
# - field: test30
# from: base.domain.domain.v1.yaml
# use: mixed_at_cn
# prefix: ""
# postfix: "\t"
# - field: test31
# from: base.domain.domain.v1.yaml
# use: mixed_at_new
# prefix: ""
# postfix: "\t"
#
# - field: test32
# from: base.domain.esp.v1.yaml
# use: esp
# prefix: ""
# postfix: "\t"
\ No newline at end of file
src/gen/generator.go
浏览文件 @
a0d8c448
...
...
@@ -369,6 +369,15 @@ func randomValuesArr(values [][]string) (ret [][]string) {
return
}
func
randomInterfaces
(
values
[]
interface
{})
(
ret
[]
interface
{})
{
length
:=
len
(
values
)
for
i
:=
0
;
i
<
length
;
i
++
{
val
:=
commonUtils
.
RandNum
(
length
)
ret
=
append
(
ret
,
values
[
val
])
}
return
}
func
randomValues
(
values
[]
string
)
(
ret
[]
string
)
{
length
:=
len
(
values
)
for
i
:=
0
;
i
<
length
;
i
++
{
...
...
src/gen/list.go
浏览文件 @
a0d8c448
...
...
@@ -149,7 +149,7 @@ func CreateValuesFromLiteral(field *model.DefField, desc string, stepStr string,
step
,
_
:=
strconv
.
Atoi
(
stepStr
)
total
:=
0
if
stepStr
==
"r"
{
if
field
.
Path
!=
""
&&
stepStr
==
"r"
{
items
=
append
(
items
,
Placeholder
(
field
.
Path
))
mp
:=
placeholderMapForRandValues
(
"list"
,
elemArr
,
""
,
""
,
""
,
""
)
...
...
@@ -175,6 +175,10 @@ func CreateValuesFromLiteral(field *model.DefField, desc string, stepStr string,
i
+=
step
}
if
field
.
Path
==
""
&&
stepStr
==
"r"
{
// for ranges and instances, random
items
=
randomInterfaces
(
items
)
}
return
}
...
...
@@ -186,7 +190,7 @@ func CreateValuesFromInterval(field *model.DefField, desc, stepStr string, repea
dataType
,
step
,
precision
,
rand
:=
CheckRangeType
(
startStr
,
endStr
,
stepStr
)
if
dataType
!=
"string"
&&
rand
{
if
field
.
Path
!=
""
&&
dataType
!=
"string"
&&
rand
{
items
=
append
(
items
,
Placeholder
(
field
.
Path
))
mp
:=
placeholderMapForRandValues
(
dataType
,
[]
string
{},
startStr
,
endStr
,
stepStr
,
strconv
.
Itoa
(
precision
))
...
...
@@ -218,6 +222,10 @@ func CreateValuesFromInterval(field *model.DefField, desc, stepStr string, repea
}
}
if
field
.
Path
==
""
&&
stepStr
==
"r"
{
// for ranges and instances, random
items
=
randomInterfaces
(
items
)
}
return
}
...
...
src/gen/res.go
浏览文件 @
a0d8c448
...
...
@@ -75,7 +75,15 @@ func getResForExcel(resFile, sheet string, field *model.DefField) (map[string][]
}
func
getResForYaml
(
resFile
string
)
(
valueMap
map
[
string
][]
string
,
resName
string
)
{
if
vari
.
CacheResFileToMap
[
resFile
]
!=
nil
{
valueMap
=
vari
.
CacheResFileToMap
[
resFile
]
resName
=
vari
.
CacheResFileToName
[
resFile
]
return
}
yamlContent
,
err
:=
ioutil
.
ReadFile
(
resFile
)
yamlContent
=
ReplaceSpecialChars
(
yamlContent
)
if
err
!=
nil
{
logUtils
.
PrintTo
(
i118Utils
.
I118Prt
.
Sprintf
(
"fail_to_read_file"
,
resFile
))
return
...
...
@@ -102,6 +110,9 @@ func getResForYaml(resFile string) (valueMap map[string][]string, resName string
}
}
vari
.
CacheResFileToMap
[
resFile
]
=
valueMap
vari
.
CacheResFileToName
[
resFile
]
=
resName
return
}
...
...
@@ -109,7 +120,10 @@ func getResForInstances(insts model.ResInsts) map[string][]string {
groupedValue
:=
map
[
string
][]
string
{}
for
_
,
inst
:=
range
insts
.
Instances
{
for
_
,
instField
:=
range
inst
.
Fields
{
// prepare referred parent instances if needed
// prepare referred parent instances res if needed, support only 1 level
for
_
,
instField
:=
range
inst
.
Fields
{
// set "from" val from parent if needed
if
instField
.
From
==
""
{
if
insts
.
From
!=
""
{
instField
.
From
=
insts
.
From
...
...
@@ -123,7 +137,10 @@ func getResForInstances(insts model.ResInsts) map[string][]string {
parentRanges
,
parentInstants
:=
getRootRangeOrInstant
(
instField
)
groupedValueParent
:=
map
[
string
][]
string
{}
if
len
(
parentInstants
.
Instances
)
>
0
{
// refer to instances
if
len
(
parentRanges
.
Ranges
)
>
0
{
// refer to ranges
groupedValueParent
=
getResForRanges
(
parentRanges
)
}
else
if
len
(
parentInstants
.
Instances
)
>
0
{
// refer to instances
for
_
,
child
:=
range
parentInstants
.
Instances
{
field
:=
convertInstantToField
(
parentInstants
,
child
)
...
...
@@ -131,12 +148,10 @@ func getResForInstances(insts model.ResInsts) map[string][]string {
group
:=
child
.
Instance
groupedValueParent
[
group
]
=
GenerateForField
(
&
field
,
false
)
}
}
else
if
len
(
parentRanges
.
Ranges
)
>
0
{
// refer to ranges
groupedValueParent
=
getResForRanges
(
parentRanges
)
}
vari
.
Res
[
instField
.
From
]
=
groupedValueParent
}
else
if
instField
.
Select
!=
""
{
// refer to
another
excel
}
else
if
instField
.
Select
!=
""
{
// refer to excel
resFile
,
resType
,
sheet
:=
fileUtils
.
GetResProp
(
instField
.
From
)
values
,
_
:=
getResValue
(
resFile
,
resType
,
sheet
,
&
instField
)
vari
.
Res
[
instField
.
From
]
=
values
...
...
@@ -176,6 +191,18 @@ func getRootRangeOrInstant(inst model.DefField) (parentRanges model.ResRanges, p
return
}
func
getResForRanges
(
ranges
model
.
ResRanges
)
map
[
string
][]
string
{
groupedValue
:=
map
[
string
][]
string
{}
for
group
,
expression
:=
range
ranges
.
Ranges
{
field
:=
convertRangesToField
(
ranges
,
expression
)
groupedValue
[
group
]
=
GenerateForField
(
&
field
,
false
)
}
return
groupedValue
}
func
convertInstantToField
(
insts
model
.
ResInsts
,
inst
model
.
ResInst
)
(
field
model
.
DefField
)
{
field
.
Field
=
insts
.
Field
field
.
From
=
insts
.
From
...
...
@@ -196,20 +223,12 @@ func convertInstantToField(insts model.ResInsts, inst model.ResInst) (field mode
return
field
}
func
getResForRanges
(
ranges
model
.
ResRanges
)
map
[
string
][]
string
{
groupedValue
:=
map
[
string
][]
string
{}
for
group
,
exp
:=
range
ranges
.
Ranges
{
// convert ranges field to standard field
tempField
:=
model
.
DefField
{}
copier
.
Copy
(
&
tempField
,
ranges
)
tempField
.
Field
=
ranges
.
Field
tempField
.
Range
=
exp
groupedValue
[
group
]
=
GenerateForField
(
&
tempField
,
false
)
}
func
convertRangesToField
(
ranges
model
.
ResRanges
,
expression
string
)
(
field
model
.
DefField
)
{
copier
.
Copy
(
&
field
,
ranges
)
field
.
Field
=
ranges
.
Field
field
.
Range
=
expression
return
groupedValue
return
field
}
func
getResForConfig
(
configRes
model
.
DefField
)
map
[
string
][]
string
{
...
...
src/utils/vari/var.go
浏览文件 @
a0d8c448
...
...
@@ -37,6 +37,9 @@ var (
RandFieldNameToValuesMap
=
map
[
string
]
map
[
string
]
interface
{}{}
TopFiledMap
=
map
[
string
]
model
.
DefField
{}
CacheResFileToMap
=
map
[
string
]
map
[
string
][]
string
{}
CacheResFileToName
=
map
[
string
]
string
{}
DefaultDir
string
ConfigDir
string
)
yaml/base/domain/domain.v1.yaml
浏览文件 @
a0d8c448
...
...
@@ -5,14 +5,166 @@ version: 1.0
field
:
domain
instances
:
-
instance
:
esp
note
:
服务商
域名
-
instance
:
one_number_at_common
note
:
单数字
域名
fields
:
-
field
:
part1
range
:
[
qq.com
,
163.com
,
263.net
,
aliyun.com
,
126.com
,
gmail.com
,
outlook.com
,
hotmail.com
]
-
instance
:
self
note
:
自定义域名
range
:
1-9
rand
:
true
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
all
-
instance
:
one_number_at_cn
note
:
单数字CN域名
prefix
:
fields
:
-
field
:
part1
range
:
[
zentao.com
,
easycorp.cn
,
ztf.im
,
zd.im
]
\ No newline at end of file
range
:
1-9
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
cn
-
instance
:
one_number_at_new
note
:
单数字新域名
prefix
:
fields
:
-
field
:
part1
range
:
1-9
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
new
-
instance
:
one_letter_at_common
note
:
单字母域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
all
-
instance
:
one_letter_at_cn
note
:
单字母CN域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
cn
-
instance
:
one_letter_at_new
note
:
单字母新域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
new
-
instance
:
numbers_at_common
note
:
纯数字域名
prefix
:
fields
:
-
field
:
part1
range
:
0-9
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
all
-
instance
:
numbers_at_cn
note
:
纯数字CN域名
prefix
:
fields
:
-
field
:
part1
range
:
0-9
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
cn
-
instance
:
numbers_at_new
note
:
纯数字新域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
new
-
instance
:
letters_at_common
note
:
纯字母域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
all
-
instance
:
letters_at_cn
note
:
纯字母CN域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
cn
-
instance
:
letters_at_new
note
:
纯字母新域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
new
-
instance
:
mixed_at_common
note
:
字母和数字域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z,0-9
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
all
-
instance
:
mixed_at_cn
note
:
字母和数字CN域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z,0-9
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
cn
-
instance
:
mixed_at_new
note
:
字母和数字新域名
prefix
:
fields
:
-
field
:
part1
range
:
a-z,0-9
loop
:
5-8
postfix
:
"
."
-
field
:
part2
from
:
base.domain.postfix.v1.yaml
use
:
new
\ No newline at end of file
yaml/base/domain/esp.v1.yaml
0 → 100644
浏览文件 @
a0d8c448
title
:
域名
desc
:
author
:
zentao
version
:
1.0
field
:
esp
instances
:
-
instance
:
esp
note
:
服务商域名
fields
:
-
field
:
part1
range
:
[
qq.com
,
163.com
,
263.net
,
aliyun.com
,
126.com
,
gmail.com
,
outlook.com
,
hotmail.com
]
\ No newline at end of file
yaml/base/domain/postfix.v1.yaml
浏览文件 @
a0d8c448
...
...
@@ -6,7 +6,7 @@ version: 1.0
field
:
domain_postfix
note
:
域名后缀
ranges
:
common
:
[
com
,
net
,
org
,
cn
,
cc
,
co
,
im
,
io
]
common
:
[
com
,
net
,
org
,
cn
,
cc
,
co
,
im
,
io
]
:R
cn
:
[
cn
,
org.cn
,
net.cn
,
com.cn
,
gov.cn
]
new
:
[
app
,
ai
,
site
,
xyz
,
ltd
,
ren
,
wang
,
vip
,
top
]
country
:
[
cn
,
im
,
tv
,
cc
,
io
,
la
]
\ No newline at end of file
yaml/base/
domain/domain.name
.v1.yaml
→
yaml/base/
email/email
.v1.yaml
浏览文件 @
a0d8c448
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录