diff --git a/API/Item.go b/API/Item.go index 1088eec..b1c6095 100644 --- a/API/Item.go +++ b/API/Item.go @@ -3,6 +3,7 @@ package Api import ( "encoding/json" "github.com/aarongao/tools" + "github.com/asaskevich/govalidator" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" @@ -10,6 +11,7 @@ import ( "letu/DB" "letu/Lib/Auth" "strconv" + "strings" "time" ) @@ -18,7 +20,7 @@ import ( // @Accept json // @Produce json // @Param id 5dfb03070a9ac17ac7a82054 string true "设备id" -// @Success 200 {object} tools.ResponseSeccess "Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运" +// @Success 200 {object} tools.ResponseSeccess "Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运;Display是否在前台显示;ReminderInterval排队提醒间隔时间(用逗号分割如60,90,120)" // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" // @Router /ItemInfo? [get] func ItemInfo(c *gin.Context) { @@ -49,15 +51,20 @@ func ItemInfo(c *gin.Context) { // @Accept json // @Produce json // @Param ScenicId 5dfb03070a9ac17ac7a82054 string true "景区id" -// @Success 200 {object} tools.ResponseSeccess "Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运" +// @Success 200 {object} tools.ResponseSeccess "Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运;Display是否在前台显示;ReminderInterval排队提醒间隔时间(用逗号分割如60,90,120)" // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" // @Router /AllItems? [get] func AllItems(c *gin.Context) { c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) c.Header("Access-Control-Allow-Credentials", "true") + _select := bson.M{"ScenicId": c.Query("ScenicId"), "Display": true} + if c.Query("Display") == "all"{ + _select = bson.M{"ScenicId": c.Query("ScenicId")} + } + var aItems = []DB.SItem{} - cur, err := DB.CItem.Find(tools.GetContext(), bson.M{"ScenicId": c.Query("ScenicId")}) + cur, err := DB.CItem.Find(tools.GetContext(), _select) defer cur.Close(tools.GetContext()) if err == nil { for cur.Next(tools.GetContext()) { @@ -105,6 +112,11 @@ func UpdateItem(c *gin.Context) { var Picture []string json.Unmarshal([]byte(c.PostForm("Picture")), &Picture) + var CustomAttribute []DB.SCustomAttribute + json.Unmarshal([]byte(c.PostForm("CustomAttribute")), &CustomAttribute) + + var ReminderInterval = strings.Split(c.PostForm("ReminderInterval"),",") + var id primitive.ObjectID if pid := c.PostForm("id"); pid == "null" { id = primitive.NewObjectID() @@ -113,30 +125,49 @@ func UpdateItem(c *gin.Context) { } poststate, _ := strconv.Atoi(c.PostForm("State")) + Display, _ := strconv.ParseBool(c.PostForm("Display")) + WaitingTimeDisplay, _ := strconv.ParseBool(c.PostForm("WaitingTimeDisplay")) + + + Item := &DB.SItem{ + Id: &id, + Name: c.PostForm("Name"), + SubName: c.PostForm("SubName"), + ScenicId: c.PostForm("ScenicId"), + Location: Location, + Icon: c.PostForm("Icon"), + LimitHeight: c.PostForm("LimitHeight"), + PlayDuration: c.PostForm("PlayDuration"), + SceneTime: c.PostForm("SceneTime"), + Picture: Picture, + Voice: c.PostForm("Voice"), + Tel: c.PostForm("Tel"), + AverageConsumption: c.PostForm("AverageConsumption"), + Menu: c.PostForm("Menu"), + Tags: Tags, + OpenHours: c.PostForm("OpenHours"), + LocationDescription: c.PostForm("LocationDescription"), + Reminder: c.PostForm("Reminder"), + State: poststate, + CustomAttribute: CustomAttribute, + Display: Display, + WaitingTimeDisplay: WaitingTimeDisplay, + ReminderInterval: ReminderInterval, + } + + _, err = govalidator.ValidateStruct(Item); + if err != nil { + c.JSON(200, tools.ResponseError{ + 1, + err.Error(), + }) + return + } upsert := true DB.CItem.FindOneAndUpdate(tools.GetContext(), bson.M{"_id": id}, - bson.M{"$set": bson.M{ - "Name": c.PostForm("Name"), - "SubName": c.PostForm("SubName"), - "ScenicId": c.PostForm("ScenicId"), - "Location": Location, - "Icon": c.PostForm("Icon"), - "LimitHeight": c.PostForm("LimitHeight"), - "PlayDuration": c.PostForm("PlayDuration"), - "SceneTime": c.PostForm("SceneTime"), - "Picture": Picture, - "Voice": c.PostForm("Voice"), - "Tel": c.PostForm("Tel"), - "AverageConsumption": c.PostForm("AverageConsumption"), - "Menu": c.PostForm("Menu"), - "Tags": Tags, - "OpenHours": c.PostForm("OpenHours"), - "LocationDescription": c.PostForm("LocationDescription"), - "Reminder": c.PostForm("Reminder"), - "State": poststate, - }}, &options.FindOneAndUpdateOptions{ + bson.M{"$set": Item}, &options.FindOneAndUpdateOptions{ Upsert: &upsert, }, ) @@ -155,7 +186,7 @@ func UpdateItem(c *gin.Context) { // ItemTime[c.PostForm("id")] = "0" //} - DB.Redis.Set("AllItemTime_" + c.PostForm("ScenicId"), ItemTime, time.Second*60*60*24*30) + DB.Redis.Set("AllItemTime_"+c.PostForm("ScenicId"), ItemTime, time.Second*60*60*24*30) c.JSON(200, tools.ResponseSeccess{ 0, diff --git a/API/Scenic.go b/API/Scenic.go index 58979ac..09305dd 100644 --- a/API/Scenic.go +++ b/API/Scenic.go @@ -217,101 +217,120 @@ func initScenic(id string) { dba = append(dba, DB.STag{ id, "type", + "基础类型", "服务设施", }) dba = append(dba, DB.STag{ id, "type", + "基础类型", "普通", }) dba = append(dba, DB.STag{ id, "type", + "基础类型", "演出", }) dba = append(dba, DB.STag{ id, "type", + "基础类型", "购物", }) dba = append(dba, DB.STag{ id, "type", + "基础类型", "餐饮", }) dba = append(dba, DB.STag{ id, "type", + "基础类型", "游乐设施", }) dba = append(dba, DB.STag{ id, "age", + "年龄段", "儿童", }) dba = append(dba, DB.STag{ id, "age", + "年龄段", "成人", }) dba = append(dba, DB.STag{ id, "age", + "年龄段", "青少年", }) dba = append(dba, DB.STag{ id, "food", + "餐饮类型", "海鲜", }) dba = append(dba, DB.STag{ id, "food", + "餐饮类型", "团餐", }) dba = append(dba, DB.STag{ id, "food", + "餐饮类型", "烧烤", }) dba = append(dba, DB.STag{ id, "food", + "餐饮类型", "小吃", }) dba = append(dba, DB.STag{ id, "recommend", + "推荐指数", "必玩", }) dba = append(dba, DB.STag{ id, "shop", + "商品分类", "纪念品", }) dba = append(dba, DB.STag{ id, "shop", + "商品分类", "收藏品", }) dba = append(dba, DB.STag{ id, "shop", + "商品分类", "玩具", }) dba = append(dba, DB.STag{ id, "thrilling", + "体验感受", "刺激", }) dba = append(dba, DB.STag{ id, "thrilling", + "体验感受", "放松", }) diff --git a/API/Shop.go b/API/Shop.go index b1f11e6..e487b60 100644 --- a/API/Shop.go +++ b/API/Shop.go @@ -9,6 +9,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" "letu/DB" "letu/Lib/Auth" + "strconv" ) // @Title 查询商品信息 @@ -16,7 +17,7 @@ import ( // @Accept json // @Produce json // @Param id 5dfb03070a9ac17ac7a82054 string true "id" -// @Success 200 {object} tools.ResponseSeccess "Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图" +// @Success 200 {object} tools.ResponseSeccess "Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图; Display是否在前台显示" // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" // @Router /CommodityInfo? [get] func CommodityInfo(c *gin.Context) { @@ -47,15 +48,20 @@ func CommodityInfo(c *gin.Context) { // @Accept json // @Produce json // @Param ScenicId 5dfb03070a9ac17ac7a82054 string true "景区id" -// @Success 200 {object} tools.ResponseSeccess "Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图" +// @Success 200 {object} tools.ResponseSeccess "Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图; Display是否在前台显示" // @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" // @Router /AllCommodity? [get] func AllCommodity(c *gin.Context) { c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) c.Header("Access-Control-Allow-Credentials", "true") + _select := bson.M{"ScenicId": c.Query("ScenicId"), "Display": true} + if c.Query("Display") == "all"{ + _select = bson.M{"ScenicId": c.Query("ScenicId")} + } + var aCommoditys = []DB.SCommodity{} - cur, err := DB.CCommodity.Find(tools.GetContext(), bson.M{"ScenicId": c.Query("ScenicId")}) + cur, err := DB.CCommodity.Find(tools.GetContext(), _select) defer cur.Close(tools.GetContext()) if err == nil { for cur.Next(tools.GetContext()) { @@ -110,6 +116,7 @@ func UpdateCommodity(c *gin.Context) { } upsert := true + Display, _ := strconv.ParseBool(c.PostForm("Display")) DB.CCommodity.FindOneAndUpdate(tools.GetContext(), bson.M{"_id": id}, bson.M{"$set": bson.M{ @@ -120,6 +127,7 @@ func UpdateCommodity(c *gin.Context) { "TopPhoto": TopPhoto, "ItemId": c.PostForm("ItemId"), "Images": Picture, + "Display": Display, }}, &options.FindOneAndUpdateOptions{ Upsert: &upsert, }, diff --git a/API/Tag.go b/API/Tag.go index 8e1e0df..4f770b8 100644 --- a/API/Tag.go +++ b/API/Tag.go @@ -179,6 +179,7 @@ func CreateTag(c *gin.Context) { DB.CTags.InsertOne(tools.GetContext(),DB.STag{ c.PostForm("ScenicId"), c.PostForm("TagGroup"), + c.PostForm("TypeAlias"), c.PostForm("TagName"), }) diff --git a/API/Upload.go b/API/Upload.go index 1b81263..dc0bd6a 100644 --- a/API/Upload.go +++ b/API/Upload.go @@ -1,11 +1,14 @@ package Api import ( + "encoding/base64" "fmt" "github.com/aarongao/tools" "github.com/gin-gonic/gin" + "io/ioutil" "path" "strconv" + "strings" "time" ) @@ -47,3 +50,39 @@ func Upload(c *gin.Context) { "/" + filePath, }) } + +// @Title 上传文件BASE64 +// @Description 上传文件BASE64 +// @Accept json +// @Produce json +// @Param file 1 file true "文件" +// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"图片地址"}" +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" +// @Router /UploadBASE64? [post] +func UploadBASE64(c *gin.Context) { + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) + c.Header("Access-Control-Allow-Credentials", "true") + + base64Img := c.PostForm("base64Img") + + index := strings.Index(base64Img, ",") + base64Img = base64Img[index+1:] + dist, _ := base64.StdEncoding.DecodeString(base64Img) + + fileExt := ".jpg" + filePath := "Upload/" + strconv.Itoa(int(time.Now().UnixNano())) + fileExt + + err := ioutil.WriteFile(filePath, []byte(dist), 0666) //buffer输出到jpg文件中(不做处理,直接写到文件) + if err != nil { + fmt.Println(err) + c.JSON(200, tools.ResponseError{ + 1, + "upload file err", + }) + return + } + c.JSON(200, tools.ResponseSeccess{ + 0, + "/" + filePath, + }) +} diff --git a/DB/db.go b/DB/db.go index 95e0435..dd78811 100644 --- a/DB/db.go +++ b/DB/db.go @@ -54,25 +54,34 @@ type SScenic struct { type SItem struct { Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` - ScenicId string `bson:"ScenicId" json:"ScenicId"` // 景区id - Name string `bson:"Name" json:"Name"` - SubName string `bson:"SubName" json:"SubName"` - Location SLocation `bson:"Location" json:"Location"` + ScenicId string `bson:"ScenicId" json:"ScenicId" valid:"required"` // 景区id + Name string `bson:"Name" json:"Name" valid:"required"` + SubName string `bson:"SubName,omitempty" json:"SubName"` + Location SLocation `bson:"Location" json:"Location" valid:"required"` Tags []STag `bson:"Tags" json:"Tags"` - Icon string `bson:"Icon" json:"Icon"` - LimitHeight string `bson:"LimitHeight" json:"LimitHeight"` //限高 - PlayDuration string `bson:"PlayDuration" json:"PlayDuration"` //游玩时长 - SceneTime string `bson:"SceneTime" json:"SceneTime"` //场次时间 - Picture []string `bson:"Picture" json:"Picture"` - Voice string `bson:"Voice" json:"Voice"` //音频 - Tel string `bson:"Tel" json:"Tel"` - AverageConsumption string `bson:"AverageConsumption" json:"AverageConsumption"` //人均消费 - Menu string `bson:"Menu" json:"Menu"` //目录 - Time string `bson:"Time" json:"Time"` - OpenHours string `bson:"OpenHours" json:"OpenHours"` //开放时间 - LocationDescription string `bson:"LocationDescription" json:"LocationDescription"` //位置描述 - Reminder string `bson:"Reminder" json:"Reminder"` //温馨提示 - State int `bson:"State" json:"State"` // 运行状态0=正常1=停运 + Icon string `bson:"Icon" json:"Icon" valid:"required"` + LimitHeight string `bson:"LimitHeight,omitempty" json:"LimitHeight"` //限高 + PlayDuration string `bson:"PlayDuration,omitempty" json:"PlayDuration"` //游玩时长 + SceneTime string `bson:"SceneTime,omitempty" json:"SceneTime"` //场次时间 + Picture []string `bson:"Picture,omitempty" json:"Picture"` + Voice string `bson:"Voice,omitempty" json:"Voice"` //音频 + Tel string `bson:"Tel,omitempty" json:"Tel"` + AverageConsumption string `bson:"AverageConsumption,omitempty" json:"AverageConsumption"` //人均消费 + Menu string `bson:"Menu,omitempty" json:"Menu"` //目录 + Time string `bson:"Time,omitempty" json:"Time"` + OpenHours string `bson:"OpenHours,omitempty" json:"OpenHours"` //开放时间 + LocationDescription string `bson:"LocationDescription,omitempty" json:"LocationDescription"` //位置描述 + Reminder string `bson:"Reminder,omitempty" json:"Reminder"` //温馨提示 + State int `bson:"State,omitempty" json:"State"` // 运行状态0=正常1=停运 + CustomAttribute []SCustomAttribute `bson:"CustomAttribute" json:"CustomAttribute"` // 自定义属性 + WaitingTimeDisplay bool `bson:"WaitingTimeDisplay" json:"WaitingTimeDisplay"` //是否有等待时间显示 + ReminderInterval []string `bson:"ReminderInterval" json:"ReminderInterval"` //排队提醒间隔时间 + Display bool `bson:"Display" json:"Display"` //是否显示 +} + +type SCustomAttribute struct { + Title string `bson:"Title" json:"Title"` + Content string `bson:"Content" json:"Content"` } type SModel struct { @@ -170,6 +179,7 @@ type SCommodity struct { KvPhoto string `bson:"KvPhoto" json:"KvPhoto"` //用于列表页的图片 TopPhoto []SPicture `bson:"TopPhoto" json:"TopPhoto"` //详情页最上面的轮播图 Images []string `bson:"Images" json:"Images"` //详情页下面的产品详细图 + Display bool `bson:"Display" json:"Display"` //是否显示 } type SLine struct { Id *primitive.ObjectID `bson:"_id" json:"Id" valid:"required"` @@ -220,9 +230,10 @@ type SMember struct { } type STag struct { - ScenicId string `bson:"ScenicId" json:"ScenicId"` - Type string `bson:"Type" json:"Type"` - Name string `bson:"Name" json:"Name"` + ScenicId string `bson:"ScenicId" json:"ScenicId"` + Type string `bson:"Type" json:"Type"` + TypeAlias string `TypeAlias:"alias" json:"TypeAlias"` // 类型的别名 + Name string `bson:"Name" json:"Name"` } type SPicture struct { diff --git a/README.md b/README.md index b445069..c6789d1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## 乐游图后端接口文档 | Specification | Value | |-----|-----| -| API Version | 1.1.0 | +| API Version | 1.0.0 | | BasePath | 正式 leyoutu.st-i.com.cn; 测试 leyoutu.sti-uat.com | @@ -64,6 +64,7 @@ 1. [更新景区基础信息-高级](#updatescenicsenior-post) 1. [用户管理 - 修改用户信息](#updateuser-post) 1. [上传](#upload-post) +1. [上传文件BASE64](#uploadbase64-post) 1. [用户管理 - 获取用户信息](#userinfo-get) 1. [增加用户行为日志](#userlog-post) @@ -83,7 +84,7 @@ | Code | Type | Model | Message | |-----|-----|-----|-----| -| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图; Display是否在前台显示 | | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | @@ -141,7 +142,7 @@ | Code | Type | Model | Message | |-----|-----|-----|-----| -| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运;Display是否在前台显示;ReminderInterval排队提醒间隔时间(用逗号分割如60,90,120) | | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | @@ -331,7 +332,7 @@ | Code | Type | Model | Message | |-----|-----|-----|-----| -| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Price=价格;ShopName=店铺名称;KvPhoto用于列表页的图片;TopPhoto详情页最上面的轮播图;Images详情页下面的产品详细图; Display是否在前台显示 | | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | @@ -556,7 +557,7 @@ | Code | Type | Model | Message | |-----|-----|-----|-----| -| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | Tags所属标签,标签有分类;LimitHeight限高;PlayDuration游玩时长;SceneTime场次时间;Picture照片;Voice音频;AverageConsumption平均消费;Menu菜单, OpenHours开放时间: LocationDescription位置描述; Reminder温馨提示; State运行状态0=正常1=停运;Display是否在前台显示;ReminderInterval排队提醒间隔时间(用逗号分割如60,90,120) | | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | @@ -1199,6 +1200,25 @@ + + +#### /UploadBASE64 (POST) + + +上传文件BASE64 + +| Param Name | Example | Data Type | Description | Required? | +|-----|-----|-----|-----|-----| +| file | 1 | file | 文件 | Yes | + + +| Code | Type | Model | Message | +|-----|-----|-----|-----| +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | {"errcode":0,"result":"图片地址"} | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | + + + #### /UserInfo (GET) diff --git a/Version.md b/Version.md index 71e0a5d..d9955ff 100644 --- a/Version.md +++ b/Version.md @@ -1,93 +1,27 @@ -## 版本号:v1.1 +## 版本号:v1.2 -##### 生产环境地址:http://leyoutu.st-i.com.cn/api/v1.1/ +##### 生产环境地址:http://leyoutu.st-i.com.cn/api/v1.2/ -##### 测试环境地址:http://leyoutu.sti-uat.com/api/v1.1/ +##### 测试环境地址:http://leyoutu.sti-uat.com/api/v1.2/ ##### 变更说明: -1. /UserInfo接口增加权限验证(需要携带Token),游客只能查询自己信息,操作员可查询所有。 - -2. /AllComplaint接口增加ScenicId景区id参数 - -3. /SystemInfo 新增系统信息接口 - - ``` - { - "errcode": 0, - "result": { - "UpdateLocationInterval": 30,//上报位置时间间隔(秒) - "Version": 1.1//最新版本号 - "SupportVersion": 1.1//支持的最旧版本号 - } - } - ``` - -4. 新增加公告管理模块接口 - - ``` - /Notice/Info - /Notice/List - /Notice/Create(需要携带Token) - /Notice/Remove(需要携带Token) - /Notice/Modify(需要携带Token) - ``` - -5. 新增加顶部菜单相关接口 - - ``` - /TopMenus/All 获取所有菜单,以及关联标签 - /TopMenus/Update(需要携带Token) - /TopMenus/Remove(需要携带Token) - ``` - -6. 删除【游玩项目】标签。增加【游乐设施】【演出】【餐饮】【购物】【普通】 - -7. 删除【location】标签组 - -8. 修改地图切片url地址,及切片上传方式 - - /tiles2/**5e0d504e24e03431008b4567**/18/218274/99286.jpg - - 其中5e0d504e24e03431008b4567(景区id)为新加目录 - - 通过FTP方式上传到/root/leyoutu/tiles2/(景区id)/目录下 - -9. 后台增加管理员日志功能 - -10. 增加/SysAds/List获取平台广告信息接口 - -11. /AllLine推荐线路接口返回结果变更,增加固定结构。 - - ``` - { - errcode: 0, - result: [ ] - } - ``` - -12. /ScenicInfo景区信息接口增加新属性 - - ``` - ZoomForIOS //地图的缩放大小(IOS) - ZoomForAndroidMin //地图的缩放大小(Android最小) - ZoomForAndroidMax //地图的缩放大小(Android最大) - Rotation //旋转角度 - OpenTiles //否开启地图切片 - ColorTiles //切片底色(FFFFFF) - ``` - -13. /AllScenic增加Display=all参数。意思是显示所有数据,默认情况不显示隐藏信息 +1. 后台取消景区增加标签功能。 +2. 后台优化项目编辑页面布局及功能。 +3. 获取标签接口/AllTag增加TypeAlias字段(标签分组的中文名称)。 +4. 更新项目信息接口/UpdateItem增加ReminderInterval字段(排队提醒间隔时间)用逗号分割如60,90,120 +5. 项目和商品增加是否在前台显示属性 ##### 数据结构变更: -1、标签表、设施信息中的所属标签 +1. 标签表增加TypeAlias字段(标签分组的中文名称) +2. 删除1.0所属标签 +3. 更新商品表和项目表的全部Display字段为true +4. 更新项目表的所有游玩项目WaitingTimeDisplay字段为true -2、平台广告表初始数据 -2、root用户增加新模块权限 @@ -101,16 +35,16 @@ ##### 发布流程: -1. 提交APP代码到git(v1.1分支) +1. 提交APP代码到git(v1.2分支) 2. 使用 “测试环境地址” 打包内测版本至TestFlight -3. 升级 ”生产环境“ 接口至v1.1 - 1. 打包上传程序文件main_v1.1 +3. 升级 ”生产环境“ 接口至v1.2 + 1. 打包上传程序文件main_v1.2 2. 修改config.json配置文件 3. 运行程序 - 4. nginx增加/api/v1.1路径支持 + 4. nginx增加/api/v1.2路径支持 5. 上传后台页面 6. 更新root用户模块权限数据 - 7. 修改数据结构变更及数据缺失(广告,标签等。。) + 7. 修改数据结构变更及数据缺失(见上面“数据结构变更”) 4. 使用 “生产环境地址” 打包公测版本至TestFlight 5. 发布至商店 diff --git a/main.go b/main.go index 381998c..5b12082 100644 --- a/main.go +++ b/main.go @@ -40,7 +40,6 @@ func main() { flag.StringVar(&runPort, "port", "", "端口号,默认为8080") flag.Parse() - // 连接数据库 // Set client options clientOptions := options.Client() @@ -134,6 +133,8 @@ func main() { InitController("POST", "/Tag/Remove", Api.RemoveTag, &DB.SModel{"标签管理", "删除"}) InitController("POST", "/Upload", Api.Upload, &DB.SModel{}) + Gin.POST("/UploadBASE64", Api.UploadBASE64) + InitController("POST", "/UpdateItem", Api.UpdateItem, &DB.SModel{"项目管理", "修改"}) InitController("POST", "/UpdateCommodity", Api.UpdateCommodity, &DB.SModel{"商品管理", "修改"}) InitController("POST", "/UpdateLine", Api.UpdateLine, &DB.SModel{"线路管理", "修改"}) @@ -160,8 +161,8 @@ func main() { InitController("GET", "/Icon/Info", Api.IconInfo, &DB.SModel{}) InitController("POST", "/CheckToken", Api.CheckToken, &DB.SModel{}) //InitController("/Tiles", Api.Tiles) - InitController("POST", "/TopMenus/Update", Api.UpdateTopMenus, &DB.SModel{"菜单管理","修改"}) - InitController("POST", "/TopMenus/Remove", Api.RemoveTopMenus, &DB.SModel{"菜单管理","删除"}) + InitController("POST", "/TopMenus/Update", Api.UpdateTopMenus, &DB.SModel{"菜单管理", "修改"}) + InitController("POST", "/TopMenus/Remove", Api.RemoveTopMenus, &DB.SModel{"菜单管理", "删除"}) InitController("GET", "/TopMenus/All", Api.AllTopMenus, &DB.SModel{}) InitController("GET", "/RegisterDevice", Api.RegisterDevice, &DB.SModel{}) InitController("POST", "/RemoveUser", Api.RemoveUser, &DB.SModel{"用户管理", "删除"}) @@ -171,7 +172,6 @@ func main() { InitController("GET", "/AllOperatorLog", Api.AllOperatorLog, &DB.SModel{"操作员日志", "查看所有"}) - InitController("GET", "/AllOperator", Api.AllOperator, &DB.SModel{"操作员管理", "查看所有"}) InitController("GET", "/SystemInfo", Api.SystemInfo, &DB.SModel{}) @@ -180,7 +180,7 @@ func main() { InitController("GET", "/SysAds/List", Api.SysAdsList, &DB.SModel{}) InitController("POST", "/SysAds/Modify", Api.ModifySysAds, &DB.SModel{"平台广告", "修改"}) - InitController("GET", "/Analysls/Count", Api.Analysls, &DB.SModel{"平台数据统计","查询"}) + InitController("GET", "/Analysls/Count", Api.Analysls, &DB.SModel{"平台数据统计", "查询"}) Gin.GET("/AllModules", Auth.Modules) //InitController("/ws", Api.WsPage) @@ -228,7 +228,7 @@ func main() { // 默认情况使用配置文件中的端口号,除非在启动命令中指定-port :808x _port := Config.Info.ServerPort - if runPort != ""{ + if runPort != "" { _port = runPort } Gin.Run(_port) -- libgit2 0.21.0