Compare commits

...

3 Commits

Author SHA1 Message Date
dtapps 1651f55ab2 update
5 months ago
李光春 7262f35069 - update
continuous-integration/drone/push Build is passing Details
2 years ago
李光春 b7cdd6bba5 - 增加[获取运营商类型]方法
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2 years ago

2
.gitignore vendored

@ -5,4 +5,4 @@
.vscode
*.log
gomod.sh
/vendor/
*_test.go

@ -12,8 +12,8 @@
#### 安装
```go
go get -v -u go.dtapp.net/goverify
```shell
go get -v -u go.dtapp.net/goverify@v1.0.8
```
#### 使用

@ -1,6 +1,6 @@
package goverify
// 功能类型
// 运营商名称
var typeName = map[string]string{
Mobile: "移动",
Unicom: "联通",
@ -13,3 +13,20 @@ var typeName = map[string]string{
func GetTypeName(Type string) string {
return typeName[Type]
}
// GetType 获取运营商类型
func GetType(name string) (Type string) {
switch name {
case "移动", "移动运营商", "中国移动", "中国移动运营商":
return Mobile
case "联通", "联通运营商", "中国联通", "中国联通运营商":
return Unicom
case "电信", "电信运营商", "中国电信", "中国电信运营商":
return Telecom
case "广电", "广电运营商", "中国广电", "中国广电运营商":
return Broadnet
case "虚拟", "虚拟运营商":
return Virtual
}
return Type
}

@ -2,6 +2,10 @@ package goverify
import "testing"
func TestGetType(t *testing.T) {
t.Log(GetType("移动"))
}
func TestGetTypeName(t *testing.T) {
t.Log(GetTypeName(Mobile))
}

@ -1,3 +1,3 @@
module go.dtapp.net/goverify
go 1.18
go 1.21

@ -1,3 +1,3 @@
package goverify
const Version = "1.0.6"
const Version = "1.0.8"

Loading…
Cancel
Save