Commit cabdb8f4 authored by muhong's avatar muhong

修改 小程序藏品接口

parent 797b9deb
...@@ -144,7 +144,6 @@ public class FavoritesServiceImpl implements FavoritesService { ...@@ -144,7 +144,6 @@ public class FavoritesServiceImpl implements FavoritesService {
favorites.setUserId(dto.getUserId()); favorites.setUserId(dto.getUserId());
favorites.setTitle(dto.getTitle()); favorites.setTitle(dto.getTitle());
favorites.setDescription(dto.getDescription()); favorites.setDescription(dto.getDescription());
favorites.setImages(dto.getImages());
Date date = new Date(); Date date = new Date();
favorites.setAddTime(date); favorites.setAddTime(date);
favorites.setUpdateTime(date); favorites.setUpdateTime(date);
...@@ -175,7 +174,6 @@ public class FavoritesServiceImpl implements FavoritesService { ...@@ -175,7 +174,6 @@ public class FavoritesServiceImpl implements FavoritesService {
favorites.setTitle(dto.getTitle()); favorites.setTitle(dto.getTitle());
favorites.setDescription(dto.getDescription()); favorites.setDescription(dto.getDescription());
favorites.setImages(dto.getImages());
favorites.setUpdateTime(new Date()); favorites.setUpdateTime(new Date());
favoritesDao.update(favorites); favoritesDao.update(favorites);
logger.info("【请求结束】修改收藏册成功"); logger.info("【请求结束】修改收藏册成功");
......
...@@ -115,6 +115,7 @@ public class ItemServiceImpl implements ItemService { ...@@ -115,6 +115,7 @@ public class ItemServiceImpl implements ItemService {
// 新增收藏册和藏品关联记录 // 新增收藏册和藏品关联记录
FavoritesItemsRelation favoritesItemsRelation = new FavoritesItemsRelation(); FavoritesItemsRelation favoritesItemsRelation = new FavoritesItemsRelation();
favoritesItemsRelation.setUserId(dto.getUserId());
favoritesItemsRelation.setFavoritesId(dto.getFavoritesId()); favoritesItemsRelation.setFavoritesId(dto.getFavoritesId());
favoritesItemsRelation.setItemId(item.getId()); favoritesItemsRelation.setItemId(item.getId());
favoritesItemsRelation.setAddTime(now); favoritesItemsRelation.setAddTime(now);
......
...@@ -76,7 +76,6 @@ public class WxFavoritesController { ...@@ -76,7 +76,6 @@ public class WxFavoritesController {
String userId = JsonUtils.getValueByPath(json, "userId"); String userId = JsonUtils.getValueByPath(json, "userId");
String title = JsonUtils.getValueByPath(json, "title"); String title = JsonUtils.getValueByPath(json, "title");
String description = JsonUtils.getValueByPath(json, "description"); String description = JsonUtils.getValueByPath(json, "description");
String images = JsonUtils.getValueByPath(json, "images");
if (StringUtils.isBlank(userId)) { if (StringUtils.isBlank(userId)) {
return Result.failed("用户id不能为空"); return Result.failed("用户id不能为空");
...@@ -95,7 +94,6 @@ public class WxFavoritesController { ...@@ -95,7 +94,6 @@ public class WxFavoritesController {
dto.setUserId(Long.parseLong(userId)); dto.setUserId(Long.parseLong(userId));
dto.setTitle(title); dto.setTitle(title);
dto.setDescription(description); dto.setDescription(description);
dto.setImages(images);
return favoritesService.add(dto); return favoritesService.add(dto);
} }
...@@ -108,7 +106,6 @@ public class WxFavoritesController { ...@@ -108,7 +106,6 @@ public class WxFavoritesController {
String userId = JsonUtils.getValueByPath(json, "userId"); String userId = JsonUtils.getValueByPath(json, "userId");
String title = JsonUtils.getValueByPath(json, "title"); String title = JsonUtils.getValueByPath(json, "title");
String description = JsonUtils.getValueByPath(json, "description"); String description = JsonUtils.getValueByPath(json, "description");
String images = JsonUtils.getValueByPath(json, "images");
if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(id)) {
return Result.failed("id不能为空"); return Result.failed("id不能为空");
...@@ -131,7 +128,6 @@ public class WxFavoritesController { ...@@ -131,7 +128,6 @@ public class WxFavoritesController {
dto.setUserId(Long.parseLong(userId)); dto.setUserId(Long.parseLong(userId));
dto.setTitle(title); dto.setTitle(title);
dto.setDescription(description); dto.setDescription(description);
dto.setImages(images);
return favoritesService.update(dto); return favoritesService.update(dto);
} }
......
...@@ -98,7 +98,48 @@ public class WxItemController { ...@@ -98,7 +98,48 @@ public class WxItemController {
@ApiOperation(value = "修改") @ApiOperation(value = "修改")
@PostMapping("/update") @PostMapping("/update")
public Result update(@RequestBody ItemRequestDto dto) { public Result update(@RequestBody KlDataRequestDto klDataRequestDto) {
String json = klDataRequestDto.getKl_data();
logger.info("【请求开始】藏品发布,请求参数,kl_data:{}", json);
String id = JsonUtils.getValueByPath(json, "id");
String userId = JsonUtils.getValueByPath(json, "userId");
String cid = JsonUtils.getValueByPath(json, "cid");
String name = JsonUtils.getValueByPath(json, "name");
String detail = JsonUtils.getValueByPath(json, "detail");
String images = JsonUtils.getValueByPath(json, "images");
String favoritesId = JsonUtils.getValueByPath(json, "favoritesId");
String price = JsonUtils.getValueByPath(json, "price");
if (StringUtils.isBlank(id)) {
return Result.failed("id不能为空");
}
if (StringUtils.isBlank(userId)) {
return Result.failed("用户id不能为空");
}
if (StringUtils.isBlank(cid)) {
return Result.failed("分类id不能为空");
}
if (StringUtils.isBlank(name)) {
return Result.failed("标题不能为空");
}
if (StringUtils.isBlank(price)) {
return Result.failed("价格不能为空");
}
if (StringUtils.isBlank(images)) {
return Result.failed("图片或视频不能为空");
}
if (StringUtils.isBlank(favoritesId)) {
return Result.failed("收藏册id不能为空");
}
ItemRequestDto dto = new ItemRequestDto();
dto.setId(Long.parseLong(id));
dto.setUserId(Long.parseLong(userId));
dto.setName(name);
dto.setCid(Integer.parseInt(cid));
dto.setDetail(detail);
dto.setFavoritesId(Long.parseLong(favoritesId));
dto.setImages(images);
dto.setPrice(price);
return itemService.update(dto); return itemService.update(dto);
} }
...@@ -109,9 +150,9 @@ public class WxItemController { ...@@ -109,9 +150,9 @@ public class WxItemController {
logger.info("【请求开始】藏品详情查询,请求参数,kl_data:{}", json); logger.info("【请求开始】藏品详情查询,请求参数,kl_data:{}", json);
String userId = JsonUtils.getValueByPath(json, "userId"); String userId = JsonUtils.getValueByPath(json, "userId");
String id = JsonUtils.getValueByPath(json, "id"); String id = JsonUtils.getValueByPath(json, "id");
if (StringUtils.isBlank(userId)) { // if (StringUtils.isBlank(userId)) {
return Result.failed("用户id不能为空"); // return Result.failed("用户id不能为空");
} // }
if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(id)) {
return Result.failed("当前页不能为空"); return Result.failed("当前页不能为空");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment