Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
2125f03a
Z
zendata
项目概览
易企天创
/
zendata
11 个月 前同步成功
通知
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 搜索 >>
提交
2125f03a
编写于
11月 24, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
convert refer path related to current zendata work dir
上级
7b46fb1d
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
29 addition
and
28 deletion
+29
-28
src/server/service/config.go
src/server/service/config.go
+3
-3
src/server/service/def.go
src/server/service/def.go
+1
-1
src/server/service/excel.go
src/server/service/excel.go
+2
-2
src/server/service/instances.go
src/server/service/instances.go
+3
-3
src/server/service/ranges.go
src/server/service/ranges.go
+3
-3
src/server/service/text.go
src/server/service/text.go
+3
-3
src/service/list.go
src/service/list.go
+13
-9
tmp/cache/.data.db
tmp/cache/.data.db
+0
-0
users/test/dir/content.yaml
users/test/dir/content.yaml
+1
-1
yaml/zentao/users.txt
yaml/zentao/users.txt
+0
-3
未找到文件。
src/server/service/config.go
浏览文件 @
2125f03a
...
...
@@ -38,7 +38,7 @@ func (s *ConfigService) Get(id int) (config model.ZdConfig, dirs []model.Dir) {
func
(
s
*
ConfigService
)
Save
(
config
*
model
.
ZdConfig
)
(
err
error
)
{
config
.
Folder
=
serverUtils
.
DealWithPathSepRight
(
config
.
Folder
)
config
.
Path
=
vari
.
WorkDir
+
config
.
Folder
+
serverUtils
.
AddExt
(
config
.
FileName
,
".yaml"
)
config
.
ReferName
=
service
.
PathToName
(
config
.
Path
,
constant
.
ResDirYaml
)
config
.
ReferName
=
service
.
PathToName
(
config
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeConfig
)
if
config
.
ID
==
0
{
err
=
s
.
Create
(
config
)
...
...
@@ -139,9 +139,9 @@ func (s *ConfigService) SyncToDB(fi model.ResFile) (err error) {
po
.
Path
=
fi
.
Path
po
.
Folder
=
serverUtils
.
GetRelativePath
(
po
.
Path
)
if
strings
.
Index
(
po
.
Path
,
constant
.
ResDirYaml
)
>
-
1
{
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirYaml
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeConfig
)
}
else
{
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
,
constant
.
ResTypeConfig
)
}
po
.
FileName
=
fileUtils
.
GetFileName
(
po
.
Path
)
po
.
Yaml
=
string
(
content
)
...
...
src/server/service/def.go
浏览文件 @
2125f03a
...
...
@@ -158,7 +158,7 @@ func (s *DefService) SyncToDB(fi model.ResFile) (err error) {
po
.
Path
=
fi
.
Path
po
.
Folder
=
serverUtils
.
GetRelativePath
(
po
.
Path
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
,
po
.
Type
)
po
.
FileName
=
fileUtils
.
GetFileName
(
po
.
Path
)
po
.
Yaml
=
string
(
content
)
...
...
src/server/service/excel.go
浏览文件 @
2125f03a
...
...
@@ -33,7 +33,7 @@ func (s *ExcelService) Get(id int) (excel model.ZdExcel, dirs []model.Dir) {
func
(
s
*
ExcelService
)
Save
(
excel
*
model
.
ZdExcel
)
(
err
error
)
{
excel
.
Folder
=
serverUtils
.
DealWithPathSepRight
(
excel
.
Folder
)
excel
.
Path
=
vari
.
WorkDir
+
excel
.
Folder
+
serverUtils
.
AddExt
(
excel
.
FileName
,
".xlsx"
)
excel
.
ReferName
=
service
.
PathToName
(
excel
.
Path
,
constant
.
ResDirData
)
excel
.
ReferName
=
service
.
PathToName
(
excel
.
Path
,
constant
.
ResDirData
,
constant
.
ResTypeExcel
)
if
excel
.
ID
==
0
{
// excel should not be create on webpage
...
...
@@ -99,7 +99,7 @@ func (s *ExcelService) SyncToDB(file model.ResFile) (err error) {
Sheet
:
file
.
Title
,
Path
:
file
.
Path
,
Folder
:
serverUtils
.
GetRelativePath
(
file
.
Path
),
ReferName
:
service
.
PathToName
(
file
.
Path
,
constant
.
ResDirData
),
ReferName
:
service
.
PathToName
(
file
.
Path
,
constant
.
ResDirData
,
constant
.
ResTypeExcel
),
FileName
:
fileUtils
.
GetFileName
(
file
.
Path
),
}
s
.
excelRepo
.
Create
(
&
excel
)
...
...
src/server/service/instances.go
浏览文件 @
2125f03a
...
...
@@ -37,7 +37,7 @@ func (s *InstancesService) Get(id int) (instances model.ZdInstances, dirs []mode
func
(
s
*
InstancesService
)
Save
(
instances
*
model
.
ZdInstances
)
(
err
error
)
{
instances
.
Folder
=
serverUtils
.
DealWithPathSepRight
(
instances
.
Folder
)
instances
.
Path
=
vari
.
WorkDir
+
instances
.
Folder
+
serverUtils
.
AddExt
(
instances
.
FileName
,
".yaml"
)
instances
.
ReferName
=
service
.
PathToName
(
instances
.
Path
,
constant
.
ResDirYaml
)
instances
.
ReferName
=
service
.
PathToName
(
instances
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeInstances
)
if
instances
.
ID
==
0
{
err
=
s
.
Create
(
instances
)
...
...
@@ -147,9 +147,9 @@ func (s *InstancesService) SyncToDB(file model.ResFile) (err error) {
po
.
Path
=
file
.
Path
po
.
Folder
=
serverUtils
.
GetRelativePath
(
po
.
Path
)
if
strings
.
Index
(
po
.
Path
,
constant
.
ResDirYaml
)
>
-
1
{
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirYaml
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeInstances
)
}
else
{
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
,
constant
.
ResTypeInstances
)
}
po
.
FileName
=
fileUtils
.
GetFileName
(
po
.
Path
)
po
.
Yaml
=
string
(
content
)
...
...
src/server/service/ranges.go
浏览文件 @
2125f03a
...
...
@@ -36,7 +36,7 @@ func (s *RangesService) Get(id int) (ranges model.ZdRanges, dirs []model.Dir) {
func
(
s
*
RangesService
)
Save
(
ranges
*
model
.
ZdRanges
)
(
err
error
)
{
ranges
.
Folder
=
serverUtils
.
DealWithPathSepRight
(
ranges
.
Folder
)
ranges
.
Path
=
vari
.
WorkDir
+
ranges
.
Folder
+
serverUtils
.
AddExt
(
ranges
.
FileName
,
".yaml"
)
ranges
.
ReferName
=
service
.
PathToName
(
ranges
.
Path
,
constant
.
ResDirYaml
)
ranges
.
ReferName
=
service
.
PathToName
(
ranges
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeRanges
)
if
ranges
.
ID
==
0
{
err
=
s
.
Create
(
ranges
)
...
...
@@ -111,9 +111,9 @@ func (s *RangesService) SyncToDB(fi model.ResFile) (err error) {
po
.
Path
=
fi
.
Path
po
.
Folder
=
serverUtils
.
GetRelativePath
(
po
.
Path
)
if
strings
.
Index
(
po
.
Path
,
constant
.
ResDirYaml
)
>
-
1
{
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirYaml
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeRanges
)
}
else
{
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
)
po
.
ReferName
=
service
.
PathToName
(
po
.
Path
,
constant
.
ResDirUsers
,
constant
.
ResTypeRanges
)
}
po
.
FileName
=
fileUtils
.
GetFileName
(
po
.
Path
)
po
.
Yaml
=
string
(
content
)
...
...
src/server/service/text.go
浏览文件 @
2125f03a
...
...
@@ -34,7 +34,7 @@ func (s *TextService) Get(id int) (text model.ZdText, dirs []model.Dir) {
func
(
s
*
TextService
)
Save
(
text
*
model
.
ZdText
)
(
err
error
)
{
text
.
Folder
=
serverUtils
.
DealWithPathSepRight
(
text
.
Folder
)
text
.
Path
=
vari
.
WorkDir
+
text
.
Folder
+
serverUtils
.
AddExt
(
text
.
FileName
,
".txt"
)
text
.
ReferName
=
service
.
PathToName
(
text
.
Path
,
constant
.
ResDirYaml
)
text
.
ReferName
=
service
.
PathToName
(
text
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeText
)
if
text
.
ID
==
0
{
err
=
s
.
Create
(
text
)
...
...
@@ -109,9 +109,9 @@ func (s *TextService) SyncToDB(file model.ResFile) (err error) {
FileName
:
fileUtils
.
GetFileName
(
file
.
Path
),
}
if
strings
.
Index
(
text
.
Path
,
constant
.
ResDirYaml
)
>
-
1
{
text
.
ReferName
=
service
.
PathToName
(
text
.
Path
,
constant
.
ResDirYaml
)
text
.
ReferName
=
service
.
PathToName
(
text
.
Path
,
constant
.
ResDirYaml
,
constant
.
ResTypeText
)
}
else
{
text
.
ReferName
=
service
.
PathToName
(
text
.
Path
,
constant
.
ResDirUsers
)
text
.
ReferName
=
service
.
PathToName
(
text
.
Path
,
constant
.
ResDirUsers
,
constant
.
ResTypeText
)
}
text
.
Content
=
fileUtils
.
ReadFile
(
file
.
Path
)
...
...
src/service/list.go
浏览文件 @
2125f03a
...
...
@@ -35,7 +35,6 @@ func LoadRes(resType string) (res map[string][]model.ResFile, nameWidth, titleWi
for
_
,
item
:=
range
res
[
key
]
{
pth
:=
item
.
Path
fileExt
:=
path
.
Ext
(
pth
)
name
:=
PathToName
(
pth
,
key
)
isArticleFiles
:=
false
var
title
,
desc
,
tp
string
...
...
@@ -51,12 +50,12 @@ func LoadRes(resType string) (res map[string][]model.ResFile, nameWidth, titleWi
}
}
item
.
ReferName
=
name
item
.
ReferName
=
PathToName
(
pth
,
key
,
tp
)
item
.
Title
=
title
item
.
Desc
=
desc
item
.
ResType
=
tp
lent
:=
runewidth
.
StringWidth
(
n
ame
)
lent
:=
runewidth
.
StringWidth
(
item
.
ReferN
ame
)
if
lent
>
nameWidth
{
nameWidth
=
lent
}
...
...
@@ -199,18 +198,23 @@ func ReadExcelInfo(path string) (title, desc, resType string) {
}
func
ReadTextInfo
(
path
,
key
string
)
(
title
,
desc
,
resType
string
)
{
title
=
PathToName
(
path
,
key
)
title
=
PathToName
(
path
,
key
,
constant
.
ResTypeText
)
desc
=
i118Utils
.
I118Prt
.
Sprintf
(
"text_data"
)
resType
=
constant
.
ResTypeText
return
}
func
PathToName
(
path
,
key
string
)
string
{
name
:=
strings
.
ReplaceAll
(
path
,
constant
.
PthSep
,
"."
)
sep
:=
"."
+
key
+
"."
name
=
name
[
strings
.
Index
(
name
,
sep
)
+
len
(
sep
)
:
]
func
PathToName
(
path
,
key
,
tp
string
)
string
{
nameSep
:=
"/"
if
tp
!=
constant
.
ResTypeText
&&
tp
!=
constant
.
ResTypeYaml
&&
tp
!=
constant
.
ResTypeConfig
{
nameSep
=
"."
}
path
=
strings
.
ReplaceAll
(
path
,
constant
.
PthSep
,
nameSep
)
sep
:=
nameSep
+
key
+
nameSep
name
:=
path
[
strings
.
Index
(
path
,
sep
)
+
len
(
sep
)
:
]
if
key
==
constant
.
ResDirData
{
// remove .xlsx postfix
name
=
name
[
:
strings
.
LastIndex
(
name
,
"."
)]
name
=
name
[
:
strings
.
LastIndex
(
name
,
nameSep
)]
}
return
name
...
...
tmp/cache/.data.db
浏览文件 @
2125f03a
无法预览此类型文件
users/test/dir/content.yaml
浏览文件 @
2125f03a
title
:
内容被引用
title
:
被引用测试
desc
:
author
:
zentao
version
:
1.0
...
...
yaml/zentao/users.txt
已删除
100644 → 0
浏览文件 @
7b46fb1d
aaron
ben
carl
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录