Ejemplo n.º 1
0
func testRemoveFeedLoc() {
	err := dao.RemoveFeedLoc("506a4df0918d4a5951000001")
	if err != nil {
		log.Fatal(err)
	}
	log.Debugf("remove feed loc success")
}
Ejemplo n.º 2
0
func DeleteFeed(feed model.Feed) {
	f := func() {
		logstr := fmt.Sprintf("delete feed: %+v", feed)

		// insert feed del
		log.Infof("%s, insert into feed del", logstr)
		feeds := make([]model.Feed, 1)
		feeds[1] = feed
		err := dao.InsertFeedsDel(feeds)
		if err != nil {
			log.Errorf("%s, insert into feed del error: %s", logstr, err.Error())
		}

		// query and delete feed loc
		log.Infof("%s, query and feed loc", logstr)
		feedloc, err := dao.QueryFeedLoc(feed.Fid.Hex())
		if err != nil {
			log.Errorf("%s, query feed loc error: %s", logstr, err.Error())
		} else {
			err = dao.RemoveFeedLoc(feedloc.Fid)
			if err != nil {
				log.Errorf("%s, delete feed loc error: %s", logstr, err.Error())
			}

			locs := make([]model.FeedLoc, 1)
			locs[1] = feedloc
			err = dao.InsertFeedLocsDel(locs)
			if err != nil {
				log.Errorf("%s, insert into feed loc del error: %s", logstr, err.Error())
			}
		}

		// remove feed comment
		deleteFeedComments(feed)
	}
	go util.SafeEmptyFunc(f)()
}