Sfoglia il codice sorgente

fix(agreement): 优化协议更新逻辑并添加错误处理

- 修改了update方法中的返回逻辑
- 添加了更新结果检查机制
- 实现了更新失败时的错误提示功能
- 确保更新成功时返回明确的成功消息
shichen 5 mesi fa
parent
commit
2a6bb66af4
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      app/controller/admin/agreement/Agreement.php

+ 5 - 1
app/controller/admin/agreement/Agreement.php

@@ -39,7 +39,11 @@ class Agreement extends BaseController
39 39
     /*修改*/
40 40
     public  function update($id){
41 41
         $data = $this->request->params(['content','title','status']);
42
-        return app("json")->success($this->repository->updateData($id,$data));
42
+        $res = $this->repository->updateData($id,$data);
43
+        if (!$res){
44
+            return app("json")->fail('修改失败');
45
+        }
46
+        return app("json")->success('修改成功');
43 47
     }
44 48
 
45 49
     /*详情*/