fix: 修复门店控制器
This commit is contained in:
parent
4c95bf585f
commit
f9b5a7abb3
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
target/
|
target/
|
||||||
uploads/
|
uploads/
|
||||||
|
# 本地密钥,勿提交;用 application-example.yml 复制
|
||||||
|
src/main/resources/application.yml
|
||||||
|
|||||||
@ -42,12 +42,6 @@ public class StoreController {
|
|||||||
m.put("longitude", s.getLongitude());
|
m.put("longitude", s.getLongitude());
|
||||||
m.put("phone", s.getPhone());
|
m.put("phone", s.getPhone());
|
||||||
m.put("logo", s.getLogo());
|
m.put("logo", s.getLogo());
|
||||||
if (s.getBookingDayStart() != null) {
|
|
||||||
m.put("bookingDayStart", s.getBookingDayStart().toString());
|
|
||||||
}
|
|
||||||
if (s.getBookingLastSlotStart() != null) {
|
|
||||||
m.put("bookingLastSlotStart", s.getBookingLastSlotStart().toString());
|
|
||||||
}
|
|
||||||
return m;
|
return m;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return Map.of("code", 200, "data", rows);
|
return Map.of("code", 200, "data", rows);
|
||||||
@ -69,19 +63,15 @@ public class StoreController {
|
|||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
public Map<String, Object> update(@RequestBody Store store) {
|
public Map<String, Object> update(@RequestBody Store store) {
|
||||||
try {
|
Store updated = storeService.update(store);
|
||||||
Store updated = storeService.update(store);
|
if (updated == null) {
|
||||||
if (updated == null) {
|
return Map.of("code", 404, "message", "店铺不存在");
|
||||||
return Map.of("code", 404, "message", "店铺不存在");
|
|
||||||
}
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
result.put("code", 200);
|
|
||||||
result.put("message", "更新成功");
|
|
||||||
result.put("data", updated);
|
|
||||||
return result;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
return Map.of("code", 400, "message", e.getMessage() != null ? e.getMessage() : "参数错误");
|
|
||||||
}
|
}
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("message", "更新成功");
|
||||||
|
result.put("data", updated);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user