Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
18ca3751
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 搜索 >>
提交
18ca3751
编写于
12月 29, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix package issue issues
上级
271fcfe0
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
59 addition
and
63 deletion
+59
-63
.zd.conf
.zd.conf
+1
-1
Makefile
Makefile
+1
-1
cmd/command/main.go
cmd/command/main.go
+48
-2
cmd/server/main.go
cmd/server/main.go
+0
-47
internal/pkg/const/const.go
internal/pkg/const/const.go
+3
-4
internal/server/config/config.go
internal/server/config/config.go
+0
-2
internal/server/core/web/index.go
internal/server/core/web/index.go
+1
-2
pkg/utils/vari/var.go
pkg/utils/vari/var.go
+0
-1
res/en/usage.txt
res/en/usage.txt
+1
-1
res/zh/usage.txt
res/zh/usage.txt
+1
-1
ui/src/utils/request.js
ui/src/utils/request.js
+3
-1
未找到文件。
.zd.conf
浏览文件 @
18ca3751
Version
=
2
.
2
Version
=
2
.
3
Language
=
zh
Makefile
浏览文件 @
18ca3751
VERSION
=
3.0
VERSION
=
2.3
PROJECT
=
zd
QINIU_DIR
=
/Users/aaron/work/zentao/qiniu/
QINIU_DIST_DIR
=
${QINIU_DIR}${PROJECT}
/
${VERSION}
/
...
...
cmd/command/main.go
浏览文件 @
18ca3751
...
...
@@ -8,7 +8,11 @@ import (
consts
"github.com/easysoft/zendata/internal/pkg/const"
"github.com/easysoft/zendata/internal/pkg/gen"
"github.com/easysoft/zendata/internal/pkg/helper"
serverConfig
"github.com/easysoft/zendata/internal/server/config"
"github.com/easysoft/zendata/internal/server/core/web"
serverConst
"github.com/easysoft/zendata/internal/server/utils/const"
fileUtils
"github.com/easysoft/zendata/pkg/utils/file"
i118Utils
"github.com/easysoft/zendata/pkg/utils/i118"
logUtils
"github.com/easysoft/zendata/pkg/utils/log"
"github.com/easysoft/zendata/pkg/utils/vari"
"github.com/fatih/color"
...
...
@@ -43,6 +47,9 @@ var (
help
bool
set
bool
isStartServer
bool
uuid
=
""
flagSet
*
flag
.
FlagSet
)
...
...
@@ -117,8 +124,8 @@ func main() {
flagSet
.
StringVar
(
&
vari
.
GlobalVars
.
Table
,
"t"
,
""
,
""
)
flagSet
.
StringVar
(
&
vari
.
GlobalVars
.
Table
,
"table"
,
""
,
""
)
flagSet
.
StringVar
(
&
vari
.
GlobalVars
.
DBDsn
,
"dsn"
,
""
,
""
)
flagSet
.
StringVar
(
&
vari
.
GlobalVars
.
DBType
,
"
s"
,
"mysql
"
,
""
)
flagSet
.
StringVar
(
&
vari
.
GlobalVars
.
DBType
,
"server"
,
"mysql"
,
""
)
flagSet
.
StringVar
(
&
vari
.
GlobalVars
.
DBType
,
"
db"
,
"db
"
,
""
)
flagSet
.
StringVar
(
&
vari
.
GlobalVars
.
DBType
,
"server"
,
"mysql"
,
""
)
// TODO: will remove
flagSet
.
BoolVar
(
&
vari
.
GlobalVars
.
DBClear
,
"clear"
,
false
,
""
)
flagSet
.
StringVar
(
&
vari
.
ProtoCls
,
"cls"
,
""
,
""
)
...
...
@@ -128,6 +135,22 @@ func main() {
flagSet
.
BoolVar
(
&
help
,
"h"
,
false
,
""
)
flagSet
.
BoolVar
(
&
help
,
"help"
,
false
,
""
)
// for server
flagSet
.
BoolVar
(
&
isStartServer
,
"s"
,
false
,
"启动服务"
)
flagSet
.
StringVar
(
&
uuid
,
"uuid"
,
""
,
"区分服务进程的唯一ID"
)
flagSet
.
IntVar
(
&
vari
.
DataServicePort
,
"p"
,
8848
,
""
)
flagSet
.
IntVar
(
&
vari
.
DataServicePort
,
"port"
,
0
,
""
)
flagSet
.
Parse
(
os
.
Args
[
1
:
])
if
isStartServer
{
startServer
()
}
else
{
execCommand
()
}
}
func
execCommand
()
{
if
len
(
os
.
Args
)
==
1
{
os
.
Args
=
append
(
os
.
Args
,
"-help"
)
}
...
...
@@ -150,6 +173,29 @@ func main() {
}
}
func
startServer
()
{
configUtils
.
InitConfig
(
""
)
vari
.
DB
,
_
=
serverConfig
.
NewGormDB
()
vari
.
AgentLogDir
=
vari
.
ZdPath
+
serverConst
.
AgentLogDir
+
consts
.
PthSep
err
:=
fileUtils
.
MkDirIfNeeded
(
vari
.
AgentLogDir
)
if
err
!=
nil
{
logUtils
.
PrintToWithColor
(
i118Utils
.
I118Prt
.
Sprintf
(
"perm_deny"
,
vari
.
AgentLogDir
),
color
.
FgRed
)
os
.
Exit
(
1
)
}
if
vari
.
DataServicePort
==
0
{
vari
.
DataServicePort
=
consts
.
DefaultDataServicePort
}
webServer
:=
web
.
Init
()
if
webServer
==
nil
{
return
}
webServer
.
Run
()
}
func
opts
(
files
[]
string
)
{
if
exportFields
!=
""
{
vari
.
GlobalVars
.
ExportFields
=
strings
.
Split
(
exportFields
,
","
)
...
...
cmd/server/main.go
浏览文件 @
18ca3751
...
...
@@ -2,12 +2,8 @@ package main
import
(
"flag"
"fmt"
zd
"github.com/easysoft/zendata"
"github.com/easysoft/zendata/internal/agent"
configUtils
"github.com/easysoft/zendata/internal/pkg/config"
consts
"github.com/easysoft/zendata/internal/pkg/const"
"github.com/easysoft/zendata/internal/server"
serverConfig
"github.com/easysoft/zendata/internal/server/config"
"github.com/easysoft/zendata/internal/server/core/web"
serverConst
"github.com/easysoft/zendata/internal/server/utils/const"
...
...
@@ -17,10 +13,8 @@ import (
logUtils
"github.com/easysoft/zendata/pkg/utils/log"
"github.com/easysoft/zendata/pkg/utils/vari"
"github.com/fatih/color"
"net/http"
"os"
"os/signal"
"strconv"
"syscall"
)
...
...
@@ -65,33 +59,6 @@ func main() {
vari
.
DataServicePort
=
consts
.
DefaultDataServicePort
}
//go func() {
// startDataServer()
//}()
startServer
()
}
func
startDataServer
()
{
port
:=
strconv
.
Itoa
(
vari
.
DataServicePort
)
logUtils
.
PrintToWithColor
(
i118Utils
.
I118Prt
.
Sprintf
(
"start_server"
,
vari
.
Ip
,
port
,
vari
.
Ip
,
port
,
vari
.
Ip
,
port
),
color
.
FgCyan
)
config
:=
serverConfig
.
NewConfig
()
server
,
err
:=
server
.
InitServer
(
config
)
if
err
!=
nil
{
logUtils
.
PrintToWithColor
(
i118Utils
.
I118Prt
.
Sprintf
(
"start_server_fail"
,
port
),
color
.
FgRed
)
}
httpServer
:=
&
http
.
Server
{
Addr
:
fmt
.
Sprintf
(
":%d"
,
server
.
Config
.
ServerPort
),
Handler
:
dataHandler
(
server
),
}
httpServer
.
ListenAndServe
()
}
func
startServer
()
{
webServer
:=
web
.
Init
()
if
webServer
==
nil
{
return
...
...
@@ -100,20 +67,6 @@ func startServer() {
webServer
.
Run
()
}
func
dataHandler
(
server
*
server
.
Server
)
http
.
Handler
{
mux
:=
http
.
NewServeMux
()
uiFs
,
err
:=
zd
.
GetUiFileSys
()
if
err
!=
nil
{
panic
(
err
)
}
mux
.
Handle
(
"/"
,
http
.
FileServer
(
http
.
FS
(
uiFs
)))
mux
.
HandleFunc
(
"/data"
,
agent
.
DataHandler
)
return
mux
}
func
init
()
{
cleanup
()
}
...
...
internal/pkg/const/const.go
浏览文件 @
18ca3751
...
...
@@ -68,10 +68,9 @@ var (
RightBrackets
rune
=
')'
Backtick
rune
=
'`'
DefaultDataServicePort
=
8848
DefaultAdminServicePort
=
8085
DefaultRoot
=
"./"
DefaultNumber
=
10
DefaultDataServicePort
=
8848
DefaultRoot
=
"./"
DefaultNumber
=
10
ResDirData
=
"data"
ResDirYaml
=
"yaml"
...
...
internal/server/config/config.go
浏览文件 @
18ca3751
...
...
@@ -5,13 +5,11 @@ import (
)
type
Config
struct
{
ServerIP
string
ServerPort
int
}
func
NewConfig
()
*
Config
{
return
&
Config
{
ServerIP
:
vari
.
Ip
,
ServerPort
:
vari
.
DataServicePort
,
}
}
internal/server/core/web/index.go
浏览文件 @
18ca3751
...
...
@@ -4,7 +4,6 @@ import (
stdContext
"context"
"fmt"
zd
"github.com/easysoft/zendata"
consts
"github.com/easysoft/zendata/internal/pkg/const"
"github.com/easysoft/zendata/internal/server"
"github.com/easysoft/zendata/internal/server/core/module"
logUtils
"github.com/easysoft/zendata/pkg/utils/log"
...
...
@@ -51,7 +50,7 @@ func Init() *WebServer {
mvc
.
New
(
app
)
addr
:=
fmt
.
Sprintf
(
":%d"
,
consts
.
DefaultAdmin
ServicePort
)
addr
:=
fmt
.
Sprintf
(
":%d"
,
vari
.
Data
ServicePort
)
webServer
:=
&
WebServer
{
app
:
app
,
...
...
pkg/utils/vari/var.go
浏览文件 @
18ca3751
...
...
@@ -78,7 +78,6 @@ var (
ProtoCls
string
JsonResp
string
=
"[]"
Ip
string
DataServicePort
int
ResLoading
=
false
...
...
res/en/usage.txt
浏览文件 @
18ca3751
...
...
@@ -6,7 +6,7 @@ Parameters:
-c --config The current config file for data format, and it can override the config in the default file.
-o --output The file name of the data generated. You can specify the output format by the extension name.
For example json, xml, sql, csv and xlsx. The text data in the original format is output by default.
Note: For SQL files, you can use --
server to specify a specific database type in Mysql\Oracle\
SqlServer.
Note: For SQL files, you can use --
db to specify a specific database type in Mysql,Oracle,
SqlServer.
-n --lines The number of lines of data to be generated. The default is 10.
-F --field This parameter can be used to specify the fields, separated by commas. The default is all fields.
...
...
res/zh/usage.txt
浏览文件 @
18ca3751
...
...
@@ -5,7 +5,7 @@ ZenData是一款通用的数据生成工具,您可以使用yaml文件来定义
-d --default 默认的数据格式配置文件。
-c --config 当前场景的数据格式配置文件,可以覆盖默认文件里面的设置。
-o --output 生成的数据的文件名。可通过扩展名指定输出json|xml|sql|csv|xlsx格式的数据。默认输出原始格式的文本数据。
注意:对于 SQL 文件,您可以使用 --
server 指定Mysql\Oracle\
SqlServer中具体的数据库类型。
注意:对于 SQL 文件,您可以使用 --
db 指定Mysql、Oracle、
SqlServer中具体的数据库类型。
-n --lines 要生成的记录条数,默认为10条。
-F --field 可通过该参数指定要输出的字段列表,用逗号分隔。 默认是所有的字段。
...
...
ui/src/utils/request.js
浏览文件 @
18ca3751
...
...
@@ -17,12 +17,14 @@ function initRequest(remoteUrl) {
function
getUrl
()
{
let
url
=
''
if
(
process
.
env
.
NODE_ENV
===
"
development
"
)
{
url
=
'
http://127.0.0.1:8
085
/api/v1
'
url
=
'
http://127.0.0.1:8
848
/api/v1
'
console
.
log
(
'
dev env, url is
'
+
url
)
}
else
{
const
location
=
unescape
(
window
.
location
.
href
);
url
=
location
.
split
(
'
#
'
)[
0
].
split
(
'
index.html
'
)[
0
];
console
.
log
(
'
prod env, url is
'
+
url
)
}
return
url
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录