Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zituocn committed Oct 26, 2016
1 parent 5c534a7 commit 37f2558
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func PushBaidu() error {
query := info.Query()
query = query.Filter("status__gte", 0)
query = query.Filter("ispush", 0).OrderBy("id")
query.Limit(100, 0).All(&list, "id") //一次100条数据...
query.Limit(20, 0).All(&list, "id") //一次20条数据...

//构造url和ids
if len(list) > 0 {
Expand All @@ -56,15 +56,19 @@ func PushBaidu() error {
}
}

o := orm.NewOrm()
o.QueryTable("movie_info").Filter("id__in", ids).Update(orm.Params{
"Ispush": 1,
})
if len(ids) > 0 {
o := orm.NewOrm()
o.QueryTable("movie_info").Filter("id__in", ids).Update(orm.Params{
"Ispush": 1,
})
}

//向baidu接口push信息
req := httplib.Post(push_url)
req.Body(strings.Join(urls, "\n"))
result, _ := req.String()
beego.Info(result)
if len(urls) > 0 {
//向baidu接口push信息
req := httplib.Post(push_url)
req.Body(strings.Join(urls, "\n"))
result, _ := req.String()
beego.Info(result)
}
return nil
}

0 comments on commit 37f2558

Please sign in to comment.