update code

This commit is contained in:
Jay
2019-07-21 09:41:06 +08:00
parent fd3bd2679e
commit 4f0b650ac2
5 changed files with 40 additions and 8 deletions
+29
View File
@@ -41,6 +41,35 @@ func GetFacebookPageByID(id string) (page *FacebookPageModel, err error) {
return
}
// GetFacebookPageListByChannel -
func GetFacebookPageListByChannel(channel string) (pages []*FacebookPageModel, err error) {
if len(channel) == 0 {
return nil, errors.New("channel is empty")
}
db := models.GetConn()
query := `select id, lastpost, ctime, mtime from public.facebook_page where channel = $1`
err = db.Select(&pages, query, channel)
if err != nil {
return nil, err
}
return
}
// GetFacebookPageByChannelAndID -
func GetFacebookPageByChannelAndID(id, channel string) (page *FacebookPageModel, err error) {
if len(channel) == 0 || len(id) == 0 {
return nil, errors.New("channel or id is empty")
}
db := models.GetConn()
page = &FacebookPageModel{}
query := `select id, lastpost, ctime, mtime from public.facebook_page where id = $1 and channel = $2`
err = db.Get(page, query, channel)
if err != nil {
return nil, err
}
return
}
// GetAllFacebookPage -
func GetAllFacebookPage() (pages []*FacebookPageModel, err error) {
db := models.GetConn()