瀏覽代碼

修改删除底部导航

15313670163 3 月之前
父節點
當前提交
18a067ba1b
共有 4 個文件被更改,包括 50 次插入16 次删除
  1. 19 15
      app/JsonRpc/FooterService.php
  2. 0 0
      runtime/container/scan.cache
  3. 1 1
      runtime/hyperf.pid
  4. 30 0
      runtime/logs/hyperf.log

+ 19 - 15
app/JsonRpc/FooterService.php

@@ -7,7 +7,7 @@ use App\Model\Website;
 use App\Model\FooterContent;
 use Hyperf\RpcServer\Annotation\RpcService;
 use App\Tools\Result;
-
+use Hyperf\DbConnection\Db;
 
 #[RpcService(name: "FooterService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
 class FooterService implements FooterServiceInterface
@@ -124,21 +124,25 @@ class FooterService implements FooterServiceInterface
      */
     public function delFooterCategory(array $data): array
     {
-        $footer_category = FooterCategory::where('id', $data['id'])->first();
-        if (!$footer_category) {
-            return Result::error("该底部导航不存在!");
-        }else{
-            
-            $result = FooterCategory::where('footer_category.id',$data['id'])
-            ->leftJoin("footer_content","footer_content.fcat_id","footer_category.id")
-            ->delete();
-        }
-        if(empty($result)){
-            return Result::error("删除失败!");
-        }else{
-            return Result::success($result);
+        Db::beginTransaction();
+        try{
+            $footer_category = FooterCategory::where('id', $data['id'])->first();
+            if (!$footer_category) {
+                return Result::error("该底部导航不存在!");
+            }else{
+                $result['footer_category'] = FooterCategory::where('id', $data['id'])->delete();
+                $result['footer_content'] = FooterContent::where('fcat_id', $data['id'])->delete();
+                // $result = FooterCategory::where('footer_category.id',$data['id'])
+                // ->leftJoin("footer_content","footer_content.fcat_id","footer_category.id")
+                // ->delete();
+            }
+            Db::commit();
+        } catch(\Throwable $ex){
+            Db::rollBack();
+            var_dump($ex->getMessage());
+            return Result::error("修改失败",0);
         }
-        
+        return Result::success($result);
     }
     /**
      * 添加底部导航(列表)内容

File diff suppressed because it is too large
+ 0 - 0
runtime/container/scan.cache


+ 1 - 1
runtime/hyperf.pid

@@ -1 +1 @@
-9544
+20795

+ 30 - 0
runtime/logs/hyperf.log

@@ -1543,3 +1543,33 @@
 [2025-01-16T15:33:46.441081+08:00] sql.INFO: [17.09] select `footer_category`.*, `website`.`website_name`, `website`.`id` as `website_id` from `footer_category` left join `website` on `website`.`id` = `footer_category`.`website_id` order by `updated_at` desc limit 10 offset 0 [] []
 [2025-01-16T15:33:46.570028+08:00] sql.INFO: [125.67] select count(*) as aggregate from `footer_category` [] []
 [2025-01-16T15:33:59.629410+08:00] sql.INFO: [16.74] select `footer_category`.*, `website`.`website_name`, `website`.`id` as `website_id` from `footer_category` left join `website` on `website`.`id` = `footer_category`.`website_id` where (`footer_category`.`name` like '%三农%') order by `updated_at` desc limit 10 offset 0 [] []
+[2025-01-17T14:24:58.655045+08:00] sql.INFO: [73.5] select * from `footer_category` where `id` = '12' limit 1 [] []
+[2025-01-17T14:24:58.694814+08:00] sql.INFO: [16.64] delete `footer_category` from `footer_category` left join `footer_content` on `footer_content`.`fcat_id` = `footer_category`.`id` where `footer_category`.`id` = '12' [] []
+[2025-01-17T14:25:27.770388+08:00] sql.INFO: [17.36] select * from `footer_category` where `id` = '12' limit 1 [] []
+[2025-01-17T14:25:27.788666+08:00] sql.INFO: [17.4] delete `footer_category` from `footer_category` left join `footer_content` on `footer_content`.`fcat_id` = `footer_category`.`id` where `footer_category`.`id` = '12' [] []
+[2025-01-17T14:27:11.719414+08:00] sql.INFO: [61.14] select * from `footer_category` where `id` = '12' limit 1 [] []
+[2025-01-17T14:27:28.507123+08:00] sql.INFO: [15.7] select * from `footer_category` where `id` = '12' limit 1 [] []
+[2025-01-17T14:27:28.737181+08:00] sql.INFO: [229.27] delete `footer_category` from `footer_category` left join `footer_content` on `footer_content`.`fcat_id` = `footer_category`.`id` where `footer_category`.`id` = '12' [] []
+[2025-01-17T14:29:17.361018+08:00] sql.INFO: [18.82] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:33:12.518544+08:00] sql.INFO: [16.82] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:16.119075+08:00] sql.INFO: [12.74] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:17.175467+08:00] sql.INFO: [12.89] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:18.467334+08:00] sql.INFO: [16.49] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:28.939716+08:00] sql.INFO: [14.88] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:32.662839+08:00] sql.INFO: [19.62] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:32.696064+08:00] sql.INFO: [17.59] select * from `footer_category` [] []
+[2025-01-17T14:36:51.263543+08:00] sql.INFO: [17.43] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:51.286262+08:00] sql.INFO: [21.81] select * from `footer_category` [] []
+[2025-01-17T14:36:54.429011+08:00] sql.INFO: [17.31] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:36:54.455893+08:00] sql.INFO: [15.89] select * from `footer_category` [] []
+[2025-01-17T14:38:07.672613+08:00] sql.INFO: [21.89] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:38:07.701735+08:00] sql.INFO: [15.39] select * from `footer_category` where `id` = '1' [] []
+[2025-01-17T14:45:12.858364+08:00] sql.INFO: [18.84] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:45:12.886312+08:00] sql.INFO: [16.39] select * from `footer_category` where `id` = '1' [] []
+[2025-01-17T14:45:12.907478+08:00] sql.INFO: [17.14] select * from `footer_content` where `fcat_id` = '1' [] []
+[2025-01-17T14:45:42.449944+08:00] sql.INFO: [20.11] select * from `footer_category` where `id` = '1' limit 1 [] []
+[2025-01-17T14:45:42.479582+08:00] sql.INFO: [15.46] delete from `footer_category` where `id` = '1' [] []
+[2025-01-17T14:45:42.550750+08:00] sql.INFO: [66.53] delete from `footer_content` where `fcat_id` = '1' [] []
+[2025-01-17T14:46:06.296738+08:00] sql.INFO: [15.85] select * from `footer_category` where `id` = '12' limit 1 [] []
+[2025-01-17T14:46:06.313163+08:00] sql.INFO: [15.75] delete from `footer_category` where `id` = '12' [] []
+[2025-01-17T14:46:06.330268+08:00] sql.INFO: [16.68] delete from `footer_content` where `fcat_id` = '12' [] []

Some files were not shown because too many files changed in this diff