From 93e6597c4a278b9e78bb33e4f6a7032932b474d1 Mon Sep 17 00:00:00 2001 From: xiaodong Date: Wed, 19 Aug 2026 09:54:53 +0800 Subject: [PATCH] debug --- app/controller/backend/ContentController.php | 47 ++++++++++++++-------------- app/service/ContentService.php | 5 +-- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/app/controller/backend/ContentController.php b/app/controller/backend/ContentController.php index c8f5e70..5e5c37b 100644 --- a/app/controller/backend/ContentController.php +++ b/app/controller/backend/ContentController.php @@ -435,30 +435,31 @@ class ContentController extends BaseController return jsonReturn(-2,lang('请求方法错误')); } $param = input('post.'); - var_dump($param); - exit(); - // try{ - // validate(ContentValidate::class)->scene('save')->check($param); - // }catch (ValidateException $e){ - // return jsonReturn(422, $e->getError()); - // } - // $param['admin'] = $this->admin; - // unset($param['main_content']['id']);//添加接口以防冲突不需要id - // unset($param['sub_content']['id']);//添加接口以防冲突不需要id - // if(empty($param['sub_content']['publish_time'])){ - // $param['sub_content']['publish_time'] = date('Y-m-d H:i:s',time()); - // } - // if(!isset($param['main_content'])){ - // $param['main_content'] = []; - // } - // try { - // $res = $contentService->saveContent($param); - // } catch (ModelEmptyException | ModelException $e) { - // return jsonReturn(-3,$e->getMessage()); - // } - // CacheService::clear(); - // return json($res); + // var_dump($param); + // exit(); + + try{ + validate(ContentValidate::class)->scene('save')->check($param); + }catch (ValidateException $e){ + return jsonReturn(422, $e->getError()); + } + $param['admin'] = $this->admin; + unset($param['main_content']['id']);//添加接口以防冲突不需要id + unset($param['sub_content']['id']);//添加接口以防冲突不需要id + if(empty($param['sub_content']['publish_time'])){ + $param['sub_content']['publish_time'] = date('Y-m-d H:i:s',time()); + } + if(!isset($param['main_content'])){ + $param['main_content'] = []; + } + try { + $res = $contentService->saveContent($param); + } catch (ModelEmptyException | ModelException $e) { + return jsonReturn(-3,$e->getMessage()); + } + CacheService::clear(); + return json($res); } diff --git a/app/service/ContentService.php b/app/service/ContentService.php index 23ca41d..917abf0 100644 --- a/app/service/ContentService.php +++ b/app/service/ContentService.php @@ -835,10 +835,7 @@ class ContentService { Log::error($e->getMessage().'--'.$e->getLine().'--'.$e->getFile()); return dataReturn(50012,$e->getMessage(), $e->getTrace()); } - // return dataReturn(0,lang('保存成功'),$subRes); - // var_dump($subRes); - // exit(); - return $subRes->toArray(); + return dataReturn(0,lang('保存成功'),$subRes); } /**