update
This commit is contained in:
@@ -52,7 +52,6 @@ func GetAlbum(c *context.Context) {
|
||||
c.NotFound("album not found")
|
||||
return
|
||||
}
|
||||
log.Println(album)
|
||||
data := make(map[string]interface{})
|
||||
data["album"] = utils.ToMap(album)
|
||||
c.Success(data)
|
||||
|
||||
+28
-1
@@ -9,11 +9,12 @@ import (
|
||||
// GetAlbumPhotos -
|
||||
func GetAlbumPhotos(c *context.Context) {
|
||||
data, ok := c.Get("album")
|
||||
album := data.(models.Album)
|
||||
if !ok {
|
||||
c.NotFound("album not found")
|
||||
return
|
||||
}
|
||||
album := data.(*models.Album)
|
||||
data = nil
|
||||
|
||||
photos, err := models.GetPhotos(album.ID)
|
||||
if err != nil {
|
||||
@@ -32,5 +33,31 @@ func GetAlbumPhotos(c *context.Context) {
|
||||
|
||||
// GetPhoto -
|
||||
func GetPhoto(c *context.Context) {
|
||||
data, ok := c.Get("album")
|
||||
if !ok {
|
||||
c.NotFound("album not found")
|
||||
return
|
||||
}
|
||||
album := data.(*models.Album)
|
||||
data = nil
|
||||
var photoId string
|
||||
photoId = c.Param("photo")
|
||||
if len(photoId) == 0 {
|
||||
c.DataFormat("photo id not found")
|
||||
return
|
||||
}
|
||||
photo, err := models.GetPhoto(album.ID, photoId)
|
||||
if err != nil {
|
||||
c.ServerError(nil)
|
||||
return
|
||||
}
|
||||
if photo == nil {
|
||||
c.NotFound("photo not found")
|
||||
return
|
||||
}
|
||||
|
||||
res := make(map[string]interface{})
|
||||
res["photo"] = utils.ToMap(photo)
|
||||
|
||||
c.Success(res)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user