提交 559b4cb3 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

close task#7619,7620

上级 389500c7
...@@ -43,7 +43,7 @@ fields: ...@@ -43,7 +43,7 @@ fields:
use: large{3} use: large{3}
- field: field_use_yaml - field: field_use_yaml
range: 9-7,test/nested1.yaml{5} range: 测试,测,9-7,test/nested1.yaml{5}
# rand: true # rand: true
prefix: "***" prefix: "***"
postfix: "***\t" postfix: "***\t"
......
title: 测试文件
desc:
author: zentao
version: 1.0
fields:
- field: test1
from: base.name.letters.v1.yaml
use: letters
postfix: "\t"
- field: test2
from: base.name.numbers.v1.yaml
use: numbers
postfix: "\t"
\ No newline at end of file
...@@ -71,6 +71,10 @@ ...@@ -71,6 +71,10 @@
"id": "fail_to_parse_ranges", "id": "fail_to_parse_ranges",
"translation": "%s is not ResRanges format, try to parse as ResInsts." "translation": "%s is not ResRanges format, try to parse as ResInsts."
}, },
{
"id": "fail_to_find_res",
"translation": "Fail to load resource from %s."
},
{ {
"id": "generate_records", "id": "generate_records",
......
...@@ -66,6 +66,10 @@ ...@@ -66,6 +66,10 @@
"id": "fail_to_parse_ranges", "id": "fail_to_parse_ranges",
"translation": "%s不是ResRanges格式,尝试解析为ResInsts对象。" "translation": "%s不是ResRanges格式,尝试解析为ResInsts对象。"
}, },
{
"id": "fail_to_find_res",
"translation": "加载资源%s失败."
},
{ {
"id": "generate_records", "id": "generate_records",
......
...@@ -4,7 +4,9 @@ import ( ...@@ -4,7 +4,9 @@ import (
"github.com/easysoft/zendata/res" "github.com/easysoft/zendata/res"
commonUtils "github.com/easysoft/zendata/src/utils/common" commonUtils "github.com/easysoft/zendata/src/utils/common"
constant "github.com/easysoft/zendata/src/utils/const" constant "github.com/easysoft/zendata/src/utils/const"
i118Utils "github.com/easysoft/zendata/src/utils/i118"
"github.com/easysoft/zendata/src/utils/vari" "github.com/easysoft/zendata/src/utils/vari"
"github.com/fatih/color"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec" "os/exec"
...@@ -188,14 +190,15 @@ func ConvertResYamlPath(from string) (ret string) { ...@@ -188,14 +190,15 @@ func ConvertResYamlPath(from string) (ret string) {
} }
file := strings.Join(arr[i:], ".") file := strings.Join(arr[i:], ".")
relatPath := ""
if dir != "" { if dir != "" {
ret = dir + constant.PthSep + file relatPath = dir + constant.PthSep + file
} else { } else {
ret = file relatPath = file
} }
realPth1 := vari.WorkDir + constant.ResDirYaml + constant.PthSep + ret realPth1 := vari.WorkDir + constant.ResDirYaml + constant.PthSep + relatPath
realPth2 := vari.WorkDir + constant.ResDirUsers + constant.PthSep + ret realPth2 := vari.WorkDir + constant.ResDirUsers + constant.PthSep + relatPath
if FileExist(realPth1) { if FileExist(realPth1) {
ret = realPth1 ret = realPth1
break break
...@@ -205,6 +208,10 @@ func ConvertResYamlPath(from string) (ret string) { ...@@ -205,6 +208,10 @@ func ConvertResYamlPath(from string) (ret string) {
} }
} }
if ret == "" {
color.New(color.FgCyan).Fprintf(color.Output, i118Utils.I118Prt.Sprintf("fail_to_find_res", from) + "\n")
}
return return
} }
...@@ -224,13 +231,14 @@ func convertResExcelPath(from string) (ret, sheet string) { ...@@ -224,13 +231,14 @@ func convertResExcelPath(from string) (ret, sheet string) {
} }
file := strings.Join(arr[i:], ".") + ".xlsx" file := strings.Join(arr[i:], ".") + ".xlsx"
relatPath := ""
if dir != "" { if dir != "" {
ret = dir + constant.PthSep + file relatPath = dir + constant.PthSep + file
} else { } else {
ret = file relatPath = file
} }
realPth := vari.WorkDir + constant.ResDirData + constant.PthSep + ret realPth := vari.WorkDir + constant.ResDirData + constant.PthSep + relatPath
if FileExist(realPth) { if FileExist(realPth) {
if index == 1 { if index == 1 {
sheet = from[strings.LastIndex(from, ".")+1:] sheet = from[strings.LastIndex(from, ".")+1:]
...@@ -241,5 +249,9 @@ func convertResExcelPath(from string) (ret, sheet string) { ...@@ -241,5 +249,9 @@ func convertResExcelPath(from string) (ret, sheet string) {
} }
} }
if ret == "" {
color.New(color.FgCyan).Fprintf(color.Output, i118Utils.I118Prt.Sprintf("fail_to_find_res", from) + "\n")
}
return return
} }
\ No newline at end of file
title: 数字账号
desc:
author: zentao
version: 1.0
field: account_numbers
instances:
- instance: 1_number
note: 单个数字
prefix:
fields:
- field: part1
range: 0-9
- instance: 2_numbers
note: 两个数字
prefix:
fields:
- field: part1
range: 0-9
loop: 2
- instance: 3_numbers
note: 三个数字
prefix:
fields:
- field: part1
range: 0-9
loop: 3
- instance: 4_numbers
note: 四个数字
prefix:
fields:
- field: part1
range: 0-9
loop: 4
- instance: numbers
note: 多个数字
prefix:
fields:
- field: part1
range: 0-9
loop: 5-100
rand: true
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册