Ai
2 Star 3 Fork 0

newdas/video_server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
misc.go 913 Bytes
一键复制 编辑 原始数据 按行查看 历史
newdas 提交于 2018-08-02 01:39 +08:00 . bug
package utils
import (
"crypto/rand"
"fmt"
"io"
"time"
"strconv"
"net/http"
"log"
//"avenssi"
)
func NewUUID() (string, error) {
uuid := make([]byte, 16)
n, err := io.ReadFull(rand.Reader, uuid)
if n != len(uuid) || err != nil {
return "", err
}
// variant bits; see section 4.1.1
uuid[8] = uuid[8]&^0xc0 | 0x80
// version 4 (pseudo-random); see section 4.1.3
uuid[6] = uuid[6]&^0xf0 | 0x40
return fmt.Sprintf("%x-%x-%x-%x-%x", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil
}
func GetCurrentTimestampSec() int {
ts, _:=strconv.Atoi(strconv.FormatInt(time.Now().UnixNano()/1000000000, 10))
return ts
}
func SendDeleteVideoRequest(id string) {
//addr := config.GetLbAddr() + ":9001"
addr := "127.0.0.1:9001"
url := "http://" + addr + "/video-delete-record/" + id
_, err := http.Get(url)
if err != nil {
log.Printf("Sending deleting video request error: %s", err)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/newdas/video_server.git
git@gitee.com:newdas/video_server.git
newdas
video_server
video_server
cbae10443da8

搜索帮助