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 | 23 | DelayMessage.CDelayMessage.Find(bson.M{"UserId": c.Query("userid")}).All(&aDelayMessage) |
24 | 24 | |
25 | 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 | 34 | // @Title 创建提醒 | ... | ... |
API/Item.go
... | ... | @@ -28,22 +28,14 @@ func ItemInfo(c *gin.Context) { |
28 | 28 | return |
29 | 29 | } |
30 | 30 | |
31 | - var SItem *DB.SItem | |
31 | + var SItem DB.SItem | |
32 | 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 | 41 | // @Title 查询所有游玩项目 |
... | ... | @@ -122,7 +114,6 @@ type ItemTime struct { |
122 | 114 | Time string `json:"time"` |
123 | 115 | } |
124 | 116 | |
125 | - | |
126 | 117 | // @Title 更新等待时间 |
127 | 118 | // @Description 更新等待时间 |
128 | 119 | // @Accept json | ... | ... |
API/Line.go
... | ... | @@ -28,22 +28,13 @@ func LineInfo(c *gin.Context) { |
28 | 28 | return |
29 | 29 | } |
30 | 30 | |
31 | - var SLine *DB.SLine | |
31 | + var SLine DB.SLine | |
32 | 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 | 31 | var Scenic *DB.SScenic |
32 | 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 | 53 | var Location DB.SLocation |
63 | 54 | json.Unmarshal([]byte(c.PostForm("Location")), &Location) |
64 | 55 | |
65 | - var Picture []string | |
56 | + var Picture []DB.SPicture | |
66 | 57 | json.Unmarshal([]byte(c.PostForm("Picture")), &Picture) |
67 | 58 | |
68 | - var ShopAdPicture []string | |
59 | + var ShopAdPicture []DB.SPicture | |
69 | 60 | json.Unmarshal([]byte(c.PostForm("ShopAdPicture")), &ShopAdPicture) |
70 | 61 | |
71 | - var ItemScenicPicture []string | |
62 | + var ItemScenicPicture []DB.SPicture | |
72 | 63 | json.Unmarshal([]byte(c.PostForm("ItemScenicPicture")), &ItemScenicPicture) |
73 | 64 | |
74 | - var ActivityPicture []string | |
65 | + var ActivityPicture []DB.SPicture | |
75 | 66 | json.Unmarshal([]byte(c.PostForm("ActivityPicture")), &ActivityPicture) |
76 | 67 | |
77 | - var VideoList []string | |
68 | + var VideoList []DB.SPicture | |
78 | 69 | json.Unmarshal([]byte(c.PostForm("VideoList")), &VideoList) |
79 | 70 | |
71 | + | |
80 | 72 | var id bson.ObjectId |
81 | 73 | if pid := c.PostForm("id"); pid == "null" { |
82 | 74 | id = bson.NewObjectId() |
... | ... | @@ -123,17 +115,12 @@ func AllScenic(c *gin.Context) { |
123 | 115 | DB.CScenic.Find(bson.M{}).All(&Scenic) |
124 | 116 | |
125 | 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 | 28 | return |
29 | 29 | } |
30 | 30 | |
31 | - var SCommodity *DB.SCommodity | |
31 | + var SCommodity DB.SCommodity | |
32 | 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 | 73 | var TopPhoto []string |
83 | 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 | 79 | var id bson.ObjectId |
89 | 80 | if pid := c.PostForm("id"); pid == "null" { |
... | ... | @@ -100,7 +91,7 @@ func UpdateCommodity(c *gin.Context) { |
100 | 91 | "ShopName": c.PostForm("ShopName"), |
101 | 92 | "KvPhoto": c.PostForm("KvPhoto"), |
102 | 93 | "TopPhoto": TopPhoto, |
103 | - "Location": Location, | |
94 | + "ItemId": c.PostForm("ItemId"), | |
104 | 95 | "Images": Picture, |
105 | 96 | }}, |
106 | 97 | ) | ... | ... |
API/Tag.go
... | ... | @@ -18,22 +18,16 @@ func AllTag(c *gin.Context) { |
18 | 18 | c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) |
19 | 19 | c.Header("Access-Control-Allow-Credentials", "true") |
20 | 20 | |
21 | - | |
22 | 21 | var Stags []*DB.STag |
23 | 22 | DB.CTags.Find(bson.M{}).All(&Stags) |
24 | 23 | |
25 | 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 | 196 | return |
197 | 197 | } |
198 | 198 | |
199 | - var User *DB.SMember | |
199 | + var User DB.SMember | |
200 | 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 | 73 | Name string `bson:"Name" json:"Name"` |
74 | 74 | Price string `bson:"Price" json:"Price"` |
75 | 75 | ShopName string `bson:"ShopName" json:"ShopName"` |
76 | - Location SLocation `bson:"Location" json:"Location"` | |
76 | + ItemId string `bson:"ItemId" json:"ItemId"` //项目id | |
77 | 77 | KvPhoto string `bson:"KvPhoto" json:"KvPhoto"` //用于列表页的图片 |
78 | 78 | TopPhoto []string `bson:"TopPhoto" json:"TopPhoto"` //详情页最上面的轮播图 |
79 | 79 | Images []string `bson:"Images" json:"Images"` //详情页下面的产品详细图 |
... | ... | @@ -116,6 +116,11 @@ type STag struct { |
116 | 116 | Type string `bson:"Type" json:"Type"` |
117 | 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 | 124 | type SScenic struct { |
120 | 125 | Id *bson.ObjectId `bson:"_id" json:"Id" valid:"required"` |
121 | 126 | Name string `bson:"Name" json:"Name"` |
... | ... | @@ -124,9 +129,9 @@ type SScenic struct { |
124 | 129 | Mobile string `bson:"Mobile" json:"Mobile"` |
125 | 130 | Address string `bson:"Address" json:"Address"` |
126 | 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 | } | ... | ... |