|
@@ -22,6 +22,7 @@ func FassiApi(r *GinRouter) {
|
|
r.GETJWT("/image/list", SearchByFields)
|
|
r.GETJWT("/image/list", SearchByFields)
|
|
r.POSTJWT("/image/delete/:id", DeleteImage)
|
|
r.POSTJWT("/image/delete/:id", DeleteImage)
|
|
r.POSTJWT("/image/update", UpdateImage)
|
|
r.POSTJWT("/image/update", UpdateImage)
|
|
|
|
+ r.GETJWT("/image/detail/:id", DetailImage)
|
|
}
|
|
}
|
|
|
|
|
|
func getSerialNum(img *model.MatImage, ctx *repo.RepoSession) (string, error) {
|
|
func getSerialNum(img *model.MatImage, ctx *repo.RepoSession) (string, error) {
|
|
@@ -142,7 +143,7 @@ func UpdateImage(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
return nil, NewError("未找到数据")
|
|
return nil, NewError("未找到数据")
|
|
}
|
|
}
|
|
// 未更改图片
|
|
// 未更改图片
|
|
- if matImage.RawImage == nil || matImage.RawImage == searchMat.RawImage {
|
|
|
|
|
|
+ if matImage.RawImage == nil || searchMat.RawImage == nil || matImage.RawImage.Url == searchMat.RawImage.Url {
|
|
return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionMatImages, matImage.Id.Hex(), &matImage)
|
|
return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionMatImages, matImage.Id.Hex(), &matImage)
|
|
}
|
|
}
|
|
// 更新了面料原图 对应更新fassi 特征数据
|
|
// 更新了面料原图 对应更新fassi 特征数据
|
|
@@ -173,6 +174,16 @@ func DeleteImage(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionMatImages, id)
|
|
return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionMatImages, id)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func DetailImage(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
|
+ id := c.Param("id")
|
|
|
|
+ searchMat := &model.MatImage{}
|
|
|
|
+ _, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
|
|
+ CollectName: repo.CollectionMatImages,
|
|
|
|
+ Query: repo.Map{"_id": id},
|
|
|
|
+ }, searchMat)
|
|
|
|
+ return searchMat, err
|
|
|
|
+}
|
|
|
|
+
|
|
func SearchByFields(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
func SearchByFields(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
page, size, query := UtilQueryPageSize(c)
|
|
page, size, query := UtilQueryPageSize(c)
|
|
|
|
|