fix add facebook page flow

This commit is contained in:
Jay 2019-08-26 04:04:46 +00:00
parent 703ffe34b2
commit b6aba699c9
2 changed files with 13 additions and 0 deletions

View File

@ -38,6 +38,9 @@ func GetFacebookPageByID(id string) (page *FacebookPageModel, err error) {
if err != nil && err != sql.ErrNoRows {
return
}
if err == sql.ErrNoRows {
page = nil
}
return page, nil
}

View File

@ -85,6 +85,16 @@ func addFacebookPage(info EvtInfo, fbid, tmpl string) string {
if err != nil {
return "write data fail"
}
rt, err := dsmodel.CreateFacebookRT(info.Channel, page.ID, tmpl)
if err != nil {
log.Println("create fail :: ", err)
return "create data fail"
}
err = rt.Write()
if err != nil {
return "write data fail"
}
} else {
fbrt, err := ch.GetFacebookPageByID(fbid)
if err != nil {