Compare commits
13 Commits
Author | SHA1 | Date |
---|---|---|
dtapps | 1651f55ab2 | 5 months ago |
李光春 | 7262f35069 | 2 years ago |
李光春 | b7cdd6bba5 | 2 years ago |
李光春 | 34150d18fd | 2 years ago |
李光春 | ab275ef276 | 2 years ago |
李光春 | 6d7e135992 | 2 years ago |
李光春 | ac0398de58 | 2 years ago |
李光春 | e2a2df61c8 | 2 years ago |
李光春 | fe91ef400c | 2 years ago |
李光春 | 1c3779dfb4 | 2 years ago |
李光春 | 2a9f10fa97 | 2 years ago |
李光春 | 342e69503a | 2 years ago |
李光春 | 84fd997870 | 2 years ago |
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 李光春
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,32 @@
|
||||
package goverify
|
||||
|
||||
// 运营商名称
|
||||
var typeName = map[string]string{
|
||||
Mobile: "移动",
|
||||
Unicom: "联通",
|
||||
Telecom: "电信",
|
||||
Broadnet: "广电",
|
||||
Virtual: "虚拟",
|
||||
}
|
||||
|
||||
// GetTypeName 获取运营商类型名称
|
||||
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
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
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 @@
|
||||
package goverify
|
||||
|
||||
const Version = "1.0.2"
|
||||
const Version = "1.0.8"
|
||||
|
Loading…
Reference in new issue