fix: 修改删除记录接口为POST方法
- 后端RecordController改用POST方法处理删除请求 - 小程序端api.js同步修改为POST方法 - 解决DELETE请求不被支持的问题
This commit is contained in:
1 parent
097173426f
commit
043780d5ab
2 files changed
+8
-6
No files matched your search
@@ -94,10 +94,11 @@ public class RecordController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
public Map<String, Object> deleteRecord(@RequestParam Long id) {
|
||||
@PostMapping("/delete")
|
||||
public Map<String, Object> deleteRecord(@RequestBody Map<String, Object> params) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Long id = Long.parseLong(params.get("id").toString());
|
||||
recordService.deleteById(id);
|
||||
result.put("success", true);
|
||||
result.put("message", "删除成功");
|
||||
@@ -108,10 +109,11 @@ public class RecordController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@DeleteMapping("/clear")
|
||||
public Map<String, Object> clearRecords(@RequestParam String userId) {
|
||||
@PostMapping("/clear")
|
||||
public Map<String, Object> clearRecords(@RequestBody Map<String, Object> params) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
String userId = params.get("userId").toString();
|
||||
recordService.deleteByUserId(userId);
|
||||
result.put("success", true);
|
||||
result.put("message", "清空成功");
|
||||
|
||||
Reference in new issue
Block a user