You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
925 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package main
import (
"dsSupport/CronTask"
"dsSupport/Router"
"dsSupport/Utils/FileUtil"
"fmt"
"github.com/gin-gonic/gin"
"github.com/robfig/cron/v3"
)
func main(){
// 显示Logo
configIniFile := "./Config/logo.txt"
var logo = FileUtil.ReadFileContent(configIniFile)
fmt.Print(logo)
r := gin.Default()
//主路由
Router.GinRouter(r)
//M3u8目录
// http://127.0.0.1:9000/M3u8/B7/B7318F5D-46B8-4AA1-8811-1A9D65528E19/B7318F5D-46B8-4AA1-8811-1A9D65528E19.m3u8
//r.Static("/M3u8", "./Target")
//静态文件路径
r.Static("/Html","./Html")
//定时任务
crontab:=cron.New(cron.WithSeconds()) //精确到秒
//定义定时器调用的任务函数
task := func() {
CronTask.Task()
}
//定时任务
spec := "0 0 */1 * * ?" //cron表达式每1小时一次
// 添加定时任务
crontab.AddFunc(spec, task)
// 启动定时器
crontab.Start()
// 指定地址和端口号
r.Run(":9000")
}