提交 9ae01cc7 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

close task #7505

上级 acaaf54d
......@@ -21,7 +21,7 @@ fields:
postfix: "]" # 特殊字符加引号,否则无法解析
- field: field_nested_range # 引用的range使用多层嵌套的use定义
from: system.misc.number.yaml # 引用data/system/misc/number.yaml
from: custom.number.v1.yaml # 引用data/system/misc/number.yaml
use: all # 使用该文件中定义的privateC和privateB两个实例。
prefix: "[" # 复写前缀
postfix: "]" # 特殊字符加引号,否则无法解析
......
......@@ -95,7 +95,15 @@
},
{
"id": "start_server",
"translation": "Success yo start zendata http service, press CTRL+C to exist. \nYou may use http://%s:%s to retrieve the data,for example: \n curl http://%s:%s/?default=demo/default.yaml&config=demo/test.yaml&lines=100."
"translation": "Success yo start zendata http service, press CTRL+C to exist. \nYou may use http://%s:%s to retrieve the data,for example: \ncurl http://%s:%s/?config=demo/default.yaml&F=field_common&lines=10."
},
{
"id": "server_request",
"translation": "\nGot %s request %s."
},
{
"id": "server_response",
"translation": "\nCreate %d records in %d sec."
},
{
"id": "excel_data",
......
......@@ -86,7 +86,15 @@
},
{
"id": "start_server",
"translation": "zendata http服务已经成功运行,按CTRL+C键推出。\n您可以通过http://%s:%s地址来调用,比如:\n curl http://%s:%s/?default=demo/default.yaml&config=demo/test.yaml&lines=100."
"translation": "zendata http服务已经成功运行,按CTRL+C键推出。\n您可以通过http://%s:%s地址来调用,比如:\ncurl http://%s:%s/?config=demo/default.yaml&F=field_common&lines=10。"
},
{
"id": "server_request",
"translation": "\n收到%s请求 %s."
},
{
"id": "server_response",
"translation": "生成%d条记录,耗时%d秒"
},
{
"id": "excel_data",
......
......@@ -7,13 +7,15 @@ import (
"github.com/easysoft/zendata/src/gen"
"github.com/easysoft/zendata/src/model"
constant "github.com/easysoft/zendata/src/utils/const"
i118Utils "github.com/easysoft/zendata/src/utils/i118"
logUtils "github.com/easysoft/zendata/src/utils/log"
"github.com/easysoft/zendata/src/utils/vari"
"strings"
"time"
)
func Generate(defaultFile string, configFile string, total int, fieldsToExportStr string, out string, format string, table string) {
//startTime := time.Now().Unix()
startTime := time.Now().Unix()
if defaultFile != "" && configFile == "" {
configFile = defaultFile
......@@ -35,8 +37,10 @@ func Generate(defaultFile string, configFile string, total int, fieldsToExportSt
WriteToFile(out, content)
}
//entTime := time.Now().Unix()
//logUtils.Screen(i118Utils.I118Prt.Sprintf("generate_records", len(rows), out, entTime - startTime ))
entTime := time.Now().Unix()
if vari.RunMode == constant.RunModeServerRequest {
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("server_response", len(rows), entTime - startTime))
}
}
func Print(rows [][]string, format string, table string, colTypes []bool, fields []string) (string, string) {
......@@ -51,7 +55,9 @@ func Print(rows [][]string, format string, table string, colTypes []bool, fields
line += vari.HeadSep
}
}
logUtils.Screen(fmt.Sprintf("%s", line))
if vari.RunMode != constant.RunModeServerRequest {
logUtils.Screen(fmt.Sprintf("%s", line))
}
content += line + "\n"
}
......@@ -82,7 +88,9 @@ func Print(rows [][]string, format string, table string, colTypes []bool, fields
content = content + line + "\n"
}
logUtils.Screen(fmt.Sprintf("%s", line))
if vari.RunMode != constant.RunModeServerRequest {
logUtils.Screen(fmt.Sprintf("%s", line))
}
testData.Table.Rows = append(testData.Table.Rows, row)
......
......@@ -194,6 +194,8 @@ func StartServer() {
}
func DataHandler(w http.ResponseWriter, req *http.Request) {
root, defaultFile, configFile, fields, count, vari.HeadSep,
format, table, decode, input, output = service.ParseRequestParams(req)
......@@ -202,6 +204,7 @@ func DataHandler(w http.ResponseWriter, req *http.Request) {
fmt.Fprintln(w, vari.JsonResp)
} else if defaultFile != "" || configFile != "" {
vari.RunMode = constant.RunModeServerRequest
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("server_request", req.Method, req.URL))
toGen()
fmt.Fprintln(w, vari.JsonResp)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册