add options , config

This commit is contained in:
Jay
2018-05-08 16:19:51 +08:00
parent 80e5f0b19c
commit fe884e6931
10 changed files with 172 additions and 12 deletions
+3 -3
View File
@@ -35,7 +35,7 @@ func GetAllAlbums(c *context.Context) {
// GetAlbum -
func GetAlbum(c *context.Context) {
id := c.Param("id")
id := c.Param("album")
val, ok := c.Get("token")
if !ok {
c.CustomRes("Foridden", "user token data not found")
@@ -99,7 +99,7 @@ func CreateAlbum(c *context.Context) {
// UpdateAlbum -
func UpdateAlbum(c *context.Context) {
id := c.Param("id")
id := c.Param("album")
postData := struct {
Name string `json:"name" binding:"required"`
Public bool `json:"public" binding:"required"`
@@ -146,7 +146,7 @@ func UpdateAlbum(c *context.Context) {
// DeleteAlbum -
func DeleteAlbum(c *context.Context) {
id := c.Param("id")
id := c.Param("album")
if len(id) == 0 {
c.NotFound(nil)
return
+4 -2
View File
@@ -12,12 +12,14 @@ func GetAllAlbumPhotos(c *context.Context) {
// GetPhoto -
func GetPhoto(c *context.Context) {
album, ok := c.Get("album")
data, ok := c.Get("album")
album := data.(models.Album)
if !ok {
c.NotFound("album not found")
return
}
_, err := models.GetPhoto(album.(map[string]interface{})["id"].(string))
_, err := models.GetPhoto(album.ID)
if err != nil {
c.ServerError(nil)
return