diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730075728.go b/.history/api/version1/honoraryArchives/operate_photo_20220730075728.go new file mode 100644 index 0000000..912a91c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730075728.go @@ -0,0 +1,71 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730080540.go b/.history/api/version1/honoraryArchives/operate_photo_20220730080540.go new file mode 100644 index 0000000..ec6b229 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730080540.go @@ -0,0 +1,71 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730080546.go b/.history/api/version1/honoraryArchives/operate_photo_20220730080546.go new file mode 100644 index 0000000..5a2928d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730080546.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730080550.go b/.history/api/version1/honoraryArchives/operate_photo_20220730080550.go new file mode 100644 index 0000000..72cb2cc --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730080550.go @@ -0,0 +1,71 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730081213.go b/.history/api/version1/honoraryArchives/operate_photo_20220730081213.go new file mode 100644 index 0000000..5a2928d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730081213.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730081323.go b/.history/api/version1/honoraryArchives/operate_photo_20220730081323.go new file mode 100644 index 0000000..df4ea25 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730081323.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730081335.go b/.history/api/version1/honoraryArchives/operate_photo_20220730081335.go new file mode 100644 index 0000000..ebff995 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730081335.go @@ -0,0 +1,73 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730081338.go b/.history/api/version1/honoraryArchives/operate_photo_20220730081338.go new file mode 100644 index 0000000..5a2928d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730081338.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730081813.go b/.history/api/version1/honoraryArchives/operate_photo_20220730081813.go new file mode 100644 index 0000000..ec6b229 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730081813.go @@ -0,0 +1,71 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082047.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082047.go new file mode 100644 index 0000000..319a614 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082047.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(eq) + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082049.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082049.go new file mode 100644 index 0000000..3fd323e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082049.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(reque) + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082051.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082051.go new file mode 100644 index 0000000..f863541 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082051.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(requestData) + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082053.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082053.go new file mode 100644 index 0000000..a148368 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082053.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(requestData,) + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082054.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082054.go new file mode 100644 index 0000000..dbdd5d9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082054.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(requestData.im) + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082058.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082058.go new file mode 100644 index 0000000..1df9b3f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082058.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(requestData.ImgUrl) > 0{} + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082100.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082100.go new file mode 100644 index 0000000..6266ec4 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082100.go @@ -0,0 +1,72 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(requestData.ImgUrl) > 0{ + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082103.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082103.go new file mode 100644 index 0000000..87da116 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082103.go @@ -0,0 +1,73 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082230.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082230.go new file mode 100644 index 0000000..b343ab7 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082230.go @@ -0,0 +1,73 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082232.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082232.go new file mode 100644 index 0000000..59db83d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082232.go @@ -0,0 +1,73 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082237.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082237.go new file mode 100644 index 0000000..ebba598 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082237.go @@ -0,0 +1,74 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082243.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082243.go new file mode 100644 index 0000000..9f44047 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082243.go @@ -0,0 +1,74 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + var newImage + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082245.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082245.go new file mode 100644 index 0000000..cdb9598 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082245.go @@ -0,0 +1,74 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + var newImage model + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082246.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082246.go new file mode 100644 index 0000000..f9e8387 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082246.go @@ -0,0 +1,74 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + var newImage models. + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082248.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082248.go new file mode 100644 index 0000000..0f09a18 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082248.go @@ -0,0 +1,74 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082255.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082255.go new file mode 100644 index 0000000..5f683e2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082255.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 + //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082256.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082256.go new file mode 100644 index 0000000..0f09a18 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082256.go @@ -0,0 +1,74 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082300.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082300.go new file mode 100644 index 0000000..9f926e9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082300.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + var newImage models.PhotosGallery + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082305.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082305.go new file mode 100644 index 0000000..452cdb2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082305.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + + for _, value := range requestData.ImgUrl { + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082306.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082306.go new file mode 100644 index 0000000..1a405c2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082306.go @@ -0,0 +1,76 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082313.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082313.go new file mode 100644 index 0000000..73b6752 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082313.go @@ -0,0 +1,76 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, ) + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082316.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082316.go new file mode 100644 index 0000000..f62782f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082316.go @@ -0,0 +1,76 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082326.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082326.go new file mode 100644 index 0000000..95ef1d5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082326.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082408.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082408.go new file mode 100644 index 0000000..3a1c687 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082408.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImage...) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082415.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082415.go new file mode 100644 index 0000000..43e7727 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082415.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList...) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082422.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082422.go new file mode 100644 index 0000000..5155f62 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082422.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082423.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082423.go new file mode 100644 index 0000000..5155f62 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082423.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082612.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082612.go new file mode 100644 index 0000000..4ac1f1e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082612.go @@ -0,0 +1,75 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082623.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082623.go new file mode 100644 index 0000000..e92e13e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082623.go @@ -0,0 +1,80 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082631.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082631.go new file mode 100644 index 0000000..31bb717 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082631.go @@ -0,0 +1,81 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082636.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082636.go new file mode 100644 index 0000000..d383062 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082636.go @@ -0,0 +1,81 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082639.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082639.go new file mode 100644 index 0000000..31bb717 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082639.go @@ -0,0 +1,81 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082656.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082656.go new file mode 100644 index 0000000..c7719b3 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082656.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082706.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082706.go new file mode 100644 index 0000000..37e3275 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082706.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082715.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082715.go new file mode 100644 index 0000000..41d30d7 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082715.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId. +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082716.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082716.go new file mode 100644 index 0000000..234d272 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082716.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.g +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082719.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082719.go new file mode 100644 index 0000000..02be63e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082719.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082720.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082720.go new file mode 100644 index 0000000..02be63e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082720.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082723.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082723.go new file mode 100644 index 0000000..7873eb6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082723.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082733.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082733.go new file mode 100644 index 0000000..e053d02 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082733.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082736.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082736.go new file mode 100644 index 0000000..1485bfb --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082736.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082741.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082741.go new file mode 100644 index 0000000..42cff82 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082741.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082744.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082744.go new file mode 100644 index 0000000..b1a7dcf --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082744.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + pho +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082751.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082751.go new file mode 100644 index 0000000..d24b95d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082751.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + photoGalleryByAscriptionId.del +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082753.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082753.go new file mode 100644 index 0000000..c9ee103 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082753.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + photoGalleryByAscriptionId.DelCont(where) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082811.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082811.go new file mode 100644 index 0000000..5e8045e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082811.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + err := photoGalleryByAscriptionId.DelCont(where) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082817.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082817.go new file mode 100644 index 0000000..eb319a6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082817.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + err = photoGalleryByAscriptionId.DelCont(where) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730082821.go b/.history/api/version1/honoraryArchives/operate_photo_20220730082821.go new file mode 100644 index 0000000..4b8bb39 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730082821.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + err = photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083119.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083119.go new file mode 100644 index 0000000..71d8032 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083119.go @@ -0,0 +1,86 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + err = photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083120.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083120.go new file mode 100644 index 0000000..71d8032 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083120.go @@ -0,0 +1,86 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + err = photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083124.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083124.go new file mode 100644 index 0000000..4b8bb39 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083124.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + err = photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083128.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083128.go new file mode 100644 index 0000000..22916b7 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083128.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err = photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083131.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083131.go new file mode 100644 index 0000000..28b59b8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083131.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083144.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083144.go new file mode 100644 index 0000000..ab321c2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083144.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083152.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083152.go new file mode 100644 index 0000000..0a28a8b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083152.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.re +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083155.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083155.go new file mode 100644 index 0000000..2209e58 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083155.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.Result() +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083204.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083204.go new file mode 100644 index 0000000..fe49745 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083204.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.Result(0,) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083209.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083209.go new file mode 100644 index 0000000..d17c6fe --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083209.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.Result(0,requestData,) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083210.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083210.go new file mode 100644 index 0000000..65ac1fe --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083210.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.Result(0, requestData, c) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083315.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083315.go new file mode 100644 index 0000000..a08c673 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083315.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.Result(0, requestData, c) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083318.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083318.go new file mode 100644 index 0000000..a08c673 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083318.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.Result(0, requestData, c) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730083347.go b/.history/api/version1/honoraryArchives/operate_photo_20220730083347.go new file mode 100644 index 0000000..a08c673 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730083347.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err != nil { + publicmethod.Result(108, err, c) + return + } + publicmethod.Result(0, requestData, c) +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084015.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084015.go new file mode 100644 index 0000000..c453f40 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084015.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if delErr == nil { + overallhandle.Result(0, saveData, c) + } else { + overallhandle.Result(108, delErr, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084018.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084018.go new file mode 100644 index 0000000..72e51be --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084018.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + overallhandle.Result(0, saveData, c) + } else { + overallhandle.Result(108, delErr, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084028.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084028.go new file mode 100644 index 0000000..a9016dc --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084028.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, saveData, c) + } else { + overallhandle.Result(108, delErr, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084040.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084040.go new file mode 100644 index 0000000..39690fa --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084040.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, req, c) + } else { + overallhandle.Result(108, delErr, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084042.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084042.go new file mode 100644 index 0000000..b956405 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084042.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, requestData, c) + } else { + overallhandle.Result(108, delErr, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084046.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084046.go new file mode 100644 index 0000000..7e4072f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084046.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, requestData, c) + } else { + publi.Result(108, delErr, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084048.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084048.go new file mode 100644 index 0000000..7f71aaf --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084048.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, requestData, c) + } else { + publicmethod.Result(108, delErr, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084049.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084049.go new file mode 100644 index 0000000..352bfb2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084049.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, requestData, c) + } else { + publicmethod.Result(108, re, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084051.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084051.go new file mode 100644 index 0000000..a0697c0 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084051.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, requestData, c) + } else { + publicmethod.Result(108, requestData, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084103.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084103.go new file mode 100644 index 0000000..26f1376 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084103.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, requestData, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084124.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084124.go new file mode 100644 index 0000000..30654db --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084124.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084153.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084153.go new file mode 100644 index 0000000..30654db --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084153.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084308.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084308.go new file mode 100644 index 0000000..812a6c4 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084308.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + // photoUrl := photoGalleryByAscriptionId.Url + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084310.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084310.go new file mode 100644 index 0000000..f57b342 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084310.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084349.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084349.go new file mode 100644 index 0000000..51c5e9f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084349.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, err, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084357.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084357.go new file mode 100644 index 0000000..9a4133e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084357.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, error.Error(), c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084359.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084359.go new file mode 100644 index 0000000..87d048c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084359.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, error.Error(""), c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084407.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084407.go new file mode 100644 index 0000000..87d048c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084407.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, error.Error(""), c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084413.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084413.go new file mode 100644 index 0000000..9664cb2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084413.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, error.Error("图片不能为空"), c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084423.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084423.go new file mode 100644 index 0000000..9a4133e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084423.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, error.Error(), c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084431.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084431.go new file mode 100644 index 0000000..f57b342 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084431.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084447.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084447.go new file mode 100644 index 0000000..c4e800a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084447.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084451.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084451.go new file mode 100644 index 0000000..ecffb71 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084451.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084457.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084457.go new file mode 100644 index 0000000..36d3487 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084457.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084632.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084632.go new file mode 100644 index 0000000..3be80d9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084632.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084636.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084636.go new file mode 100644 index 0000000..42bef1d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084636.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084640.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084640.go new file mode 100644 index 0000000..6d9e373 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084640.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont() + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084647.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084647.go new file mode 100644 index 0000000..66a276c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084647.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084653.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084653.go new file mode 100644 index 0000000..66a276c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084653.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084727.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084727.go new file mode 100644 index 0000000..75d5e2a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084727.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where[] + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084736.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084736.go new file mode 100644 index 0000000..e4747bb --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084736.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["ImgPath"] + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084742.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084742.go new file mode 100644 index 0000000..e40baa8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084742.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084743.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084743.go new file mode 100644 index 0000000..60f64b9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084743.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = req + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084749.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084749.go new file mode 100644 index 0000000..4071289 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084749.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId. + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084752.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084752.go new file mode 100644 index 0000000..6270045 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084752.go @@ -0,0 +1,92 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + + + // err := photoGalleryByAscriptionId.DelCont(where) + // if err == nil { + // publicmethod.Result(0, err, c) + // } else { + // publicmethod.Result(108, err, c) + // } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084758.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084758.go new file mode 100644 index 0000000..2a4a0aa --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084758.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + + err := photoGalleryByAscriptionId.DelCont(where) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084801.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084801.go new file mode 100644 index 0000000..8eda7b9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084801.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + + err := photoGalleryByAscriptionId.DelCont(where[]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084803.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084803.go new file mode 100644 index 0000000..6435644 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084803.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + + err := photoGalleryByAscriptionId.DelCont(where["im"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084806.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084806.go new file mode 100644 index 0000000..11eaadc --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084806.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730084807.go b/.history/api/version1/honoraryArchives/operate_photo_20220730084807.go new file mode 100644 index 0000000..f6ed3ab --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730084807.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730085124.go b/.history/api/version1/honoraryArchives/operate_photo_20220730085124.go new file mode 100644 index 0000000..f6ed3ab --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730085124.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730085958.go b/.history/api/version1/honoraryArchives/operate_photo_20220730085958.go new file mode 100644 index 0000000..95a6691 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730085958.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImageList []models.PhotosGallery + if len(requestData.ImgUrl) > 0 { + for _, value := range requestData.ImgUrl { + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList[0]) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090011.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090011.go new file mode 100644 index 0000000..0b785a5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090011.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + } + } + oldImage.EiteCont(where, newImageList[0]) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090013.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090013.go new file mode 100644 index 0000000..45e0f07 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090013.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + + oldImage.EiteCont(where, newImageList[0]) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090016.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090016.go new file mode 100644 index 0000000..e809e98 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090016.go @@ -0,0 +1,86 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImageList = append(newImageList, newImage) + oldImage.EiteCont(where, newImageList[0]) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090020.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090020.go new file mode 100644 index 0000000..fe23a7e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090020.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImageList[0]) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090025.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090025.go new file mode 100644 index 0000000..624ba38 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090025.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, new) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090026.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090026.go new file mode 100644 index 0000000..72d913e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090026.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = value.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090032.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090032.go new file mode 100644 index 0000000..49581d8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090032.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = ol.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090034.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090034.go new file mode 100644 index 0000000..ae33f8a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090034.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = value.Imgpath //物理地址"` + newImage.Name = value.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090037.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090037.go new file mode 100644 index 0000000..e617bae --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090037.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.Imgpath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = value.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090039.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090039.go new file mode 100644 index 0000000..f74c9fb --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090039.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.Imgpath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090046.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090046.go new file mode 100644 index 0000000..4a92589 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090046.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = ol //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090047.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090047.go new file mode 100644 index 0000000..bb21841 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090047.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090058.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090058.go new file mode 100644 index 0000000..b6c9601 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090058.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090807.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090807.go new file mode 100644 index 0000000..b6c9601 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090807.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090813.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090813.go new file mode 100644 index 0000000..e8529b6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090813.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090828.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090828.go new file mode 100644 index 0000000..ea01f4e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090828.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090830.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090830.go new file mode 100644 index 0000000..ea01f4e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090830.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090833.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090833.go new file mode 100644 index 0000000..ea01f4e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090833.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090835.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090835.go new file mode 100644 index 0000000..e8529b6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090835.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090838.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090838.go new file mode 100644 index 0000000..ea01f4e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090838.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090847.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090847.go new file mode 100644 index 0000000..ea01f4e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090847.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090850.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090850.go new file mode 100644 index 0000000..5ad2fa5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090850.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + var + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090857.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090857.go new file mode 100644 index 0000000..e8529b6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090857.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090907.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090907.go new file mode 100644 index 0000000..e394280 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090907.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage req + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090909.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090909.go new file mode 100644 index 0000000..135432b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090909.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090912.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090912.go new file mode 100644 index 0000000..54ec3af --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090912.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage requ + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090916.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090916.go new file mode 100644 index 0000000..20055de --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090916.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage requestD + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090920.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090920.go new file mode 100644 index 0000000..0b915cb --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090920.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage requestData + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090928.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090928.go new file mode 100644 index 0000000..e474146 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090928.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + newia + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090933.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090933.go new file mode 100644 index 0000000..3704dcb --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090933.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + newimage := requestData. + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090938.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090938.go new file mode 100644 index 0000000..7b7cf46 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090938.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + newimage := requestData.ImgUrl[0] + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730090939.go b/.history/api/version1/honoraryArchives/operate_photo_20220730090939.go new file mode 100644 index 0000000..7b7cf46 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730090939.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + newimage := requestData.ImgUrl[0] + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091007.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091007.go new file mode 100644 index 0000000..3a9d540 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091007.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + newImagePa + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091015.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091015.go new file mode 100644 index 0000000..ad16d72 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091015.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + newImagePath := requestData.ImgUrl[0] + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091016.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091016.go new file mode 100644 index 0000000..29a74b0 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091016.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + newImagePath := requestData.ImgUrl[0]. + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091032.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091032.go new file mode 100644 index 0000000..135432b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091032.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091040.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091040.go new file mode 100644 index 0000000..39f8aae --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091040.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage meth + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091042.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091042.go new file mode 100644 index 0000000..de21eef --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091042.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage mode + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091046.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091046.go new file mode 100644 index 0000000..42ebfdc --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091046.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models. + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091048.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091048.go new file mode 100644 index 0000000..e8529b6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091048.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = oldImage.Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091053.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091053.go new file mode 100644 index 0000000..9484d0b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091053.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = req //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091056.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091056.go new file mode 100644 index 0000000..850821e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091056.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData. //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091101.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091101.go new file mode 100644 index 0000000..c199b79 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091101.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0]. //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091103.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091103.go new file mode 100644 index 0000000..981d719 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091103.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = oldImage.ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091108.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091108.go new file mode 100644 index 0000000..35f2596 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091108.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].ImgPath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091111.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091111.go new file mode 100644 index 0000000..1075c3f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091111.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0]. //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091114.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091114.go new file mode 100644 index 0000000..7bc876f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091114.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = oldImage.Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091118.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091118.go new file mode 100644 index 0000000..29c24ac --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091118.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0] //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091120.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091120.go new file mode 100644 index 0000000..598f41a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091120.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = oldImage.FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091124.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091124.go new file mode 100644 index 0000000..7c32299 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091124.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0]. //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091127.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091127.go new file mode 100644 index 0000000..89ee97a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091127.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091133.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091133.go new file mode 100644 index 0000000..9e4a9e1 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091133.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = new //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091135.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091135.go new file mode 100644 index 0000000..efe6b23 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091135.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = requestData.ImgUrl[0]. //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091141.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091141.go new file mode 100644 index 0000000..b05f303 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091141.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = requestData.ImgUrl[0].AscriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091149.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091149.go new file mode 100644 index 0000000..f3b4a26 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091149.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091150.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091150.go new file mode 100644 index 0000000..16ba782 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091150.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId.Id, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091153.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091153.go new file mode 100644 index 0000000..af1080b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091153.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091155.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091155.go new file mode 100644 index 0000000..72cf145 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091155.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091206.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091206.go new file mode 100644 index 0000000..d2abd0d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091206.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = old //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091208.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091208.go new file mode 100644 index 0000000..52966f2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091208.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage. //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091213.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091213.go new file mode 100644 index 0000000..03bb6be --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091213.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091218.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091218.go new file mode 100644 index 0000000..c6a845e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091218.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + new + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091220.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091220.go new file mode 100644 index 0000000..70e871d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091220.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage. + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091226.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091226.go new file mode 100644 index 0000000..e92a012 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091226.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Id = old + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091227.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091227.go new file mode 100644 index 0000000..d40bf1c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091227.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + oldImage.EiteCont(where, newImage) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091247.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091247.go new file mode 100644 index 0000000..9cdbbc6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091247.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + new +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091249.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091249.go new file mode 100644 index 0000000..a70dabe --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091249.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.e +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091251.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091251.go new file mode 100644 index 0000000..711f385 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091251.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091334.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091334.go new file mode 100644 index 0000000..711f385 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091334.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + var newImage models.PhotosGallery + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091337.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091337.go new file mode 100644 index 0000000..c97593b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091337.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091339.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091339.go new file mode 100644 index 0000000..ebc1631 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091339.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + save + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091345.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091345.go new file mode 100644 index 0000000..fff5859 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091345.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod. + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091348.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091348.go new file mode 100644 index 0000000..3f5fe1c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091348.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[]() + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091350.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091350.go new file mode 100644 index 0000000..4af4c39 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091350.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage.Id = oldImage.Id + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091358.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091358.go new file mode 100644 index 0000000..a4a5c42 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091358.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage.Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091402.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091402.go new file mode 100644 index 0000000..8d19ad7 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091402.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveDataUrl = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091403.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091403.go new file mode 100644 index 0000000..bedbdea --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091403.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData[Url = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091407.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091407.go new file mode 100644 index 0000000..f10abd8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091407.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + newImage.ImgPath = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091414.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091414.go new file mode 100644 index 0000000..75fa6be --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091414.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["url"] = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091416.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091416.go new file mode 100644 index 0000000..990cb73 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091416.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imag"] = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091420.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091420.go new file mode 100644 index 0000000..c3f2b6e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091420.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + newImage.Name = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091429.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091429.go new file mode 100644 index 0000000..4f38a41 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091429.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["url"] = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091432.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091432.go new file mode 100644 index 0000000..8528a2f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091432.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + newImage.FileSize = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091436.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091436.go new file mode 100644 index 0000000..8cdb41c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091436.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["url"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091440.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091440.go new file mode 100644 index 0000000..7b46710 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091440.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesiz"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091441.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091441.go new file mode 100644 index 0000000..e5be951 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091441.go @@ -0,0 +1,83 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091455.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091455.go new file mode 100644 index 0000000..72375d2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091455.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + if requestData + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091504.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091504.go new file mode 100644 index 0000000..879ae6a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091504.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + requestData, + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091507.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091507.go new file mode 100644 index 0000000..43c1258 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091507.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + requestData.ur + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091509.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091509.go new file mode 100644 index 0000000..beae076 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091509.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + requestData. + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091515.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091515.go new file mode 100644 index 0000000..bb9c601 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091515.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + requestData.ImgUrl[0].Url + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091518.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091518.go new file mode 100644 index 0000000..bf2e9b1 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091518.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + requestData.ImgUrl[0] + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091527.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091527.go new file mode 100644 index 0000000..d9e38cd --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091527.go @@ -0,0 +1,84 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091531.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091531.go new file mode 100644 index 0000000..724d72d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091531.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if new + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091533.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091533.go new file mode 100644 index 0000000..fc4002f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091533.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage. + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091541.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091541.go new file mode 100644 index 0000000..3928c8c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091541.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != nil + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091545.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091545.go new file mode 100644 index 0000000..a836925 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091545.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091547.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091547.go new file mode 100644 index 0000000..51ffb41 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091547.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091549.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091549.go new file mode 100644 index 0000000..1bd0c3e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091549.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && new + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091554.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091554.go new file mode 100644 index 0000000..04f2f29 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091554.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url ! + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091557.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091557.go new file mode 100644 index 0000000..5d2c470 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091557.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != old + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091559.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091559.go new file mode 100644 index 0000000..180da92 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091559.go @@ -0,0 +1,85 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091602.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091602.go new file mode 100644 index 0000000..d458316 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091602.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url{ + + } + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091603.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091603.go new file mode 100644 index 0000000..a90c47e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091603.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url{ + + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091604.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091604.go new file mode 100644 index 0000000..4682f5e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091604.go @@ -0,0 +1,86 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091609.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091609.go new file mode 100644 index 0000000..dfc7a03 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091609.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if new + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091612.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091612.go new file mode 100644 index 0000000..b88b6be --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091612.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091617.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091617.go new file mode 100644 index 0000000..a35b70d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091617.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091620.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091620.go new file mode 100644 index 0000000..864836a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091620.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && new(type) + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091622.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091622.go new file mode 100644 index 0000000..eda2d03 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091622.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newim + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091624.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091624.go new file mode 100644 index 0000000..b8184ca --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091624.go @@ -0,0 +1,87 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091628.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091628.go new file mode 100644 index 0000000..903ffca --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091628.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath{ + } + + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091630.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091630.go new file mode 100644 index 0000000..548fde6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091630.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath{ + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091631.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091631.go new file mode 100644 index 0000000..659f403 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091631.go @@ -0,0 +1,88 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091634.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091634.go new file mode 100644 index 0000000..a05992d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091634.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + if new + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091644.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091644.go new file mode 100644 index 0000000..f88d9e8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091644.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + if newImage.Name != "" && new + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091650.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091650.go new file mode 100644 index 0000000..8d57df5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091650.go @@ -0,0 +1,89 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + if newImage.Name != "" && newImage.Name != old + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091652.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091652.go new file mode 100644 index 0000000..ae2efdd --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091652.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name{ + + } + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091653.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091653.go new file mode 100644 index 0000000..b29fdc3 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091653.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + } + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091659.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091659.go new file mode 100644 index 0000000..6f6bd1b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091659.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + } + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091702.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091702.go new file mode 100644 index 0000000..faabbdc --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091702.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //文档名称"` + } + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091706.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091706.go new file mode 100644 index 0000000..a570ed9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091706.go @@ -0,0 +1,90 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091711.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091711.go new file mode 100644 index 0000000..d5866a8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091711.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091715.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091715.go new file mode 100644 index 0000000..451ae71 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091715.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if new + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091722.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091722.go new file mode 100644 index 0000000..a65cccb --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091722.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize !="" && new + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091728.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091728.go new file mode 100644 index 0000000..17d9924 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091728.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize !="" && newImage.FileSize != old + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091731.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091731.go new file mode 100644 index 0000000..b36c406 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091731.go @@ -0,0 +1,91 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize !="" && newImage.FileSize != oldImage. + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091733.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091733.go new file mode 100644 index 0000000..aac03aa --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091733.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize !="" && newImage.FileSize != oldImage.FileSize{ + + } + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091735.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091735.go new file mode 100644 index 0000000..dc78855 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091735.go @@ -0,0 +1,92 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091738.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091738.go new file mode 100644 index 0000000..10e758b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091738.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091741.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091741.go new file mode 100644 index 0000000..d9ca194 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091741.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData[] + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091745.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091745.go new file mode 100644 index 0000000..de4f0d6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091745.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091749.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091749.go new file mode 100644 index 0000000..7954b1d --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091749.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.no + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091753.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091753.go new file mode 100644 index 0000000..756d5d7 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091753.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.now() + newImage.Time = time.Now().Unix() //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091756.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091756.go new file mode 100644 index 0000000..330a2c7 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091756.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.now() + newImage.Time = //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091757.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091757.go new file mode 100644 index 0000000..e3e83ab --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091757.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.Now().Unix() + newImage.Time = //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091800.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091800.go new file mode 100644 index 0000000..6286923 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091800.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.Now().Unix() //创建时间" + newImage.Time = ` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091802.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091802.go new file mode 100644 index 0000000..e3e83ab --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091802.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.Now().Unix() + newImage.Time = //创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091806.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091806.go new file mode 100644 index 0000000..b781bd6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091806.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.Now().Unix()//创建时间"` + newImage.Time = + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091811.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091811.go new file mode 100644 index 0000000..72408b3 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091811.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.Time = + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091813.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091813.go new file mode 100644 index 0000000..587c628 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091813.go @@ -0,0 +1,92 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091821.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091821.go new file mode 100644 index 0000000..4a1943c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091821.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage. + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091824.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091824.go new file mode 100644 index 0000000..c0bd8c4 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091824.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091828.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091828.go new file mode 100644 index 0000000..acdb707 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091828.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091837.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091837.go new file mode 100644 index 0000000..8e7b022 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091837.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.FileSize + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091845.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091845.go new file mode 100644 index 0000000..36c9777 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091845.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != as + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091854.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091854.go new file mode 100644 index 0000000..d156780 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091854.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId{ + + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091855.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091855.go new file mode 100644 index 0000000..3a441c6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091855.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId{ + + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091856.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091856.go new file mode 100644 index 0000000..a967fd9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091856.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091907.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091907.go new file mode 100644 index 0000000..9308b87 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091907.go @@ -0,0 +1,92 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091913.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091913.go new file mode 100644 index 0000000..a967fd9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091913.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091919.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091919.go new file mode 100644 index 0000000..de2748b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091919.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091920.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091920.go new file mode 100644 index 0000000..a967fd9 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091920.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + newImage := requestData.ImgUrl[0] + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091922.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091922.go new file mode 100644 index 0000000..c9d8eea --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091922.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + saveData := publicmethod.MapOut[string]() + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091923.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091923.go new file mode 100644 index 0000000..fd2a6ec --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091923.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + ascriptionId, _ := strconv.ParseInt(requestData.ImgUrl[0].AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091929.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091929.go new file mode 100644 index 0000000..6bf71aa --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091929.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + ascriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091933.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091933.go new file mode 100644 index 0000000..dc4b18c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091933.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + newImage, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091935.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091935.go new file mode 100644 index 0000000..ada94b8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091935.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + newImage.AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730091945.go b/.history/api/version1/honoraryArchives/operate_photo_20220730091945.go new file mode 100644 index 0000000..539543f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730091945.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + newImage.AscriptionId, _ = strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092010.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092010.go new file mode 100644 index 0000000..66b2899 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092010.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ = strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092013.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092013.go new file mode 100644 index 0000000..b43f11f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092013.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && newImage.AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092019.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092019.go new file mode 100644 index 0000000..a8294a3 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092019.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != "" && AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092022.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092022.go new file mode 100644 index 0000000..0e625d5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092022.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if newImage.AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092027.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092027.go new file mode 100644 index 0000000..7e128d6 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092027.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["time"] = time.Now().Unix() //新图片创建时间"` + } + newImage.AscriptionId = ascriptionId //归属"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092032.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092032.go new file mode 100644 index 0000000..7e9e45a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092032.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + newImage.AscriptionId = ascriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092035.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092035.go new file mode 100644 index 0000000..099ea7b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092035.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + newImage.AscriptionId = ascriptionIAscriptionIdd //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092037.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092037.go new file mode 100644 index 0000000..ff54ad7 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092037.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + newImage.AscriptionId = ascriptionIAscriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092039.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092039.go new file mode 100644 index 0000000..5ee32e3 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092039.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + newImage.AscriptionId = AscriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092048.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092048.go new file mode 100644 index 0000000..0d75181 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092048.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData[""] = AscriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092054.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092054.go new file mode 100644 index 0000000..0231dff --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092054.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascirptio"] = AscriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092057.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092057.go new file mode 100644 index 0000000..f9b4e8c --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092057.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["AscriptionId"] = AscriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092058.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092058.go new file mode 100644 index 0000000..e701a0f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092058.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionId"] = AscriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092100.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092100.go new file mode 100644 index 0000000..ef911a2 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092100.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092115.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092115.go new file mode 100644 index 0000000..af7cc04 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092115.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if new + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092118.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092118.go new file mode 100644 index 0000000..e8de911 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092118.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage. + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092120.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092120.go new file mode 100644 index 0000000..5516dd8 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092120.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.a + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092122.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092122.go new file mode 100644 index 0000000..f68476a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092122.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.asc + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092130.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092130.go new file mode 100644 index 0000000..925ac20 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092130.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.AscriptionDataSheet !="" && old + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092134.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092134.go new file mode 100644 index 0000000..919f4bd --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092134.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.AscriptionDataSheet !="" && oldImage.AscriptionDataSheet + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092136.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092136.go new file mode 100644 index 0000000..5859004 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092136.go @@ -0,0 +1,97 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.AscriptionDataSheet !="" && oldImage.AscriptionDataSheet{ + + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092138.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092138.go new file mode 100644 index 0000000..1300928 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092138.go @@ -0,0 +1,97 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.AscriptionDataSheet !="" && oldImage.AscriptionDataSheet{ + + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092139.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092139.go new file mode 100644 index 0000000..1a079ca --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092139.go @@ -0,0 +1,96 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.AscriptionDataSheet != "" && oldImage.AscriptionDataSheet { + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092148.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092148.go new file mode 100644 index 0000000..74e1c50 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092148.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092151.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092151.go new file mode 100644 index 0000000..8f2ccf5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092151.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092153.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092153.go new file mode 100644 index 0000000..74e1c50 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092153.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092154.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092154.go new file mode 100644 index 0000000..1a079ca --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092154.go @@ -0,0 +1,96 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.AscriptionDataSheet != "" && oldImage.AscriptionDataSheet { + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092156.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092156.go new file mode 100644 index 0000000..2d772da --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092156.go @@ -0,0 +1,96 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + if newImage.AscriptionDataSheet !="" && oldImage.AscriptionDataSheet{ + newImage.AscriptionDataSheet = oldImage.AscriptionDataSheet //归属拿个数据表"` + } + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092201.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092201.go new file mode 100644 index 0000000..5003d00 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092201.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["oldImage.AscriptionDataSheet"] + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092204.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092204.go new file mode 100644 index 0000000..4cd1736 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092204.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["sscriptionDataSheet"] + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092206.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092206.go new file mode 100644 index 0000000..4d047c1 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092206.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptionDataSheet"] + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092209.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092209.go new file mode 100644 index 0000000..1c50971 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092209.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondataSheet"] + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092211.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092211.go new file mode 100644 index 0000000..4790f12 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092211.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092213.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092213.go new file mode 100644 index 0000000..56e5c77 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092213.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092218.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092218.go new file mode 100644 index 0000000..3071571 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092218.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage. + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092219.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092219.go new file mode 100644 index 0000000..094bc97 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092219.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092230.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092230.go new file mode 100644 index 0000000..4b34e6a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092230.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["time"] = time.Now().Unix() //新图片创建时间"` + //状态(1:启用;2:禁用;3:删除)"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092239.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092239.go new file mode 100644 index 0000000..bd2a159 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092239.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["time"] = time.Now().Unix() //新图片创建时间"` + newImage.EiteCont() +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092329.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092329.go new file mode 100644 index 0000000..756cfea --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092329.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := honContOld.EiteCont(where, saveData) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092333.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092333.go new file mode 100644 index 0000000..f50615e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092333.go @@ -0,0 +1,93 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092345.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092345.go new file mode 100644 index 0000000..130ff32 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092345.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData[] + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092349.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092349.go new file mode 100644 index 0000000..ff70703 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092349.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData[] = oldImage. + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092411.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092411.go new file mode 100644 index 0000000..79d1b3a --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092411.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage. + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092414.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092414.go new file mode 100644 index 0000000..40a052f --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092414.go @@ -0,0 +1,94 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092509.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092509.go new file mode 100644 index 0000000..6c51f30 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092509.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092540.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092540.go new file mode 100644 index 0000000..8ab305e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092540.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if as +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092543.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092543.go new file mode 100644 index 0000000..e342e94 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092543.go @@ -0,0 +1,95 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if save +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092552.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092552.go new file mode 100644 index 0000000..a9e7fbd --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092552.go @@ -0,0 +1,97 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil{ + publicmethod.re + } +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092554.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092554.go new file mode 100644 index 0000000..1965f10 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092554.go @@ -0,0 +1,97 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil{ + publicmethod.Result() + } +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092637.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092637.go new file mode 100644 index 0000000..7853e08 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092637.go @@ -0,0 +1,98 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil{ + publicmethod.Result() + } + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092640.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092640.go new file mode 100644 index 0000000..2908994 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092640.go @@ -0,0 +1,99 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil{ + publicmethod.Result() + return + } + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092643.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092643.go new file mode 100644 index 0000000..3159c28 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092643.go @@ -0,0 +1,100 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil{ + publicmethod.Result() + return + } + + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092646.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092646.go new file mode 100644 index 0000000..ff5b1a1 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092646.go @@ -0,0 +1,100 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil{ + publicmethod.Result() + return + } + publicmethod.re + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092651.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092651.go new file mode 100644 index 0000000..e2d4d0e --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092651.go @@ -0,0 +1,100 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil { + publicmethod.Result() + return + } + publicmethod.Result(0, requestData, c) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092716.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092716.go new file mode 100644 index 0000000..83aa5a0 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092716.go @@ -0,0 +1,100 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil { + publicmethod.Result(106,saveErr,) + return + } + publicmethod.Result(0, requestData, c) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092718.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092718.go new file mode 100644 index 0000000..40db76b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092718.go @@ -0,0 +1,100 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil { + publicmethod.Result(106, saveErr, c) + return + } + publicmethod.Result(0, requestData, c) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730092817.go b/.history/api/version1/honoraryArchives/operate_photo_20220730092817.go new file mode 100644 index 0000000..40db76b --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730092817.go @@ -0,0 +1,100 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil { + publicmethod.Result(106, saveErr, c) + return + } + publicmethod.Result(0, requestData, c) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730093216.go b/.history/api/version1/honoraryArchives/operate_photo_20220730093216.go new file mode 100644 index 0000000..baaf958 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730093216.go @@ -0,0 +1,100 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId []models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +func (a *ApiMethod) EditImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + where := publicmethod.MapOut[string]() + where["id"] = requestData.Id + // 原始图片信息 + var oldImage models.PhotosGallery + err := oldImage.GetCont(where) + if err != nil { + publicmethod.Result(107, err, c) + return + } + newImage := requestData.ImgUrl[0] + saveData := publicmethod.MapOut[string]() + AscriptionId, _ := strconv.ParseInt(newImage.AscriptionId, 10, 64) // 将id转为int64类型 + if newImage.Url != "" && newImage.Url != oldImage.Url { + saveData["url"] = requestData.ImgUrl[0].Url //新图片地址"` + } + if newImage.Imgpath != "" && newImage.Imgpath != oldImage.ImgPath { + saveData["imgpath"] = requestData.ImgUrl[0].Imgpath //新图片物理地址"` + } + if newImage.Name != "" && newImage.Name != oldImage.Name { + saveData["name"] = requestData.ImgUrl[0].Name //新图片文档名称"` + } + if newImage.FileSize != "" && newImage.FileSize != oldImage.FileSize { + saveData["filesize"] = requestData.ImgUrl[0].FileSize //文档大小"` + } + if AscriptionId != 0 && AscriptionId != oldImage.AscriptionId { + saveData["ascriptionid"] = AscriptionId //归属"` + } + saveData["ascriptiondatasheet"] = oldImage.AscriptionDataSheet + saveData["state"] = oldImage.State + saveData["time"] = time.Now().Unix() //新图片创建时间"` + saveErr := oldImage.EiteCont(where, saveData) + if saveErr != nil { + publicmethod.Result(106, saveErr, c) + return + } + publicmethod.Result(0, requestData, c) + +} + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730093438.go b/.history/api/version1/honoraryArchives/operate_photo_20220730093438.go new file mode 100644 index 0000000..d6955bc --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730093438.go @@ -0,0 +1,54 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId []models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + +// 编辑图片 +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730093441.go b/.history/api/version1/honoraryArchives/operate_photo_20220730093441.go new file mode 100644 index 0000000..16ca9a1 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730093441.go @@ -0,0 +1,54 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + "strconv" + "time" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId []models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} + + +// 删除图片 +func (a *ApiMethod) DelImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" || len(requestData.ImgUrl) == 0 { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + photoGalleryByAscriptionId.GetCont(where) + where["imgpath"] = photoGalleryByAscriptionId.ImgPath + err := photoGalleryByAscriptionId.DelCont(where["imgpath"]) + if err == nil { + publicmethod.Result(0, err, c) + } else { + publicmethod.Result(108, err, c) + } +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730093451.go b/.history/api/version1/honoraryArchives/operate_photo_20220730093451.go new file mode 100644 index 0000000..9bf83a5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730093451.go @@ -0,0 +1,30 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId []models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} diff --git a/.history/api/version1/honoraryArchives/operate_photo_20220730093534.go b/.history/api/version1/honoraryArchives/operate_photo_20220730093534.go new file mode 100644 index 0000000..b6ca6d5 --- /dev/null +++ b/.history/api/version1/honoraryArchives/operate_photo_20220730093534.go @@ -0,0 +1,30 @@ +package honoraryArchives + +import ( + "key_performance_indicators/models" + "key_performance_indicators/overall/publicmethod" + + "github.com/gin-gonic/gin" +) + +// 查询图片 +func (a *ApiMethod) ReviewImage(c *gin.Context) { + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 + if requestData.Id == "" { + publicmethod.Result(101, requestData, c) + return + } + var photoGalleryByAscriptionId []models.PhotosGallery + where := publicmethod.MapOut[string]() + where["ascriptionid"] = requestData.Id + + if err != nil { + publicmethod.Result(107, err, c) + return + } + + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 +} diff --git a/.history/api/version1/honoraryArchives/type_20220730075846.go b/.history/api/version1/honoraryArchives/type_20220730075846.go new file mode 100644 index 0000000..cafae85 --- /dev/null +++ b/.history/api/version1/honoraryArchives/type_20220730075846.go @@ -0,0 +1,69 @@ +package honoraryArchives + +import ( + "key_performance_indicators/overall/publicmethod" + + "github.com/gin-gonic/gin" +) + +type ApiMethod struct{} + +//荣誉档案入口 +func (a *ApiMethod) Index(c *gin.Context) { + outputCont := publicmethod.MapOut[string]() + outputCont["index"] = "荣誉档案入口" + publicmethod.Result(0, outputCont, c) +} + +//荣誉列表查询字段 +type honorListKey struct { + publicmethod.PagesTurn + Name string `json:"name"` //名称 + IssuingAgency string `json:"issuingagency"` //发放单位 + Carrier int `json:"carrier"` //载体 + AwardTimeBegin string `json:"awardtimebegin"` //获奖时间 + AwardTimeEnd string `json:"awardtimeend"` //获奖时间 + Organize string `json:"organize"` //行政组织 + UserKey string `json:"userkey"` //人员Key +} + +//添加荣誉 +type addHonorCont struct { + addCarrierCont + IssuingAgency string `json:"issuingagency"` //发放单位 + Carrier int64 `json:"carrier"` //载体 + AwardTime string `json:"awardtime"` //获奖时间 + EfficientDate string `json:"efficientDate"` //有效期限 + Organize string `json:"organize"` //行政组织 + UserKey string `json:"userkey"` //人员Key + Remark string `json:"remark"` //备注 + ImgUrl []publicmethod.PubilcImageCont `json:"imgurl"` //图片集 +} + +//编辑荣誉 +type eidtHonorCont struct { + publicmethod.PublicId + addHonorCont +} + +//载体类型查询字段 +type carrierListKey struct { + publicmethod.PagesTurn + addCarrierCont +} + +//添加载体类型 +type addCarrierCont struct { + Name string `json:"name"` //名称 +} + +//编辑载体类型 +type eidyCarrierCont struct { + publicmethod.PublicId + addCarrierCont +} + +// 荣誉图片字段 +type photoKey struct { + publicmethod.PublicId +} diff --git a/.history/api/version1/honoraryArchives/type_20220730075915.go b/.history/api/version1/honoraryArchives/type_20220730075915.go new file mode 100644 index 0000000..f43ab1c --- /dev/null +++ b/.history/api/version1/honoraryArchives/type_20220730075915.go @@ -0,0 +1,70 @@ +package honoraryArchives + +import ( + "key_performance_indicators/overall/publicmethod" + + "github.com/gin-gonic/gin" +) + +type ApiMethod struct{} + +//荣誉档案入口 +func (a *ApiMethod) Index(c *gin.Context) { + outputCont := publicmethod.MapOut[string]() + outputCont["index"] = "荣誉档案入口" + publicmethod.Result(0, outputCont, c) +} + +//荣誉列表查询字段 +type honorListKey struct { + publicmethod.PagesTurn + Name string `json:"name"` //名称 + IssuingAgency string `json:"issuingagency"` //发放单位 + Carrier int `json:"carrier"` //载体 + AwardTimeBegin string `json:"awardtimebegin"` //获奖时间 + AwardTimeEnd string `json:"awardtimeend"` //获奖时间 + Organize string `json:"organize"` //行政组织 + UserKey string `json:"userkey"` //人员Key +} + +//添加荣誉 +type addHonorCont struct { + addCarrierCont + IssuingAgency string `json:"issuingagency"` //发放单位 + Carrier int64 `json:"carrier"` //载体 + AwardTime string `json:"awardtime"` //获奖时间 + EfficientDate string `json:"efficientDate"` //有效期限 + Organize string `json:"organize"` //行政组织 + UserKey string `json:"userkey"` //人员Key + Remark string `json:"remark"` //备注 + ImgUrl []publicmethod.PubilcImageCont `json:"imgurl"` //图片集 +} + +//编辑荣誉 +type eidtHonorCont struct { + publicmethod.PublicId + addHonorCont +} + +//载体类型查询字段 +type carrierListKey struct { + publicmethod.PagesTurn + addCarrierCont +} + +//添加载体类型 +type addCarrierCont struct { + Name string `json:"name"` //名称 +} + +//编辑载体类型 +type eidyCarrierCont struct { + publicmethod.PublicId + addCarrierCont +} + +// 荣誉图片字段 +type photoKey struct { + publicmethod.PublicId + +} diff --git a/.history/api/version1/honoraryArchives/type_20220730080042.go b/.history/api/version1/honoraryArchives/type_20220730080042.go new file mode 100644 index 0000000..edfd486 --- /dev/null +++ b/.history/api/version1/honoraryArchives/type_20220730080042.go @@ -0,0 +1,70 @@ +package honoraryArchives + +import ( + "key_performance_indicators/overall/publicmethod" + + "github.com/gin-gonic/gin" +) + +type ApiMethod struct{} + +//荣誉档案入口 +func (a *ApiMethod) Index(c *gin.Context) { + outputCont := publicmethod.MapOut[string]() + outputCont["index"] = "荣誉档案入口" + publicmethod.Result(0, outputCont, c) +} + +//荣誉列表查询字段 +type honorListKey struct { + publicmethod.PagesTurn + Name string `json:"name"` //名称 + IssuingAgency string `json:"issuingagency"` //发放单位 + Carrier int `json:"carrier"` //载体 + AwardTimeBegin string `json:"awardtimebegin"` //获奖时间 + AwardTimeEnd string `json:"awardtimeend"` //获奖时间 + Organize string `json:"organize"` //行政组织 + UserKey string `json:"userkey"` //人员Key +} + +//添加荣誉 +type addHonorCont struct { + addCarrierCont + IssuingAgency string `json:"issuingagency"` //发放单位 + Carrier int64 `json:"carrier"` //载体 + AwardTime string `json:"awardtime"` //获奖时间 + EfficientDate string `json:"efficientDate"` //有效期限 + Organize string `json:"organize"` //行政组织 + UserKey string `json:"userkey"` //人员Key + Remark string `json:"remark"` //备注 + ImgUrl []publicmethod.PubilcImageCont `json:"imgurl"` //图片集 +} + +//编辑荣誉 +type eidtHonorCont struct { + publicmethod.PublicId + addHonorCont +} + +//载体类型查询字段 +type carrierListKey struct { + publicmethod.PagesTurn + addCarrierCont +} + +//添加载体类型 +type addCarrierCont struct { + Name string `json:"name"` //名称 +} + +//编辑载体类型 +type eidyCarrierCont struct { + publicmethod.PublicId + addCarrierCont +} + +// 荣誉图片字段 +type photoKey struct { + publicmethod.PublicId + addHonorCont +} diff --git a/api/version1/honoraryArchives/operate_photo.go b/api/version1/honoraryArchives/operate_photo.go index 2ab7df3..b6ca6d5 100644 --- a/api/version1/honoraryArchives/operate_photo.go +++ b/api/version1/honoraryArchives/operate_photo.go @@ -3,68 +3,28 @@ package honoraryArchives import ( "key_performance_indicators/models" "key_performance_indicators/overall/publicmethod" - "strconv" - "time" "github.com/gin-gonic/gin" ) // 查询图片 func (a *ApiMethod) ReviewImage(c *gin.Context) { - var requestData photoKey //声明荣誉图片字段 - c.ShouldBindJSON(requestData) //进行Json绑定 + var requestData photoKey //声明荣誉图片字段 + c.ShouldBindJSON(&requestData) //进行Json绑定 if requestData.Id == "" { publicmethod.Result(101, requestData, c) return } - var photoGalleryByAscriptionId models.PhotosGallery + var photoGalleryByAscriptionId []models.PhotosGallery where := publicmethod.MapOut[string]() where["ascriptionid"] = requestData.Id - err := photoGalleryByAscriptionId.GetCont(where) // 根据归属id获取图片 + if err != nil { publicmethod.Result(107, err, c) return } - photoUrl := photoGalleryByAscriptionId.Url - - // publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 - publicmethod.Result(0, photoUrl, c) // 将查询结果返回 -} - -// 编辑图片 -func (a *ApiMethod) EditImage(c *gin.Context) { - var requestData photoKey //声明荣誉图片字段 - c.ShouldBindJSON(requestData) //进行Json绑定 - if requestData.Id == "" || len(requestData.ImgUrl) == 0 { - publicmethod.Result(101, requestData, c) - return - } - where := publicmethod.MapOut[string]() - where["id"] = requestData.Id - // 原始图片信息 - var oldImage models.PhotosGallery - err := oldImage.GetCont(where) - if err != nil { - publicmethod.Result(107, err, c) - return - } - ascriptionId, _ := strconv.ParseInt(requestData.Id, 10, 64) // 将id转为int64类型 - var newImage models.PhotosGallery - for _, value := range requestData.ImgUrl { - newImage.Url = value.Url //图片地址"` - newImage.ImgPath = value.Imgpath //物理地址"` - newImage.Name = value.Name //文档名称"` - newImage.FileSize = value.FileSize //文档大小"` - newImage.Time = time.Now().Unix() //创建时间"` - newImage.AscriptionId = ascriptionId //归属"` - newImage.AscriptionDataSheet = "honorary_archives" //归属拿个数据表"` - newImage.State = 1 //状态(1:启用;2:禁用;3:删除)"` - } - oldImage.EiteCont(where, newImage) -} - -// 删除图片 -func (a *ApiMethod) DelImage(c *gin.Context) { - + publicmethod.Result(0, photoGalleryByAscriptionId, c) // 将查询结果返回 + // photoUrl := photoGalleryByAscriptionId.Url + // publicmethod.Result(0, photoUrl, c) // 将查询结果返回 }