diff --git a/.gitignore b/.gitignore index af4eb2b..06adcaf 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ $* env/ build/ develop-eggs/ -dist/ downloads/ eggs/ .eggs/ diff --git a/README.md b/README.md index 0bb4833..73c1b43 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ ## 打包exe 部署时,可以将python打包成exe。建议使用pyinstaller。 pip install pyinstaller - pyinstaller -F -c genCfgs.py + cd src && pyinstaller -F -c genCfgs.py ## 关于文件命名 ### excel文件名命名格式 diff --git a/config_excel/client/cfg_array_example1.json b/config_excel/client/cfg_array_example1.json new file mode 100644 index 0000000..0f64f9b --- /dev/null +++ b/config_excel/client/cfg_array_example1.json @@ -0,0 +1,288 @@ +[ + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ], + "desc":"从小城镇", + "id":1001, + "level":88, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":1.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ], + "desc":"有钱就可以买", + "id":1001, + "level":88, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":2.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ], + "desc":"有钱就可以买", + "id":1001, + "level":89, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":89.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ], + "desc":"有钱就可以买", + "id":1001, + "level":88, + "name":"黑切+蓝盾", + "str":"pos2", + "sub_level":88.9 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ], + "desc":"有钱就可以买", + "id":1001, + "level":89, + "name":"黑切+蓝盾", + "str":"pos2", + "sub_level":89.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ], + "desc":"有钱就可以买", + "id":1002, + "level":88, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":88.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ], + "desc":"有钱就可以买", + "id":1002, + "level":89, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":89.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ], + "desc":"有钱就可以买", + "id":1002, + "level":90, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":90.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ], + "desc":"有钱就可以买", + "id":1002, + "level":88, + "name":"黑切+蓝盾", + "str":"pos2", + "sub_level":88.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ], + "desc":"有钱就可以买", + "id":1002, + "level":89, + "name":"黑切+蓝盾", + "str":"pos2", + "sub_level":89.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ], + "desc":"有钱就可以买", + "id":1002, + "level":90, + "name":"黑切+蓝盾", + "str":"pos2", + "sub_level":90.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 902 + ] + ], + "desc":"有钱就可以买", + "id":1003, + "level":85, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":85.0 + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 903 + ] + ], + "desc":"有钱就可以买", + "id":1004, + "level":80, + "name":"黑切+蓝盾", + "str":"pos1", + "sub_level":80.0 + } +] \ No newline at end of file diff --git a/config_excel/client/cfg_array_example1.xml b/config_excel/client/cfg_array_example1.xml new file mode 100644 index 0000000..bb759b5 --- /dev/null +++ b/config_excel/client/cfg_array_example1.xml @@ -0,0 +1,289 @@ + + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 900 + + + 从小城镇 + 1001 + 88 + 黑切+蓝盾 + pos1 + 1 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 900 + + + 有钱就可以买 + 1001 + 88 + 黑切+蓝盾 + pos1 + 2 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 900 + + + 有钱就可以买 + 1001 + 89 + 黑切+蓝盾 + pos1 + 89 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 900 + + + 有钱就可以买 + 1001 + 88 + 黑切+蓝盾 + pos2 + 88.9 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 900 + + + 有钱就可以买 + 1001 + 89 + 黑切+蓝盾 + pos2 + 89 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 901 + + + 有钱就可以买 + 1002 + 88 + 黑切+蓝盾 + pos1 + 88 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 900 + + + 有钱就可以买 + 1002 + 89 + 黑切+蓝盾 + pos1 + 89 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 901 + + + 有钱就可以买 + 1002 + 90 + 黑切+蓝盾 + pos1 + 90 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 901 + + + 有钱就可以买 + 1002 + 88 + 黑切+蓝盾 + pos2 + 88 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 900 + + + 有钱就可以买 + 1002 + 89 + 黑切+蓝盾 + pos2 + 89 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 901 + + + 有钱就可以买 + 1002 + 90 + 黑切+蓝盾 + pos2 + 90 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 902 + + + 有钱就可以买 + 1003 + 85 + 黑切+蓝盾 + pos1 + 85 + + + + + 1 + 700 + + + 2 + 800 + + + 3 + 903 + + + 有钱就可以买 + 1004 + 80 + 黑切+蓝盾 + pos1 + 80 + + diff --git a/config_excel/client/cfg_array_example2.json b/config_excel/client/cfg_array_example2.json new file mode 100644 index 0000000..b1a0e2d --- /dev/null +++ b/config_excel/client/cfg_array_example2.json @@ -0,0 +1,242 @@ +[ + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ], + { + "add":[ + 4, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "num":3, + "type":2 + }, + "desc":[ + "来源1", + "来源2", + "来源4" + ], + "id":1.0, + "material":[ + { + "count":1, + "id":10001, + "res":1 + }, + { + "count":1, + "id":10001, + "res":1 + } + ], + "name":"examp1001" + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ], + { + "add":[ + 5, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "num":3, + "type":2 + }, + "desc":[ + "来源1", + "来源2", + "来源4" + ], + "id":2.0, + "material":{ + "count":1, + "id":10001, + "res":1 + }, + "name":"examp1002" + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 902 + ], + { + "add":[ + 6, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "num":3, + "type":2 + }, + "desc":[ + "来源1", + "来源2", + "来源5" + ], + "id":3.0, + "material":[ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9 + ], + "name":"examp1003" + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 903 + ], + { + "add":[ + 7, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "num":3, + "type":2 + }, + "desc":[ + "来源1", + "来源2", + "来源6" + ], + "id":4.0, + "material":[ + "测试数据", + "测试数据2", + "测试数据3" + ], + "name":"examp1004" + }, + { + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 903 + ], + { + "add":[ + 7, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "num":3, + "type":2 + }, + "desc":[ + "来源1", + "来源2", + "来源6" + ], + "id":5.0, + "material":[ + "test" + ], + "name":"examp1004" + } +] \ No newline at end of file diff --git a/config_excel/client/cfg_array_example3.json b/config_excel/client/cfg_array_example3.json new file mode 100644 index 0000000..211e417 --- /dev/null +++ b/config_excel/client/cfg_array_example3.json @@ -0,0 +1,3 @@ +{ + "level":"啦啦啦!!!" +} \ No newline at end of file diff --git a/config_excel/client/cfg_object.json b/config_excel/client/cfg_object.json new file mode 100644 index 0000000..e66fd50 --- /dev/null +++ b/config_excel/client/cfg_object.json @@ -0,0 +1,87 @@ +{ + "actId":1001.0, + "add_value1":100.1, + "add_value2":100, + "award1":[ + [ + 1001, + 20 + ], + [ + 1002, + 20 + ], + [ + 1003, + 30 + ] + ], + "award2":[ + [ + 1001, + 10 + ], + [ + 1002, + 20 + ] + ], + "award4":{ + "aa":[ + 7003, + 1 + ], + "ff":[ + 3006, + 99 + ], + "rr":[ + 1001, + 20 + ], + "test":"这就是一个测试" + }, + "award6":[ + [ + 1001, + 20 + ], + [ + 3006, + 99 + ], + [ + 7003, + 1 + ], + { + "jsonobject":[ + 12356, + 654321 + ] + } + ], + "award7":[ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9 + ], + "jj10000":"前面字段为errorID,这里是错误描述,是的object配置的server,client字段名还支持数字作为key(但是转出格式为xml和jsonarray时就不支持了)", + "open":"18:00:0", + "open_level":90 +} \ No newline at end of file diff --git a/config_excel/server/cfg_array_example1.json b/config_excel/server/cfg_array_example1.json new file mode 100644 index 0000000..c2aa514 --- /dev/null +++ b/config_excel/server/cfg_array_example1.json @@ -0,0 +1,332 @@ +{ + "1001":{ + "pos1":{ + "88":{ + "1":{ + "id":1001, + "str":"pos1", + "level":88, + "sub_level":1, + "name":"黑切+蓝盾", + "desc1":"从小城镇", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ] + }, + "2":{ + "id":1001, + "str":"pos1", + "level":88, + "sub_level":2, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ] + } + }, + "89":{ + "89":{ + "id":1001, + "str":"pos1", + "level":89, + "sub_level":89, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ] + } + } + }, + "pos2":{ + "88":{ + "88.9":{ + "id":1001, + "str":"pos2", + "level":88, + "sub_level":88.9, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ] + } + }, + "89":{ + "89":{ + "id":1001, + "str":"pos2", + "level":89, + "sub_level":89, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ] + } + } + } + }, + "1002":{ + "pos1":{ + "88":{ + "88":{ + "id":1002, + "str":"pos1", + "level":88, + "sub_level":88, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ] + } + }, + "89":{ + "89":{ + "id":1002, + "str":"pos1", + "level":89, + "sub_level":89, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ] + } + }, + "90":{ + "90":{ + "id":1002, + "str":"pos1", + "level":90, + "sub_level":90, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ] + } + } + }, + "pos2":{ + "88":{ + "88":{ + "id":1002, + "str":"pos2", + "level":88, + "sub_level":88, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ] + } + }, + "89":{ + "89":{ + "id":1002, + "str":"pos2", + "level":89, + "sub_level":89, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ] + ] + } + }, + "90":{ + "90":{ + "id":1002, + "str":"pos2", + "level":90, + "sub_level":90, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ] + ] + } + } + } + }, + "1003":{ + "pos1":{ + "85":{ + "85":{ + "id":1003, + "str":"pos1", + "level":85, + "sub_level":85, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 902 + ] + ] + } + } + } + }, + "1004":{ + "pos1":{ + "80":{ + "80":{ + "id":1004, + "str":"pos1", + "level":80, + "sub_level":80, + "name":"黑切+蓝盾", + "desc1":"有钱就可以买", + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 903 + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/config_excel/server/cfg_array_example2.json b/config_excel/server/cfg_array_example2.json new file mode 100644 index 0000000..66911d7 --- /dev/null +++ b/config_excel/server/cfg_array_example2.json @@ -0,0 +1,217 @@ +{ + "1":{ + "id":1, + "name":"examp1001", + "material":[ + { + "res":1, + "id":10001, + "count":1 + }, + { + "res":1, + "id":10001, + "count":1 + } + ], + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 900 + ], + { + "add":[ + 4, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "type":2, + "num":3 + } + }, + "2":{ + "id":2, + "name":"examp1002", + "material":{ + "res":1, + "id":10001, + "count":1 + }, + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 901 + ], + { + "add":[ + 5, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "type":2, + "num":3 + } + }, + "3":{ + "id":3, + "name":"examp1003", + "material":[ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9 + ], + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 902 + ], + { + "add":[ + 6, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "type":2, + "num":3 + } + }, + "4":{ + "id":4, + "name":"examp1004", + "material":[ + "测试数据", + "测试数据2", + "测试数据3" + ], + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 903 + ], + { + "add":[ + 7, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "type":2, + "num":3 + } + }, + "5":{ + "id":5, + "name":"examp1004", + "material":[ + "test" + ], + "attr":[ + [ + 1, + 700 + ], + [ + 2, + 800 + ], + [ + 3, + 903 + ], + { + "add":[ + 7, + 100 + ] + } + ], + "award1":[ + 1, + 2, + 3 + ], + "award2":{ + "id":1, + "type":2, + "num":3 + } + } +} \ No newline at end of file diff --git a/config_excel/server/cfg_array_example3.json b/config_excel/server/cfg_array_example3.json new file mode 100644 index 0000000..211e417 --- /dev/null +++ b/config_excel/server/cfg_array_example3.json @@ -0,0 +1,3 @@ +{ + "level":"啦啦啦!!!" +} \ No newline at end of file diff --git a/config_excel/server/cfg_object.json b/config_excel/server/cfg_object.json new file mode 100644 index 0000000..521b0aa --- /dev/null +++ b/config_excel/server/cfg_object.json @@ -0,0 +1,102 @@ +{ + "open_level":90, + "add_value1":100.1, + "add_value2":100, + "act_id":1001, + "open":"18:00:0", + "10000":"前面字段为errorID,这里是错误描述,是的object配置的server,client字段名还支持数字作为key(但是转出格式为xml和jsonarray时就不支持了)", + "award1":[ + [ + 1001, + 20 + ], + [ + 1002, + 20 + ], + [ + 1003, + 30 + ] + ], + "award2":[ + [ + 1001, + 10 + ], + [ + 1002, + 20 + ] + ], + "award3":{ + "1":{ + "res":1001, + "id":10001, + "count":1 + }, + "2":{ + "id":10001, + "count":1, + "res":[ + 1002, + 1 + ] + } + }, + "award4":{ + "test":"这就是一个测试", + "rr":[ + 1001, + 20 + ], + "ff":[ + 3006, + 99 + ], + "aa":[ + 7003, + 1 + ] + }, + "award5":[ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9 + ], + "award6":[ + [ + 1001, + 20 + ], + [ + 3006, + 99 + ], + [ + 7003, + 1 + ], + { + "jsonobject":[ + 12356, + 654321 + ] + } + ] +} \ No newline at end of file diff --git a/lancher.bat b/genCfgs.bat similarity index 100% rename from lancher.bat rename to genCfgs.bat diff --git a/genCfgs.sh b/genCfgs.sh new file mode 100644 index 0000000..ffa2a89 --- /dev/null +++ b/genCfgs.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +python src/genCfgs.py --input ./config_excel --srv ./config_excel/server/ --clt ./config_excel/client/ --timeout -1 --suffix .xlsx --swriter erlanghrl +python src/genCfgs.py --input ./config_excel --srv ./config_excel/server/ --clt ./config_excel/client/ --timeout -1 --suffix .xlsx --swriter erlangerl diff --git a/lancher.sh b/lancher.sh deleted file mode 100644 index 11d586e..0000000 --- a/lancher.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -python reader.py --input ./ --srv server/ --clt client/ --timeout -1 --suffix .xlsx --swriter lua --cwriter json -python reader.py --input ./ --srv server/ --clt client/ --timeout -1 --suffix .xlsx --cwriter xml -python reader.py --input ./ --srv server/ --clt client/ --timeout -1 --suffix .xlsx --cwriter lua - diff --git a/src/dist/genCfgs.bat b/src/dist/genCfgs.bat new file mode 100644 index 0000000..3e22dc9 --- /dev/null +++ b/src/dist/genCfgs.bat @@ -0,0 +1,12 @@ +@echo off + +genCfgs.exe --input ../../config_excel --srv ../../config_excel/server/ --clt ../../config_excel/client/ --timeout -1 --suffix .xlsx --swriter lua --cwriter lua +genCfgs.exe --input ../../config_excel --srv ../../config_excel/server/ --clt ../../config_excel/client/ --timeout -1 --suffix .xlsx --swriter erlanghrl +genCfgs.exe --input ../../config_excel --srv ../../config_excel/server/ --clt ../../config_excel/client/ --timeout -1 --suffix .xlsx --swriter erlangerl +genCfgs.exe --input ../../config_excel --srv ../../config_excel/server/ --clt ../../config_excel/client/ --timeout -1 --suffix .xlsx --swriter elixir +genCfgs.exe --input ../../config_excel --srv ../../config_excel/server/ --clt ../../config_excel/client/ --timeout -1 --suffix .xlsx --swriter jsonobject +genCfgs.exe --input ../../config_excel --srv ../../config_excel/server/ --clt ../../config_excel/client/ --timeout -1 --suffix .xlsx --cwriter jsonarray +genCfgs.exe --input ../../config_excel --srv ../../config_excel/server/ --clt ../../config_excel/client/ --timeout -1 --suffix .xlsx --swriter elixir --cwriter xml + + +pause