mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-27 08:29:36 +08:00
【新增】代码优化
This commit is contained in:
@@ -13,10 +13,31 @@ func DdmKey(data string) string {
|
||||
return data[:3] + "****" + data[len(data)-3:]
|
||||
}
|
||||
|
||||
func IsDdmKey(data string) bool {
|
||||
if len(data) > 6 && data[3:len(data)-3] == "****" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func DdmMail(data string) string {
|
||||
return data[:3] + "****" + data[len(data)-8:]
|
||||
}
|
||||
|
||||
func ISDdmMail(data string) bool {
|
||||
if len(data) > 11 && data[3:len(data)-8] == "****" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func DdmPassword(data string) string {
|
||||
return "******"
|
||||
}
|
||||
|
||||
func IsDdmPassword(data string) bool {
|
||||
if data == "******" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
26
base/utils/ddm_test.go
Normal file
26
base/utils/ddm_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
/**
|
||||
* @Description 添加qq群467890197 交流学习
|
||||
* @Author 熊猫
|
||||
* @Date 2022/1/17 10:01
|
||||
**/
|
||||
|
||||
func TestDdmKey(t *testing.T) {
|
||||
aa := "fsdfsf535343sdfsdf3"
|
||||
bb := "23423423@qq.com"
|
||||
|
||||
key := DdmKey(aa)
|
||||
t.Log(key)
|
||||
ddmKey := IsDdmKey(key)
|
||||
t.Log(ddmKey)
|
||||
|
||||
mail := DdmMail(bb)
|
||||
t.Log(mail)
|
||||
ismail := ISDdmMail(mail)
|
||||
t.Log(ismail)
|
||||
}
|
||||
Reference in New Issue
Block a user