1234567891011121314151617181920212223242526 |
- package services
- import (
- "context"
- "fmt"
- "github.com/beego/beego/v2/task"
- )
- func Task() {
- fmt.Println("start crawler")
- //SyncRankingFromShangHai()
- SyncRankingFromIne()
- refreshData := task.NewTask("refreshData", "0 0,30 16-23 * * *", RefreshData)
- task.AddTask("数据爬取", refreshData)
- task.StartTask()
- fmt.Println("end crawler")
- }
- func RefreshData(cont context.Context) (err error) {
- SyncRankingFromShangHai()
- SyncRankingFromIne()
- return
- }
|