spider-scheduler/pkg/task/liveroom.go

47 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package task
//func UpdateLiveRoomInfo() {
// // 预查询数量
// // TODO: 预查询数量和分页策略功能可复用
// var count int64
// tx := dao.DB().Model(&model.Furry{}).Count(&count)
// if tx.Error != nil {
// err := exception.ErrFetchFurries("获取furries数量失败" + tx.Error.Error())
// log.Logger().Errorf("获取furries数量失败%s", err)
// return
// }
//
// pageSize := 32
// maxPage := int(math.Ceil(float64(count) / float64(pageSize)))
// for page := 0; page <= maxPage; page++ {
// // 获取目标用户列表(分页)
// users, err := logic.GetUsers(page, pageSize)
// if err != nil {
// log.Logger().Errorf("获取用户列表时发生错误:%s", err)
// continue
// }
// // 已获取完毕
// if users == nil {
// return
// }
// // 抽取uid列表
// var uids []uint
// for _, user := range users {
// uids = append(uids, user.UID)
// }
// // 通过API获取用户信息
// infos := logic.BatchGetUserInfo(&uids)
//
// // 更新live_rooms表
// c, err := logic.UpdateLiveRoom(infos)
// if err != nil {
// log.Logger().Errorf("更新数据时发生错误:%s", err)
// continue
// }
// log.Logger().Infof("成功更新了%d个用户信息", c)
// // delay
// time.Sleep(2 * time.Second)
// }
//
//}