4 Star 13 Fork 1

cristiane / micro-mall-users

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
phone.go 598 Bytes
一键复制 编辑 原始数据 按行查看 历史
cristiane 提交于 2020-09-06 00:02 . init project
package util
import (
"bytes"
"fmt"
"math/rand"
"strconv"
"time"
)
const InternalCode = "86"
func GetCompletePhone(countryCode, mobile string) string {
if mobile == "" {
return ""
}
if countryCode == InternalCode || countryCode == "" {
return mobile
}
return fmt.Sprintf("00-%v-%v", countryCode, mobile)
}
func GenerateSignCode(count uint8) string {
if count == 0 {
return ""
}
var buffer bytes.Buffer
rnd := rand.New(rand.NewSource(time.Now().UnixNano()))
for i := uint8(0); i < count; i++ {
buffer.WriteString(strconv.Itoa(rnd.Intn(10)))
}
return buffer.String()
}
Go
1
https://gitee.com/cristiane/micro-mall-users.git
git@gitee.com:cristiane/micro-mall-users.git
cristiane
micro-mall-users
micro-mall-users
v1.0.1

搜索帮助