diff --git a/config_excel/server/cfg_array_example1.erl b/config_excel/server/cfg_array_example1.erl index 11b7637..63dc11a 100644 --- a/config_excel/server/cfg_array_example1.erl +++ b/config_excel/server/cfg_array_example1.erl @@ -7,147 +7,147 @@ -include("cfg_array_example1.hrl"). -compile([export_all, nowarn_export_all]). -get(1001, "pos1", 88, 1) -> +get(1001, <<"pos1"/utf8>>, 88, 1) -> #cfg_array_example1{ 'id' = 1001 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 88 , 'sub_level' = 1 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 900]] - , 'desc1' = "从小城镇" + , 'desc1' = <<"从小城镇"/utf8>> }; -get(1001, "pos1", 88, 2) -> +get(1001, <<"pos1"/utf8>>, 88, 2) -> #cfg_array_example1{ 'id' = 1001 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 88 , 'sub_level' = 2 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 900]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1001, "pos1", 89, 89) -> +get(1001, <<"pos1"/utf8>>, 89, 89) -> #cfg_array_example1{ 'id' = 1001 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 89 , 'sub_level' = 89 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 900]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1001, "pos2", 88, 88.9) -> +get(1001, <<"pos2"/utf8>>, 88, 88.9) -> #cfg_array_example1{ 'id' = 1001 - , 'str' = "pos2" + , 'str' = <<"pos2"/utf8>> , 'level' = 88 , 'sub_level' = 88.9 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 900]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1001, "pos2", 89, 89) -> +get(1001, <<"pos2"/utf8>>, 89, 89) -> #cfg_array_example1{ 'id' = 1001 - , 'str' = "pos2" + , 'str' = <<"pos2"/utf8>> , 'level' = 89 , 'sub_level' = 89 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 900]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1002, "pos1", 88, 88) -> +get(1002, <<"pos1"/utf8>>, 88, 88) -> #cfg_array_example1{ 'id' = 1002 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 88 , 'sub_level' = 88 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 901]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1002, "pos1", 89, 89) -> +get(1002, <<"pos1"/utf8>>, 89, 89) -> #cfg_array_example1{ 'id' = 1002 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 89 , 'sub_level' = 89 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 900]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1002, "pos1", 90, 90) -> +get(1002, <<"pos1"/utf8>>, 90, 90) -> #cfg_array_example1{ 'id' = 1002 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 90 , 'sub_level' = 90 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 901]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1002, "pos2", 88, 88) -> +get(1002, <<"pos2"/utf8>>, 88, 88) -> #cfg_array_example1{ 'id' = 1002 - , 'str' = "pos2" + , 'str' = <<"pos2"/utf8>> , 'level' = 88 , 'sub_level' = 88 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 901]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1002, "pos2", 89, 89) -> +get(1002, <<"pos2"/utf8>>, 89, 89) -> #cfg_array_example1{ 'id' = 1002 - , 'str' = "pos2" + , 'str' = <<"pos2"/utf8>> , 'level' = 89 , 'sub_level' = 89 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 900]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1002, "pos2", 90, 90) -> +get(1002, <<"pos2"/utf8>>, 90, 90) -> #cfg_array_example1{ 'id' = 1002 - , 'str' = "pos2" + , 'str' = <<"pos2"/utf8>> , 'level' = 90 , 'sub_level' = 90 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 901]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1003, "pos1", 85, 85) -> +get(1003, <<"pos1"/utf8>>, 85, 85) -> #cfg_array_example1{ 'id' = 1003 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 85 , 'sub_level' = 85 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 902]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; -get(1004, "pos1", 80, 80) -> +get(1004, <<"pos1"/utf8>>, 80, 80) -> #cfg_array_example1{ 'id' = 1004 - , 'str' = "pos1" + , 'str' = <<"pos1"/utf8>> , 'level' = 80 , 'sub_level' = 80 - , 'name' = "黑切+蓝盾" + , 'name' = <<"黑切+蓝盾"/utf8>> , 'attr' = [[1, 700], [2, 800], [3, 903]] - , 'desc1' = "有钱就可以买" + , 'desc1' = <<"有钱就可以买"/utf8>> }; get(_, _, _, _) -> @@ -155,152 +155,152 @@ get(_, _, _, _) -> getList() -> [ - {1001, "pos1", 88, 1} - , {1001, "pos1", 88, 2} - , {1001, "pos1", 89, 89} - , {1001, "pos2", 88, 88.9} - , {1001, "pos2", 89, 89} - , {1002, "pos1", 88, 88} - , {1002, "pos1", 89, 89} - , {1002, "pos1", 90, 90} - , {1002, "pos2", 88, 88} - , {1002, "pos2", 89, 89} - , {1002, "pos2", 90, 90} - , {1003, "pos1", 85, 85} - , {1004, "pos1", 80, 80} + {1001, <<"pos1"/utf8>>, 88, 1} + , {1001, <<"pos1"/utf8>>, 88, 2} + , {1001, <<"pos1"/utf8>>, 89, 89} + , {1001, <<"pos2"/utf8>>, 88, 88.9} + , {1001, <<"pos2"/utf8>>, 89, 89} + , {1002, <<"pos1"/utf8>>, 88, 88} + , {1002, <<"pos1"/utf8>>, 89, 89} + , {1002, <<"pos1"/utf8>>, 90, 90} + , {1002, <<"pos2"/utf8>>, 88, 88} + , {1002, <<"pos2"/utf8>>, 89, 89} + , {1002, <<"pos2"/utf8>>, 90, 90} + , {1003, <<"pos1"/utf8>>, 85, 85} + , {1004, <<"pos1"/utf8>>, 80, 80} ]. getList(1001) -> [ - {1001, "pos1", 88, 1} - , {1001, "pos1", 88, 2} - , {1001, "pos1", 89, 89} - , {1001, "pos2", 88, 88.9} - , {1001, "pos2", 89, 89} + {1001, <<"pos1"/utf8>>, 88, 1} + , {1001, <<"pos1"/utf8>>, 88, 2} + , {1001, <<"pos1"/utf8>>, 89, 89} + , {1001, <<"pos2"/utf8>>, 88, 88.9} + , {1001, <<"pos2"/utf8>>, 89, 89} ]; getList(1002) -> [ - {1002, "pos1", 88, 88} - , {1002, "pos1", 89, 89} - , {1002, "pos1", 90, 90} - , {1002, "pos2", 88, 88} - , {1002, "pos2", 89, 89} - , {1002, "pos2", 90, 90} + {1002, <<"pos1"/utf8>>, 88, 88} + , {1002, <<"pos1"/utf8>>, 89, 89} + , {1002, <<"pos1"/utf8>>, 90, 90} + , {1002, <<"pos2"/utf8>>, 88, 88} + , {1002, <<"pos2"/utf8>>, 89, 89} + , {1002, <<"pos2"/utf8>>, 90, 90} ]; getList(1003) -> [ - {1003, "pos1", 85, 85} + {1003, <<"pos1"/utf8>>, 85, 85} ]; getList(1004) -> [ - {1004, "pos1", 80, 80} + {1004, <<"pos1"/utf8>>, 80, 80} ]; getList(_) -> []. -getList(1001, "pos1") -> +getList(1001, <<"pos1"/utf8>>) -> [ - {1001, "pos1", 88, 1} - , {1001, "pos1", 88, 2} - , {1001, "pos1", 89, 89} + {1001, <<"pos1"/utf8>>, 88, 1} + , {1001, <<"pos1"/utf8>>, 88, 2} + , {1001, <<"pos1"/utf8>>, 89, 89} ]; -getList(1001, "pos2") -> +getList(1001, <<"pos2"/utf8>>) -> [ - {1001, "pos2", 88, 88.9} - , {1001, "pos2", 89, 89} + {1001, <<"pos2"/utf8>>, 88, 88.9} + , {1001, <<"pos2"/utf8>>, 89, 89} ]; -getList(1002, "pos1") -> +getList(1002, <<"pos1"/utf8>>) -> [ - {1002, "pos1", 88, 88} - , {1002, "pos1", 89, 89} - , {1002, "pos1", 90, 90} + {1002, <<"pos1"/utf8>>, 88, 88} + , {1002, <<"pos1"/utf8>>, 89, 89} + , {1002, <<"pos1"/utf8>>, 90, 90} ]; -getList(1002, "pos2") -> +getList(1002, <<"pos2"/utf8>>) -> [ - {1002, "pos2", 88, 88} - , {1002, "pos2", 89, 89} - , {1002, "pos2", 90, 90} + {1002, <<"pos2"/utf8>>, 88, 88} + , {1002, <<"pos2"/utf8>>, 89, 89} + , {1002, <<"pos2"/utf8>>, 90, 90} ]; -getList(1003, "pos1") -> +getList(1003, <<"pos1"/utf8>>) -> [ - {1003, "pos1", 85, 85} + {1003, <<"pos1"/utf8>>, 85, 85} ]; -getList(1004, "pos1") -> +getList(1004, <<"pos1"/utf8>>) -> [ - {1004, "pos1", 80, 80} + {1004, <<"pos1"/utf8>>, 80, 80} ]; getList(_, _) -> []. -getList(1001, "pos1", 88) -> +getList(1001, <<"pos1"/utf8>>, 88) -> [ - {1001, "pos1", 88, 1} - , {1001, "pos1", 88, 2} + {1001, <<"pos1"/utf8>>, 88, 1} + , {1001, <<"pos1"/utf8>>, 88, 2} ]; -getList(1001, "pos1", 89) -> +getList(1001, <<"pos1"/utf8>>, 89) -> [ - {1001, "pos1", 89, 89} + {1001, <<"pos1"/utf8>>, 89, 89} ]; -getList(1001, "pos2", 88) -> +getList(1001, <<"pos2"/utf8>>, 88) -> [ - {1001, "pos2", 88, 88.9} + {1001, <<"pos2"/utf8>>, 88, 88.9} ]; -getList(1001, "pos2", 89) -> +getList(1001, <<"pos2"/utf8>>, 89) -> [ - {1001, "pos2", 89, 89} + {1001, <<"pos2"/utf8>>, 89, 89} ]; -getList(1002, "pos1", 88) -> +getList(1002, <<"pos1"/utf8>>, 88) -> [ - {1002, "pos1", 88, 88} + {1002, <<"pos1"/utf8>>, 88, 88} ]; -getList(1002, "pos1", 89) -> +getList(1002, <<"pos1"/utf8>>, 89) -> [ - {1002, "pos1", 89, 89} + {1002, <<"pos1"/utf8>>, 89, 89} ]; -getList(1002, "pos1", 90) -> +getList(1002, <<"pos1"/utf8>>, 90) -> [ - {1002, "pos1", 90, 90} + {1002, <<"pos1"/utf8>>, 90, 90} ]; -getList(1002, "pos2", 88) -> +getList(1002, <<"pos2"/utf8>>, 88) -> [ - {1002, "pos2", 88, 88} + {1002, <<"pos2"/utf8>>, 88, 88} ]; -getList(1002, "pos2", 89) -> +getList(1002, <<"pos2"/utf8>>, 89) -> [ - {1002, "pos2", 89, 89} + {1002, <<"pos2"/utf8>>, 89, 89} ]; -getList(1002, "pos2", 90) -> +getList(1002, <<"pos2"/utf8>>, 90) -> [ - {1002, "pos2", 90, 90} + {1002, <<"pos2"/utf8>>, 90, 90} ]; -getList(1003, "pos1", 85) -> +getList(1003, <<"pos1"/utf8>>, 85) -> [ - {1003, "pos1", 85, 85} + {1003, <<"pos1"/utf8>>, 85, 85} ]; -getList(1004, "pos1", 80) -> +getList(1004, <<"pos1"/utf8>>, 80) -> [ - {1004, "pos1", 80, 80} + {1004, <<"pos1"/utf8>>, 80, 80} ]; getList(_, _, _) -> diff --git a/config_excel/server/cfg_array_example2.erl b/config_excel/server/cfg_array_example2.erl index b569a72..ab5a516 100644 --- a/config_excel/server/cfg_array_example2.erl +++ b/config_excel/server/cfg_array_example2.erl @@ -10,7 +10,7 @@ get(1) -> #cfg_array_example2{ 'id' = 1 - , 'name' = "examp1001" + , 'name' = <<"examp1001"/utf8>> , '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} @@ -20,7 +20,7 @@ get(1) -> get(2) -> #cfg_array_example2{ 'id' = 2 - , 'name' = "examp1002" + , 'name' = <<"examp1002"/utf8>> , 'material' = #{'res' => 1, 'id' => 10001, 'count' => 1} , 'attr' = [[1, 700], [2, 800], [3, 901], #{'add' => [5, 100]}] , 'award1' = {1, 2, 3} @@ -30,7 +30,7 @@ get(2) -> get(3) -> #cfg_array_example2{ 'id' = 3 - , 'name' = "examp1003" + , 'name' = <<"examp1003"/utf8>> , '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} @@ -40,8 +40,8 @@ get(3) -> get(4) -> #cfg_array_example2{ 'id' = 4 - , 'name' = "examp1004" - , 'material' = ["测试数据", "测试数据2", "测试数据3"] + , 'name' = <<"examp1004"/utf8>> + , 'material' = [<<"测试数据"/utf8>>, <<"测试数据2"/utf8>>, <<"测试数据3"/utf8>>] , 'attr' = [[1, 700], [2, 800], [3, 903], #{'add' => [7, 100]}] , 'award1' = {1, 2, 3} , 'award2' = #{'id' => 1, 'type' => 2, 'num' => 3} @@ -50,8 +50,8 @@ get(4) -> get(5) -> #cfg_array_example2{ 'id' = 5 - , 'name' = "examp1004" - , 'material' = ["test"] + , 'name' = <<"examp1004"/utf8>> + , 'material' = [<<"test"/utf8>>] , 'attr' = [[1, 700], [2, 800], [3, 903], #{'add' => [7, 100]}] , 'award1' = {1, 2, 3} , 'award2' = #{'id' => 1, 'type' => 2, 'num' => 3} diff --git a/config_excel/server/cfg_array_example3.erl b/config_excel/server/cfg_array_example3.erl index beca8c2..6748a21 100644 --- a/config_excel/server/cfg_array_example3.erl +++ b/config_excel/server/cfg_array_example3.erl @@ -8,7 +8,7 @@ %% 演示 get('level') -> - "啦啦啦!!!"; + <<"啦啦啦!!!"/utf8>>; get(_) -> undefined. \ No newline at end of file diff --git a/config_excel/server/cfg_object.erl b/config_excel/server/cfg_object.erl index 4949d96..460a870 100644 --- a/config_excel/server/cfg_object.erl +++ b/config_excel/server/cfg_object.erl @@ -24,11 +24,11 @@ get('act_id') -> %% 开始时间 get('open') -> - "18:00:0"; + <<"18:00:0"/utf8>>; %% 错误信息 get(10000) -> - "前面字段为errorID,这里是错误描述,是的object配置的server,client字段名还支持数字作为key(但是转出格式为xml和jsonarray时就不支持了)"; + <<"前面字段为errorID,这里是错误描述,是的object配置的server,client字段名还支持数字作为key(但是转出格式为xml和jsonarray时就不支持了)"/utf8>>; %% 奖励1 get('award1') -> @@ -44,7 +44,7 @@ get('award3') -> %% 奖励4 get('award4') -> - #{'rr' => [1001, 20], 'ff' => [3006, 99], 'aa' => [7003, 1], 'test' => "这就是一个测试"}; + #{'rr' => [1001, 20], 'ff' => [3006, 99], 'aa' => [7003, 1], 'test' => <<"这就是一个测试"/utf8>>}; %% 奖励5 get('award5') -> diff --git a/config_excel/server/start.bat b/config_excel/server/start.bat new file mode 100644 index 0000000..59d0635 --- /dev/null +++ b/config_excel/server/start.bat @@ -0,0 +1 @@ +start werl.exe \ No newline at end of file diff --git a/src/writer_erlang_erl.py b/src/writer_erlang_erl.py index c686cde..fe9f70e 100644 --- a/src/writer_erlang_erl.py +++ b/src/writer_erlang_erl.py @@ -65,7 +65,8 @@ class ErlangerlWriter(Writer): val_type = type( lk ) if str == val_type : - lk = lk.replace("\"", "\'") + lk = lk.replace("<<\"", "\'") + lk = lk.replace("\"/utf8>>", "\'") key = "".join( ["get(",lk,") ->\n"] ) @@ -104,7 +105,8 @@ class ErlangerlWriter(Writer): val_type = type( lk ) if str == val_type : - lk = lk.replace("\"", "\'") + lk = lk.replace("<<\"", "\'") + lk = lk.replace("\"/utf8>>", "\'") oneval = "".join( [lk, " = ", lv , "\n"] ) @@ -199,7 +201,9 @@ class ErlangerlWriter(Writer): val_type = type( lk ) if str == val_type : - lk = lk.replace("\"", "\'") + lk = lk.replace("<<\"", "\'") + lk = lk.replace("\"/utf8>>", "\'") + key = "".join( [lk," => "] ) val = "".join( [key, lv] ) dict_ctx_list.append(val) @@ -243,7 +247,7 @@ class ErlangerlWriter(Writer): return False,str( int(value) ) return False,str( value ) elif str == val_type or unicode == val_type: - return False, "".join(["\"",value,"\""]) + return False, "".join(["<<\"",value,"\"/utf8>>"]) elif tuple == val_type : return self.tuple_to_erlang(value,indent) elif dict == val_type :