Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
3db2aa30
Z
zendata
项目概览
易企天创
/
zendata
10 个月 前同步成功
通知
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 搜索 >>
提交
3db2aa30
编写于
8月 11, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue#3353
上级
873a2588
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
6 deletion
+11
-6
src/gen/decode.go
src/gen/decode.go
+10
-4
src/utils/file/file.go
src/utils/file/file.go
+1
-2
未找到文件。
src/gen/decode.go
浏览文件 @
3db2aa30
...
...
@@ -8,7 +8,7 @@ import (
i118Utils
"github.com/easysoft/zendata/src/utils/i118"
logUtils
"github.com/easysoft/zendata/src/utils/log"
"github.com/easysoft/zendata/src/utils/vari"
"
github.com/mattn/go-runewidth
"
"
log
"
"strings"
)
...
...
@@ -17,6 +17,11 @@ const (
)
func
Decode
(
defaultFile
,
configFile
,
fieldsToExportStr
,
input
,
output
string
)
{
vari
.
DefaultDir
=
fileUtils
.
GetAbsDir
(
defaultFile
)
vari
.
ConfigDir
=
fileUtils
.
GetAbsDir
(
configFile
)
vari
.
Total
=
10
fieldsToExport
:=
make
([]
string
,
0
)
if
fieldsToExportStr
!=
""
{
fieldsToExport
=
strings
.
Split
(
fieldsToExportStr
,
","
)
...
...
@@ -27,7 +32,7 @@ func Decode(defaultFile, configFile, fieldsToExportStr, input, output string) {
data
:=
fileUtils
.
ReadFile
(
input
)
ret
:=
[]
map
[
string
]
interface
{}
{}
var
ret
[]
map
[
string
]
interface
{}
LinesToMap
(
data
,
fieldsToExport
,
&
ret
)
jsonObj
,
_
:=
json
.
Marshal
(
ret
)
vari
.
JsonResp
=
string
(
jsonObj
)
...
...
@@ -78,8 +83,9 @@ func decodeOneLevel(line string, fields []model.DefField, rowMap *map[string]int
if
len
(
sep
)
>
0
{
index
:=
searchRune
(
left
,
sep
)
if
index
>
-
1
{
col
=
string
(
left
[
:
index
+
runewidth
.
StringWidth
(
field
.
Postfix
)])
left
=
left
[
index
+
runewidth
.
StringWidth
(
field
.
Prefix
)
+
1
:
]
col
=
string
(
left
[
:
index
+
len
(
field
.
Postfix
)])
left
=
left
[
index
+
len
(
field
.
Postfix
)
:
]
log
.
Println
(
left
)
}
}
else
if
j
==
len
(
fields
)
-
1
{
col
=
string
(
left
)
...
...
src/utils/file/file.go
浏览文件 @
3db2aa30
package
fileUtils
import
(
"fmt"
"github.com/easysoft/zendata/res"
commonUtils
"github.com/easysoft/zendata/src/utils/common"
constant
"github.com/easysoft/zendata/src/utils/const"
...
...
@@ -129,7 +128,7 @@ func GetExeDir() string { // where zd.exe file in
dir
,
_
=
filepath
.
Abs
(
dir
)
dir
=
AddSepIfNeeded
(
dir
)
fmt
.
Printf
(
"Debug: Launch %s in %s
\n
"
,
arg1
,
dir
)
//
fmt.Printf("Debug: Launch %s in %s \n", arg1, dir)
return
dir
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录