update
This commit is contained in:
+17
-8
@@ -3,15 +3,11 @@ package album
|
||||
import (
|
||||
"git.trj.tw/golang/go-gallery/models"
|
||||
"git.trj.tw/golang/go-gallery/modules/context"
|
||||
"git.trj.tw/golang/go-gallery/modules/utils"
|
||||
)
|
||||
|
||||
// GetAllAlbumPhotos -
|
||||
func GetAllAlbumPhotos(c *context.Context) {
|
||||
|
||||
}
|
||||
|
||||
// GetPhoto -
|
||||
func GetPhoto(c *context.Context) {
|
||||
// GetAlbumPhotos -
|
||||
func GetAlbumPhotos(c *context.Context) {
|
||||
data, ok := c.Get("album")
|
||||
album := data.(models.Album)
|
||||
if !ok {
|
||||
@@ -19,9 +15,22 @@ func GetPhoto(c *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
_, err := models.GetPhoto(album.ID)
|
||||
photos, err := models.GetPhotos(album.ID)
|
||||
if err != nil {
|
||||
c.ServerError(nil)
|
||||
return
|
||||
}
|
||||
|
||||
res := make(map[string]interface{})
|
||||
res["photos"] = make([]map[string]interface{}, 0)
|
||||
for _, v := range photos {
|
||||
res["photos"] = append(res["photos"].([]map[string]interface{}), utils.ToMap(v))
|
||||
}
|
||||
|
||||
c.Success(res)
|
||||
}
|
||||
|
||||
// GetPhoto -
|
||||
func GetPhoto(c *context.Context) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user