iedc-go/example/provider/init.go

73 lines
1.2 KiB
Go
Raw Permalink Normal View History

2022-05-03 00:09:25 +00:00
package provider
import (
. "code.hoteas.com/golang/hotime"
. "code.hoteas.com/golang/hotime/common"
2022-05-09 07:07:01 +00:00
"strings"
2022-05-03 00:09:25 +00:00
"time"
2022-05-05 08:07:01 +00:00
"unicode/utf8"
2022-05-03 00:09:25 +00:00
)
// Project 管理端项目
var Project = Proj{
2022-05-03 07:17:27 +00:00
"company": CompanyCtr,
2022-05-04 16:29:30 +00:00
"declare": DeclareCtr,
2022-05-03 07:17:27 +00:00
"matters": MattersCtr,
"order": OrderCtr,
2022-05-03 00:09:25 +00:00
"salesman": Salesman,
2022-05-03 07:17:27 +00:00
"sms": Sms,
2022-05-04 16:29:30 +00:00
"tag": TagCtr,
2022-05-03 07:17:27 +00:00
"user": UserCtr,
2022-05-03 00:09:25 +00:00
"wechat": Wechat,
}
2022-05-09 07:07:01 +00:00
func strToArray(str string) Slice {
s := Slice{}
olds := strings.Split(str, ",")
for _, v := range olds {
if v != "" {
s = append(s, v)
}
}
return s
}
func arrayToStr(ars Slice) string {
s := ","
if ars == nil {
return s
}
for k, _ := range ars {
s = s + ars.GetString(k) + ","
}
return s
}
2022-05-03 00:09:25 +00:00
//生成随机码的6位md5
func getSn() string {
x := Rand(8)
return Substr(Md5(ObjToStr(int64(x)+time.Now().UnixNano()+int64(Rand(6)))), 0, 6)
}
//生成随机码的4位随机数
func getCode() string {
//res := ""
//for i := 0; i < 4; i++ {
res := ObjToStr(RandX(1000, 9999))
//}
return res
}
2022-05-05 08:07:01 +00:00
// 过滤 emoji 表情
func FilterEmoji(content string) string {
new_content := ""
for _, value := range content {
_, size := utf8.DecodeRuneInString(string(value))
if size <= 3 {
new_content += string(value)
}
}
return new_content
}