File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ ldap:
101
101
group-name-modify : false
102
102
# 是否允许更改用户DN
103
103
user-name-modify : false
104
+ # 📢 即便用不到如下三段配置信息,也不要删除,否则会有一些奇怪的错误出现
104
105
dingtalk :
105
106
# 配置获取详细文档参考: http://ldapdoc.eryajf.net/pages/94f43a/
106
107
flag : " dingtalk" # 作为钉钉在平台的标识
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ func isEnglish(str string) bool {
17
17
return match
18
18
}
19
19
20
+ // 是否为英文与数字组合
21
+ func isEnglishAndNum (str string ) bool {
22
+ match , _ := regexp .MatchString (`^[a-zA-Z0-9_-]+$` , str )
23
+ return match
24
+ }
25
+
20
26
// 是否全为中文
21
27
func isChinese (s string ) bool {
22
28
for _ , r := range s {
@@ -32,7 +38,8 @@ func isChinese(s string) bool {
32
38
1.如果名字中有横杠或者下划线连接,将会删去下划线再处理
33
39
2.全是中文:直接转拼音
34
40
3.全是英文:不进行处理,原文呈现
35
- 4.如果是中英混合,那么分以下几种情况
41
+ 4.英文与数字组合,不进行处理,原文呈现
42
+ 5.如果是中英混合,那么分以下几种情况
36
43
1.开头是中文,结尾不是中文:进入Convert逻辑第一种
37
44
2.开头不是中文,结尾不是中文:进入Convert逻辑第一种
38
45
3.开头不是中文,结尾是中文:进入Convert逻辑第三种
@@ -56,7 +63,7 @@ func Convert(src string) string {
56
63
if isChinese (src ) { // 全是中文
57
64
return strings .Join (pinyin .LazyConvert (src , nil ), "" )
58
65
}
59
- if isEnglish (src ) { // 全是英文
66
+ if isEnglish (src ) || isEnglishAndNum ( src ) { // 全是英文,或者为英文与数字组合
60
67
return src
61
68
}
62
69
You can’t perform that action at this time.
0 commit comments