class="del-code nl-25 ol-25"> 86
-                                    if int_data == "零":
87
-                                        output = dec_data[1] + "角" + dec_data[2] + "分"
88
+                            if dec_data[1] != u"零":
89
+                                if dec_data[2] != u"零":
90
+                                    if int_data == u"零":
91
+                                        output = dec_data[1] + u"角" + dec_data[2] + u"分"
88 92
                                     else:
89
-                                        output = int_data + "元" + dec_data[1] + "角" + dec_data[2] + "分"
93
+                                        output = int_data + u"元" + dec_data[1] + u"角" + dec_data[2] + u"分"
90 94
                                 else:
91
-                                    if int_data == "零":
92
-                                        output = dec_data[1] + "角"
95
+                                    if int_data == u"零":
96
+                                        output = dec_data[1] + u"角"
93 97
                                     else:
94
-                                        output = int_data + "元" + dec_data[1] + "角"
98
+                                        output = int_data + u"元" + dec_data[1] + u"角"
95 99
                             else:
96
-                                if dec_data[2] != "零":
97
-                                    if int_data == "零":
98
-                                        output = dec_data[2] + "分"
100
+                                if dec_data[2] != u"零":
101
+                                    if int_data == u"零":
102
+                                        output = dec_data[2] + u"分"
99 103
                                     else:
100
-                                        output = int_data + "元" + "零" + dec_data[2] + "分"
104
+                                        output = int_data + u"元" + u"零" + dec_data[2] + u"分"
101 105
                                 else:
102
-                                    output = int_data + "元整"
106
+                                    output = int_data + u"元整"
103 107
                     else:
104 108
                         output = self.__integer_convert(integer_data, mode) + self.__decimal_convert(decimal_data, mode)
105 109
                 else:
106
-                    raise ValueError(f"输入格式错误:{inputs}!")
110
+                    raise ValueError(u"输入格式错误:{}!".format(inputs))
107 111
         else:
108
-            raise ValueError("输入数据为空!")
112
+            raise ValueError(u"输入数据为空!")
109 113
 
110 114
         return sign + output
111 115
 
112
-    def __direct_convert(self, inputs: str) -> str:
116
+    def __direct_convert(self, inputs):
113 117
         _output = ""
114 118
         for d in inputs:
115 119
             if d == ".":
116
-                _output += "点"
120
+                _output += u"点"
117 121
             else:
118 122
                 _output += self.number_low[int(d)]
119 123
         return _output
120 124
 
121 125
     @staticmethod
122
-    def __number_to_string(number_data: Union[int, float]) -> str:
126
+    def __number_to_string(number_data):
123 127
         # 小数处理:python 会自动把 0.00005 转化成 5e-05,因此 str(0.00005) != "0.00005"
124 128
         string_data = str(number_data)
125 129
         if "e" in string_data:
@@ -132,14 +136,14 @@ class An2Cn(object):
132 136
                 string_data = string_key + "0" * int(string_value)
133 137
         return string_data
134 138
 
135
-    def __check_inputs_is_valid(self, check_data: str) -> None:
139
+    def __check_inputs_is_valid(self, check_data):
136 140
         # 检查输入数据是否在规定的字典中
137 141
         all_check_keys = self.all_num + ".-"
138 142
         for data in check_data:
139 143
             if data not in all_check_keys:
140
-                raise ValueError(f"输入的数据不在转化范围内:{data}!")
144
+                raise ValueError(u"输入的数据不在转化范围内:{}!".format(data))
141 145
 
142
-    def __integer_convert(self, integer_data: str, mode: str) -> str:
146
+    def __integer_convert(self, integer_data, mode):
143 147
         if mode == "low":
144 148
             numeral_list = NUMBER_LOW_AN2CN
145 149
             unit_list = UNIT_LOW_ORDER_AN2CN
@@ -147,14 +151,14 @@ class An2Cn(object):
147 151
             numeral_list = NUMBER_UP_AN2CN
148 152
             unit_list = UNIT_UP_ORDER_AN2CN
149 153
         else:
150
-            raise ValueError(f"error mode: {mode}")
154
+            raise ValueError("error mode: {}".format(mode))
151 155
 
152 156
         # 去除前面的 0,比如 007 => 7
153 157
         integer_data = str(int(integer_data))
154 158
 
155 159
         len_integer_data = len(integer_data)
156 160
         if len_integer_data > len(unit_list):
157
-            raise ValueError(f"超出数据范围,最长支持 {len(unit_list)} 位")
161
+            raise ValueError(u"超出数据范围,最长支持 {} 位".format(len(unit_list)))
158 162
 
159 163
         output_an = ""
160 164
         for i, d in enumerate(integer_data):
@@ -164,31 +168,31 @@ class An2Cn(object):
164 168
                 if not (len_integer_data - i - 1) % 4:
165 169
                     output_an += numeral_list[int(d)] + unit_list[len_integer_data - i - 1]
166 170
 
167
-                if i > 0 and not output_an[-1] == "零":
171
+                if i > 0 and not output_an[-1] == u"零":
168 172
                     output_an += numeral_list[int(d)]
169 173
 
170
-        output_an = output_an.replace("零零", "零").replace("零万", "万").replace("零亿", "亿").replace("亿万", "亿") \
171
-            .strip("零")
174
+        output_an = output_an.replace(u"零零", u"零").replace(u"零万", u"万").replace(u"零亿", u"亿").replace(u"亿万", u"亿") \
175
+            .strip(u"零")
172 176
 
173 177
         # 解决「一十几」问题
174
-        if output_an[:2] in ["一十"]:
178
+        if output_an[:2] in [u"一十"]:
175 179
             output_an = output_an[1:]
176 180
 
177 181
         # 0 - 1 之间的小数
178 182
         if not output_an:
179
-            output_an = "零"
183
+            output_an = u"零"
180 184
 
181 185
         return output_an
182 186
 
183
-    def __decimal_convert(self, decimal_data: str, o_mode: str) -> str:
187
+    def __decimal_convert(self, decimal_data, o_mode):
184 188
         len_decimal_data = len(decimal_data)
185 189
 
186 190
         if len_decimal_data > 16:
187
-            warn(f"注意:小数部分长度为 {len_decimal_data} ,将自动截取前 16 位有效精度!")
191
+            warn(u"注意:小数部分长度为 {} ,将自动截取前 16 位有效精度!".format(len_decimal_data))
188 192
             decimal_data = decimal_data[:16]
189 193
 
190 194
         if len_decimal_data:
191
-            output_an = "点"
195
+            output_an = u"点"
192 196
         else:
193 197
             output_an = ""
194 198
 
@@ -197,7 +201,7 @@ class An2Cn(object):
197 201
         elif o_mode == "up":
198 202
             numeral_list = NUMBER_UP_AN2CN
199 203
         else:
200
-            raise ValueError(f"error mode: {o_mode}")
204
+            raise ValueError("error mode: {}".format(o_mode))
201 205
 
202 206
         for data in decimal_data:
203 207
             output_an += numeral_list[int(data)]

+ 128 - 125
utils/cn2an/conf.py

@@ -1,135 +1,138 @@
1
-NUMBER_CN2AN = {
2
-    "零": 0,
3
-    "〇": 0,
4
-    "一": 1,
5
-    "壹": 1,
6
-    "幺": 1,
7
-    "二": 2,
8
-    "贰": 2,
9
-    "两": 2,
10
-    "三": 3,
11
-    "叁": 3,
12
-    "四": 4,
13
-    "肆": 4,
14
-    "五": 5,
15
-    "伍": 5,
16
-    "六": 6,
17
-    "陆": 6,
18
-    "七": 7,
19
-    "柒": 7,
20
-    "八": 8,
21
-    "捌": 8,
22
-    "九": 9,
23
-    "玖": 9,
24
-}
25
-UNIT_CN2AN = {
26
-    "十": 10,
27
-    "拾": 10,
28
-    "百": 100,
29
-    "佰": 100,
30
-    "千": 1000,
31
-    "仟": 1000,
32
-    "万": 10000,
33
-    "亿": 100000000,
34
-}
35
-UNIT_LOW_AN2CN = {
36
-    10: "十",
37
-    100: "百",
38
-    1000: "千",
39
-    10000: "万",
40
-    100000000: "亿",
41
-}
1
+# -*- coding: utf-8 -*-
2
+
3
+
4
+# NUMBER_CN2AN = {
5
+#     "零": 0,
6
+#     "〇": 0,
7
+#     "一": 1,
8
+#     "壹": 1,
9
+#     "幺": 1,
10
+#     "二": 2,
11
+#     "贰": 2,
12
+#     "两": 2,
13
+#     "三": 3,
14
+#     "叁": 3,
15
+#     "四": 4,
16
+#     "肆": 4,
17
+#     "五": 5,
18
+#     "伍": 5,
19
+#     "六": 6,
20
+#     "陆": 6,
21
+#     "七": 7,
22
+#     "柒": 7,
23
+#     "八": 8,
24
+#     "捌": 8,
25
+#     "九": 9,
26
+#     "玖": 9,
27
+# }
28
+# UNIT_CN2AN = {
29
+#     "十": 10,
30
+#     "拾": 10,
31
+#     "百": 100,
32
+#     "佰": 100,
33
+#     "千": 1000,
34
+#     "仟": 1000,
35
+#     "万": 10000,
36
+#     "亿": 100000000,
37
+# }
38
+# UNIT_LOW_AN2CN = {
39
+#     10: "十",
40
+#     100: "百",
41
+#     1000: "千",
42
+#     10000: "万",
43
+#     100000000: "亿",
44
+# }
42 45
 NUMBER_LOW_AN2CN = {
43
-    0: "零",
44
-    1: "一",
45
-    2: "二",
46
-    3: "三",
47
-    4: "四",
48
-    5: "五",
49
-    6: "六",
50
-    7: "七",
51
-    8: "八",
52
-    9: "九",
46
+    0: u"零",
47
+    1: u"一",
48
+    2: u"二",
49
+    3: u"三",
50
+    4: u"四",
51
+    5: u"五",
52
+    6: u"六",
53
+    7: u"七",
54
+    8: u"八",
55
+    9: u"九",
53 56
 }
54 57
 NUMBER_UP_AN2CN = {
55
-    0: "零",
56
-    1: "壹",
57
-    2: "贰",
58
-    3: "叁",
59
-    4: "肆",
60
-    5: "伍",
61
-    6: "陆",
62
-    7: "柒",
63
-    8: "捌",
64
-    9: "玖",
58
+    0: u"零",
59
+    1: u"壹",
60
+    2: u"贰",
61
+    3: u"叁",
62
+    4: u"肆",
63
+    5: u"伍",
64
+    6: u"陆",
65
+    7: u"柒",
66
+    8: u"捌",
67
+    9: u"玖",
65 68
 }
66 69
 UNIT_LOW_ORDER_AN2CN = [
67 70
     "",
68
-    "十",
69
-    "百",
70
-    "千",
71
-    "万",
72
-    "十",
73
-    "百",
74
-    "千",
75
-    "亿",
76
-    "十",
77
-    "百",
78
-    "千",
79
-    "万",
80
-    "十",
81
-    "百",
82
-    "千",
71
+    u"十",
72
+    u"百",
73
+    u"千",
74
+    u"万",
75
+    u"十",
76
+    u"百",
77
+    u"千",
78
+    u"亿",
79
+    u"十",
80
+    u"百",
81
+    u"千",
82
+    u"万",
83
+    u"十",
84
+    u"百",
85
+    u"千",
83 86
 ]
84 87
 UNIT_UP_ORDER_AN2CN = [
85 88
     "",
86
-    "拾",
87
-    "佰",
88
-    "仟",
89
-    "万",
90
-    "拾",
91
-    "佰",
92
-    "仟",
93
-    "亿",
94
-    "拾",
95
-    "佰",
96
-    "仟",
97
-    "万",
98
-    "拾",
99
-    "佰",
100
-    "仟",
89
+    u"拾",
90
+    u"佰",
91
+    u"仟",
92
+    u"万",
93
+    u"拾",
94
+    u"佰",
95
+    u"仟",
96
+    u"亿",
97
+    u"拾",
98
+    u"佰",
99
+    u"仟",
100
+    u"万",
101
+    u"拾",
102
+    u"佰",
103
+    u"仟",
101 104
 ]
102
-STRICT_CN_NUMBER = {
103
-    "零": "零",
104
-    "一": "一壹",
105
-    "二": "二贰",
106
-    "三": "三叁",
107
-    "四": "四肆",
108
-    "五": "五伍",
109
-    "六": "六陆",
110
-    "七": "七柒",
111
-    "八": "八捌",
112
-    "九": "九玖",
113
-    "十": "十拾",
114
-    "百": "百佰",
115
-    "千": "千仟",
116
-    "万": "万",
117
-    "亿": "亿",
118
-}
119
-NORMAL_CN_NUMBER = {
120
-    "零": "零〇",
121
-    "一": "一壹幺",
122
-    "二": "二贰两",
123
-    "三": "三叁仨",
124
-    "四": "四肆",
125
-    "五": "五伍",
126
-    "六": "六陆",
127
-    "七": "七柒",
128
-    "八": "八捌",
129
-    "九": "九玖",
130
-    "十": "十拾",
131
-    "百": "百佰",
132
-    "千": "千仟",
133
-    "万": "万",
134
-    "亿": "亿",
135
-}
105
+# STRICT_CN_NUMBER = {
106
+#     "零": "零",
107
+#     "一": "一壹",
108
+#     "二": "二贰",
109
+#     "三": "三叁",
110
+#     "四": "四肆",
111
+#     "五": "五伍",
112
+#     "六": "六陆",
113
+#     "七": "七柒",
114
+#     "八": "八捌",
115
+#     "九": "九玖",
116
+#     "十": "十拾",
117
+#     "百": "百佰",
118
+#     "千": "千仟",
119
+#     "万": "万",
120
+#     "亿": "亿",
121
+# }
122
+# NORMAL_CN_NUMBER = {
123
+#     "零": "零〇",
124
+#     "一": "一壹幺",
125
+#     "二": "二贰两",
126
+#     "三": "三叁仨",
127
+#     "四": "四肆",
128
+#     "五": "五伍",
129
+#     "六": "六陆",
130
+#     "七": "七柒",
131
+#     "八": "八捌",
132
+#     "九": "九玖",
133
+#     "十": "十拾",
134
+#     "百": "百佰",
135
+#     "千": "千仟",
136
+#     "万": "万",
137
+#     "亿": "亿",
138
+# }

+ 5 - 0
utils/error/errno_utils.py

@@ -226,6 +226,11 @@ class TenancyStatusCode(BaseStatusCode):
226 226
     TENANCY_SHOT_REQUEST_NOT_FOUND = StatusCodeField(509011, 'Tenancy Shot Request Not Found', description=u'租赁镜头申请不存在')
227 227
 
228 228
 
229
+class ContractStatusCode(BaseStatusCode):
230
+    """ 合同相关错误码 5091xx """
231
+    CONTRACT_NOT_FOUND = StatusCodeField(509101, 'Contract Not Found', description=u'合同不存在')
232
+
233
+
229 234
 class TencentCloudStatusCode(BaseStatusCode):
230 235
     """ 腾讯云SDK错误码 5099xx """
231 236
     TENCENT_CLOUD_SDK_EXCEPTION = StatusCodeField(509901, 'Tencent Cloud SDK Exception', description=u'腾讯云SDK报错')

kodo - Gogs: Go Git Service

Sin Descripción

basic_pure.html 4.4KB

    {% load staticfiles %} <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="format-detection" content="telephone=no,email=no,address=no"> <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no"> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> <title>{% block title %}{% endblock %}</title> <link href="//cdnjs.cloudflare.com/ajax/libs/pure/0.6.2/pure-min.css" rel="stylesheet"> {% block link %}{% endblock %} <style> body { font-family: Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif !important; background: #fff; } img { pointer-events: none; } .clickable { pointer-events: auto; } /* Input 自动填充后,移除 Chrome 默认黄色 */ input:-webkit-autofill { box-shadow: 0 0 0 1000px white inset !important; } .container { padding-bottom: 45px; } .text-center { text-align: center; } .empty { color: #999; padding: .9375rem 0; font-size: .625rem; } .text_ellipsis { overflow:hidden; white-space:nowrap; text-overflow: ellipsis; } .fl { float: left; } .fr { float: right; } .clearfix { zoom: 1; } .clearfix:after { content: "\200B"; display: block; height: 0; clear: both; } </style> {% block tohomecss %} <style> .tohome { width: 40px; height: 40px; background-color: rgba(139, 139, 139, 0.7); position: fixed; right: 10px; bottom: 20px; border-radius: 9999px; border-top-left-radius: 9999px; border-top-right-radius: 9999px; border-bottom-left-radius: 9999px; border-bottom-right-radius: 9999px; z-index: 99999999; } .tohome img { display: block; width: 18px; height: 13px; margin: 6px auto 2px; } .tohome p { color: #ffffff; } </style> {% endblock %} {% block css %}{% endblock %} <script> {% block rem %} //这段js的最后面有两个参数记得要设置,一个为设计稿实际宽度,一个为制作稿最大宽度,例如设计稿为750,最大宽度为750,则为(750,750) !function(e,t){function n(){var n=l.getBoundingClientRect().width;t=t||540,n>t&&(n=t);var i=100*n/e;r.innerHTML="html{font-size:"+i+"px;}"}var i,d=document,o=window,l=d.documentElement,r=document.createElement("style");if(l.firstElementChild)l.firstElementChild.appendChild(r);else{var a=d.createElement("div");a.appendChild(r),d.write(a.innerHTML),a=null}n(),o.addEventListener("resize",function(){clearTimeout(i),i=setTimeout(n,300)},!1),o.addEventListener("pageshow",function(e){e.persisted&&(clearTimeout(i),i=setTimeout(n,300))},!1),"complete"===d.readyState?d.body.style.fontSize="16px":d.addEventListener("DOMContentLoaded",function(e){d.body.style.fontSize="16px"},!1)}(750,750); {% endblock %} </script> </head> <body> {% block somehtml %}{% endblock %} <div class="container"> {% block container %}{% endblock %} </div> {% block somehtml2 %}{% endblock %} <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> {% block script %}{% endblock %} <script> {% block glbjs %}{% endblock %} $(function() { {% block js %}{% endblock %} }); </script> </body> </html>