Commit 7cce0d4a22fb99185af34939851db57a04ac1310
1 parent
d6a714e9
Exists in
v1.2
and in
2 other branches
..
Showing
8 changed files
with
61 additions
and
117 deletions
Show diff stats
API/DealyMessage.go
| @@ -23,18 +23,12 @@ func DealyMessageInfo(c *gin.Context) { | @@ -23,18 +23,12 @@ func DealyMessageInfo(c *gin.Context) { | ||
| 23 | DelayMessage.CDelayMessage.Find(bson.M{"UserId": c.Query("userid")}).All(&aDelayMessage) | 23 | DelayMessage.CDelayMessage.Find(bson.M{"UserId": c.Query("userid")}).All(&aDelayMessage) |
| 24 | 24 | ||
| 25 | if aDelayMessage == nil { | 25 | if aDelayMessage == nil { |
| 26 | - | ||
| 27 | - c.JSON(200, tools.ResponseError{ | ||
| 28 | - 1, | ||
| 29 | - "空", | ||
| 30 | - }) | ||
| 31 | - } else { | ||
| 32 | - | ||
| 33 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 34 | - 0, | ||
| 35 | - aDelayMessage, | ||
| 36 | - }) | 26 | + aDelayMessage = []DelayMessage.Message{} |
| 37 | } | 27 | } |
| 28 | + c.JSON(200, tools.ResponseSeccess{ | ||
| 29 | + 0, | ||
| 30 | + aDelayMessage, | ||
| 31 | + }) | ||
| 38 | } | 32 | } |
| 39 | 33 | ||
| 40 | // @Title 创建提醒 | 34 | // @Title 创建提醒 |
API/Item.go
| @@ -28,22 +28,14 @@ func ItemInfo(c *gin.Context) { | @@ -28,22 +28,14 @@ func ItemInfo(c *gin.Context) { | ||
| 28 | return | 28 | return |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | - var SItem *DB.SItem | 31 | + var SItem DB.SItem |
| 32 | DB.CItem.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&SItem) | 32 | DB.CItem.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&SItem) |
| 33 | 33 | ||
| 34 | - if SItem == nil { | ||
| 35 | - | ||
| 36 | - c.JSON(200, tools.ResponseError{ | ||
| 37 | - 1, | ||
| 38 | - "空", | ||
| 39 | - }) | ||
| 40 | - } else { | 34 | + c.JSON(200, tools.ResponseSeccess{ |
| 35 | + 0, | ||
| 36 | + SItem, | ||
| 37 | + }) | ||
| 41 | 38 | ||
| 42 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 43 | - 0, | ||
| 44 | - SItem, | ||
| 45 | - }) | ||
| 46 | - } | ||
| 47 | } | 39 | } |
| 48 | 40 | ||
| 49 | // @Title 查询所有游玩项目 | 41 | // @Title 查询所有游玩项目 |
| @@ -122,7 +114,6 @@ type ItemTime struct { | @@ -122,7 +114,6 @@ type ItemTime struct { | ||
| 122 | Time string `json:"time"` | 114 | Time string `json:"time"` |
| 123 | } | 115 | } |
| 124 | 116 | ||
| 125 | - | ||
| 126 | // @Title 更新等待时间 | 117 | // @Title 更新等待时间 |
| 127 | // @Description 更新等待时间 | 118 | // @Description 更新等待时间 |
| 128 | // @Accept json | 119 | // @Accept json |
API/Line.go
| @@ -28,22 +28,13 @@ func LineInfo(c *gin.Context) { | @@ -28,22 +28,13 @@ func LineInfo(c *gin.Context) { | ||
| 28 | return | 28 | return |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | - var SLine *DB.SLine | 31 | + var SLine DB.SLine |
| 32 | DB.CLine.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&SLine) | 32 | DB.CLine.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&SLine) |
| 33 | 33 | ||
| 34 | - if SLine == nil { | ||
| 35 | - | ||
| 36 | - c.JSON(200, tools.ResponseError{ | ||
| 37 | - 1, | ||
| 38 | - "空", | ||
| 39 | - }) | ||
| 40 | - } else { | ||
| 41 | - | ||
| 42 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 43 | - 0, | ||
| 44 | - SLine, | ||
| 45 | - }) | ||
| 46 | - } | 34 | + c.JSON(200, tools.ResponseSeccess{ |
| 35 | + 0, | ||
| 36 | + SLine, | ||
| 37 | + }) | ||
| 47 | 38 | ||
| 48 | } | 39 | } |
| 49 | 40 |
API/Scenic.go
| @@ -31,19 +31,10 @@ func ScenicInfo(c *gin.Context) { | @@ -31,19 +31,10 @@ func ScenicInfo(c *gin.Context) { | ||
| 31 | var Scenic *DB.SScenic | 31 | var Scenic *DB.SScenic |
| 32 | DB.CScenic.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&Scenic) | 32 | DB.CScenic.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&Scenic) |
| 33 | 33 | ||
| 34 | - if Scenic == nil { | ||
| 35 | - | ||
| 36 | - c.JSON(200, tools.ResponseError{ | ||
| 37 | - 1, | ||
| 38 | - "空", | ||
| 39 | - }) | ||
| 40 | - } else { | ||
| 41 | - | ||
| 42 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 43 | - 0, | ||
| 44 | - Scenic, | ||
| 45 | - }) | ||
| 46 | - } | 34 | + c.JSON(200, tools.ResponseSeccess{ |
| 35 | + 0, | ||
| 36 | + Scenic, | ||
| 37 | + }) | ||
| 47 | 38 | ||
| 48 | } | 39 | } |
| 49 | 40 | ||
| @@ -62,21 +53,22 @@ func UpdateScenic(c *gin.Context) { | @@ -62,21 +53,22 @@ func UpdateScenic(c *gin.Context) { | ||
| 62 | var Location DB.SLocation | 53 | var Location DB.SLocation |
| 63 | json.Unmarshal([]byte(c.PostForm("Location")), &Location) | 54 | json.Unmarshal([]byte(c.PostForm("Location")), &Location) |
| 64 | 55 | ||
| 65 | - var Picture []string | 56 | + var Picture []DB.SPicture |
| 66 | json.Unmarshal([]byte(c.PostForm("Picture")), &Picture) | 57 | json.Unmarshal([]byte(c.PostForm("Picture")), &Picture) |
| 67 | 58 | ||
| 68 | - var ShopAdPicture []string | 59 | + var ShopAdPicture []DB.SPicture |
| 69 | json.Unmarshal([]byte(c.PostForm("ShopAdPicture")), &ShopAdPicture) | 60 | json.Unmarshal([]byte(c.PostForm("ShopAdPicture")), &ShopAdPicture) |
| 70 | 61 | ||
| 71 | - var ItemScenicPicture []string | 62 | + var ItemScenicPicture []DB.SPicture |
| 72 | json.Unmarshal([]byte(c.PostForm("ItemScenicPicture")), &ItemScenicPicture) | 63 | json.Unmarshal([]byte(c.PostForm("ItemScenicPicture")), &ItemScenicPicture) |
| 73 | 64 | ||
| 74 | - var ActivityPicture []string | 65 | + var ActivityPicture []DB.SPicture |
| 75 | json.Unmarshal([]byte(c.PostForm("ActivityPicture")), &ActivityPicture) | 66 | json.Unmarshal([]byte(c.PostForm("ActivityPicture")), &ActivityPicture) |
| 76 | 67 | ||
| 77 | - var VideoList []string | 68 | + var VideoList []DB.SPicture |
| 78 | json.Unmarshal([]byte(c.PostForm("VideoList")), &VideoList) | 69 | json.Unmarshal([]byte(c.PostForm("VideoList")), &VideoList) |
| 79 | 70 | ||
| 71 | + | ||
| 80 | var id bson.ObjectId | 72 | var id bson.ObjectId |
| 81 | if pid := c.PostForm("id"); pid == "null" { | 73 | if pid := c.PostForm("id"); pid == "null" { |
| 82 | id = bson.NewObjectId() | 74 | id = bson.NewObjectId() |
| @@ -123,17 +115,12 @@ func AllScenic(c *gin.Context) { | @@ -123,17 +115,12 @@ func AllScenic(c *gin.Context) { | ||
| 123 | DB.CScenic.Find(bson.M{}).All(&Scenic) | 115 | DB.CScenic.Find(bson.M{}).All(&Scenic) |
| 124 | 116 | ||
| 125 | if Scenic == nil { | 117 | if Scenic == nil { |
| 126 | - | ||
| 127 | - c.JSON(200, tools.ResponseError{ | ||
| 128 | - 1, | ||
| 129 | - "空", | ||
| 130 | - }) | ||
| 131 | - } else { | ||
| 132 | - | ||
| 133 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 134 | - 0, | ||
| 135 | - Scenic, | ||
| 136 | - }) | 118 | + Scenic = []*DB.SScenic{} |
| 137 | } | 119 | } |
| 138 | 120 | ||
| 121 | + c.JSON(200, tools.ResponseSeccess{ | ||
| 122 | + 0, | ||
| 123 | + Scenic, | ||
| 124 | + }) | ||
| 125 | + | ||
| 139 | } | 126 | } |
API/Shop.go
| @@ -28,22 +28,13 @@ func CommodityInfo(c *gin.Context) { | @@ -28,22 +28,13 @@ func CommodityInfo(c *gin.Context) { | ||
| 28 | return | 28 | return |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | - var SCommodity *DB.SCommodity | 31 | + var SCommodity DB.SCommodity |
| 32 | DB.CCommodity.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&SCommodity) | 32 | DB.CCommodity.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&SCommodity) |
| 33 | 33 | ||
| 34 | - if SCommodity == nil { | ||
| 35 | - | ||
| 36 | - c.JSON(200, tools.ResponseError{ | ||
| 37 | - 1, | ||
| 38 | - "空", | ||
| 39 | - }) | ||
| 40 | - } else { | ||
| 41 | - | ||
| 42 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 43 | - 0, | ||
| 44 | - SCommodity, | ||
| 45 | - }) | ||
| 46 | - } | 34 | + c.JSON(200, tools.ResponseSeccess{ |
| 35 | + 0, | ||
| 36 | + SCommodity, | ||
| 37 | + }) | ||
| 47 | 38 | ||
| 48 | } | 39 | } |
| 49 | 40 | ||
| @@ -82,8 +73,8 @@ func UpdateCommodity(c *gin.Context) { | @@ -82,8 +73,8 @@ func UpdateCommodity(c *gin.Context) { | ||
| 82 | var TopPhoto []string | 73 | var TopPhoto []string |
| 83 | json.Unmarshal([]byte(c.PostForm("TopPhoto")), &TopPhoto) | 74 | json.Unmarshal([]byte(c.PostForm("TopPhoto")), &TopPhoto) |
| 84 | 75 | ||
| 85 | - var Location DB.SLocation | ||
| 86 | - json.Unmarshal([]byte(c.PostForm("Location")), &Location) | 76 | + //var Location DB.SLocation |
| 77 | + //json.Unmarshal([]byte(c.PostForm("Location")), &Location) | ||
| 87 | 78 | ||
| 88 | var id bson.ObjectId | 79 | var id bson.ObjectId |
| 89 | if pid := c.PostForm("id"); pid == "null" { | 80 | if pid := c.PostForm("id"); pid == "null" { |
| @@ -100,7 +91,7 @@ func UpdateCommodity(c *gin.Context) { | @@ -100,7 +91,7 @@ func UpdateCommodity(c *gin.Context) { | ||
| 100 | "ShopName": c.PostForm("ShopName"), | 91 | "ShopName": c.PostForm("ShopName"), |
| 101 | "KvPhoto": c.PostForm("KvPhoto"), | 92 | "KvPhoto": c.PostForm("KvPhoto"), |
| 102 | "TopPhoto": TopPhoto, | 93 | "TopPhoto": TopPhoto, |
| 103 | - "Location": Location, | 94 | + "ItemId": c.PostForm("ItemId"), |
| 104 | "Images": Picture, | 95 | "Images": Picture, |
| 105 | }}, | 96 | }}, |
| 106 | ) | 97 | ) |
API/Tag.go
| @@ -18,22 +18,16 @@ func AllTag(c *gin.Context) { | @@ -18,22 +18,16 @@ func AllTag(c *gin.Context) { | ||
| 18 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | 18 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
| 19 | c.Header("Access-Control-Allow-Credentials", "true") | 19 | c.Header("Access-Control-Allow-Credentials", "true") |
| 20 | 20 | ||
| 21 | - | ||
| 22 | var Stags []*DB.STag | 21 | var Stags []*DB.STag |
| 23 | DB.CTags.Find(bson.M{}).All(&Stags) | 22 | DB.CTags.Find(bson.M{}).All(&Stags) |
| 24 | 23 | ||
| 25 | if Stags == nil { | 24 | if Stags == nil { |
| 26 | - | ||
| 27 | - c.JSON(200, tools.ResponseError{ | ||
| 28 | - 1, | ||
| 29 | - "空", | ||
| 30 | - }) | ||
| 31 | - } else { | ||
| 32 | - | ||
| 33 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 34 | - 0, | ||
| 35 | - Stags, | ||
| 36 | - }) | 25 | + Stags = []*DB.STag{} |
| 37 | } | 26 | } |
| 38 | 27 | ||
| 28 | + c.JSON(200, tools.ResponseSeccess{ | ||
| 29 | + 0, | ||
| 30 | + Stags, | ||
| 31 | + }) | ||
| 32 | + | ||
| 39 | } | 33 | } |
API/User.go
| @@ -196,22 +196,13 @@ func UserInfo(c *gin.Context) { | @@ -196,22 +196,13 @@ func UserInfo(c *gin.Context) { | ||
| 196 | return | 196 | return |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | - var User *DB.SMember | 199 | + var User DB.SMember |
| 200 | DB.CMember.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&User) | 200 | DB.CMember.Find(bson.M{"_id": bson.ObjectIdHex(c.Query("id"))}).One(&User) |
| 201 | 201 | ||
| 202 | - if User == nil { | ||
| 203 | - | ||
| 204 | - c.JSON(200, tools.ResponseError{ | ||
| 205 | - 1, | ||
| 206 | - "空", | ||
| 207 | - }) | ||
| 208 | - } else { | ||
| 209 | - | ||
| 210 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 211 | - 0, | ||
| 212 | - User, | ||
| 213 | - }) | ||
| 214 | - } | 202 | + c.JSON(200, tools.ResponseSeccess{ |
| 203 | + 0, | ||
| 204 | + User, | ||
| 205 | + }) | ||
| 215 | 206 | ||
| 216 | } | 207 | } |
| 217 | 208 |
DB/db.go
| @@ -73,7 +73,7 @@ type SCommodity struct { | @@ -73,7 +73,7 @@ type SCommodity struct { | ||
| 73 | Name string `bson:"Name" json:"Name"` | 73 | Name string `bson:"Name" json:"Name"` |
| 74 | Price string `bson:"Price" json:"Price"` | 74 | Price string `bson:"Price" json:"Price"` |
| 75 | ShopName string `bson:"ShopName" json:"ShopName"` | 75 | ShopName string `bson:"ShopName" json:"ShopName"` |
| 76 | - Location SLocation `bson:"Location" json:"Location"` | 76 | + ItemId string `bson:"ItemId" json:"ItemId"` //项目id |
| 77 | KvPhoto string `bson:"KvPhoto" json:"KvPhoto"` //用于列表页的图片 | 77 | KvPhoto string `bson:"KvPhoto" json:"KvPhoto"` //用于列表页的图片 |
| 78 | TopPhoto []string `bson:"TopPhoto" json:"TopPhoto"` //详情页最上面的轮播图 | 78 | TopPhoto []string `bson:"TopPhoto" json:"TopPhoto"` //详情页最上面的轮播图 |
| 79 | Images []string `bson:"Images" json:"Images"` //详情页下面的产品详细图 | 79 | Images []string `bson:"Images" json:"Images"` //详情页下面的产品详细图 |
| @@ -116,6 +116,11 @@ type STag struct { | @@ -116,6 +116,11 @@ type STag struct { | ||
| 116 | Type string `bson:"Type" json:"Type"` | 116 | Type string `bson:"Type" json:"Type"` |
| 117 | Name string `bson:"Name" json:"Name"` | 117 | Name string `bson:"Name" json:"Name"` |
| 118 | } | 118 | } |
| 119 | + | ||
| 120 | +type SPicture struct { | ||
| 121 | + Src string `bson:"Src" json:"Src"` | ||
| 122 | + Link string `bson:"Link" json:"Link"` | ||
| 123 | +} | ||
| 119 | type SScenic struct { | 124 | type SScenic struct { |
| 120 | Id *bson.ObjectId `bson:"_id" json:"Id" valid:"required"` | 125 | Id *bson.ObjectId `bson:"_id" json:"Id" valid:"required"` |
| 121 | Name string `bson:"Name" json:"Name"` | 126 | Name string `bson:"Name" json:"Name"` |
| @@ -124,9 +129,9 @@ type SScenic struct { | @@ -124,9 +129,9 @@ type SScenic struct { | ||
| 124 | Mobile string `bson:"Mobile" json:"Mobile"` | 129 | Mobile string `bson:"Mobile" json:"Mobile"` |
| 125 | Address string `bson:"Address" json:"Address"` | 130 | Address string `bson:"Address" json:"Address"` |
| 126 | Location SLocation `bson:"Location" json:"Location"` | 131 | Location SLocation `bson:"Location" json:"Location"` |
| 127 | - Picture []string `bson:"Picture" json:"Picture"` | ||
| 128 | - ShopAdPicture []string `bson:"ShopAdPicture" json:"ShopAdPicture"` //商城列表页图片 | ||
| 129 | - ItemScenicPicture []string `bson:"ItemScenicPicture" json:"ItemScenicPicture"` //项目场次照片 | ||
| 130 | - ActivityPicture []string `bson:"ActivityPicture" json:"ActivityPicture"` //活动照片 | ||
| 131 | - VideoList []string `bson:"VideoList" json:"VideoList"` | 132 | + Picture []SPicture `bson:"Picture" json:"Picture"` |
| 133 | + ShopAdPicture []SPicture `bson:"ShopAdPicture" json:"ShopAdPicture"` //商城列表页图片 | ||
| 134 | + ItemScenicPicture []SPicture `bson:"ItemScenicPicture" json:"ItemScenicPicture"` //项目场次照片 | ||
| 135 | + ActivityPicture []SPicture `bson:"ActivityPicture" json:"ActivityPicture"` //活动照片 | ||
| 136 | + VideoList []SPicture `bson:"VideoList" json:"VideoList"` | ||
| 132 | } | 137 | } |