From 174c7a8c513a814ab452619662bb04925e389117 Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Sun, 2 Aug 2026 22:56:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E5=88=92null=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/Admin/YeWu/PlanListController.php | 10 +++++++++ .../API/Admin/YeWu/PlanModelController.php | 21 +++++++++++-------- .../app/Services/Admin/YeWu/RosterService.php | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php index 8a293ca..aeac964 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php @@ -110,6 +110,10 @@ public function GetList(Request $request) foreach ($list as $key => $value) { foreach ($countsInfo as $k => $v) { if ($value->id == $v->roster_detail_id) { + $v->count = $v->count ?? 0; + $v->used_count = $v->used_count ?? 0; + $v->locked_count = $v->locked_count ?? 0; + $v->max_total = $v->max_total ?? 0; $list[$key]->countsInfo[] = $v; } } @@ -146,6 +150,12 @@ public function GetDetail() $info->max_total = 0; if (count($info->coutsInfo) > 0) { $info->max_total = $info->coutsInfo[0]->max_total; + foreach ($info->coutsInfo as $ci) { + $ci->count = $ci->count ?? 0; + $ci->used_count = $ci->used_count ?? 0; + $ci->locked_count = $ci->locked_count ?? 0; + $ci->max_total = $ci->max_total ?? 0; + } } return \Yz::Return(true, '获取成功', $info); } diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php index f32b4d6..4f60894 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php @@ -250,7 +250,7 @@ public function Save(Request $request) 'roster_id' => $roster_id, 'appointment_type_id' => $v['id'], 'max_total' => $planInfo['max_total'], - 'count' => $v['count'], + 'count' => $v['count'] ?? 0, ]); if (!$i_c) { DB::rollBack(); @@ -278,7 +278,7 @@ public function Save(Request $request) 'roster_id' => $roster_id, 'appointment_type_id' => $v['id'], 'max_total' => $planInfo['max_total'], - 'count' => $v['count'], + 'count' => $v['count'] ?? 0, ]); if (!$i_c) { DB::rollBack(); @@ -297,14 +297,15 @@ public function Save(Request $request) $i = DB::table('s_source_roster')->where(['id' => $planInfo['id'], 'is_del' => 0])->update($data); + $anyUpdate = false; foreach ($planInfo['qudao_total'] as $k => $v) { $i_c = DB::table('s_source_roster_count')->where(['roster_id' => $planInfo['id'], 'appointment_type_id' => $v['appointment_type_id']])->update([ 'max_total' => $planInfo['max_total'], - 'count' => $v['count'], + 'count' => $v['count'] ?? 0, ]); - + if ($i_c) $anyUpdate = true; } - if ($i or $i_c) { + if ($i or $anyUpdate) { } else { DB::rollBack(); return \Yz::echoError1('保存失败'); @@ -737,7 +738,7 @@ public function SaveAdmin(Request $request) 'roster_id' => $roster_id, 'appointment_type_id' => $v['id'], 'max_total' => $planInfo['max_total'], - 'count' => $v['count'], + 'count' => $v['count'] ?? 0, ]); if (!$i_c) { DB::rollBack(); @@ -764,7 +765,7 @@ public function SaveAdmin(Request $request) 'roster_id' => $roster_id, 'appointment_type_id' => $v['id'], 'max_total' => $planInfo['max_total'], - 'count' => $v['count'], + 'count' => $v['count'] ?? 0, ]); if (!$i_c) { DB::rollBack(); @@ -780,13 +781,15 @@ public function SaveAdmin(Request $request) if($planInfo['id'] > 0) { $data['id'] = $planInfo['id']; $i = DB::table('s_source_roster')->where(['id' => $planInfo['id'], 'is_del' => 0])->update($data); + $anyUpdate = false; foreach ($planInfo['qudao_total'] as $k => $v) { $i_c = DB::table('s_source_roster_count')->where(['roster_id' => $planInfo['id'], 'appointment_type_id' => $v['appointment_type_id']])->update([ 'max_total' => $planInfo['max_total'], - 'count' => $v['count'], + 'count' => $v['count'] ?? 0, ]); + if ($i_c) $anyUpdate = true; } - if ($i or $i_c) { + if ($i or $anyUpdate) { } else { DB::rollBack(); return \Yz::echoError1('保存失败'); diff --git a/Laravel/app/Services/Admin/YeWu/RosterService.php b/Laravel/app/Services/Admin/YeWu/RosterService.php index 342f1fe..26796c0 100644 --- a/Laravel/app/Services/Admin/YeWu/RosterService.php +++ b/Laravel/app/Services/Admin/YeWu/RosterService.php @@ -384,7 +384,7 @@ private function insertCountInfo($detailId, $rosterId) { $success = DB::table('s_source_roster_detail_count')->insert([ 'roster_detail_id' => $detailId, 'appointment_type_id' => $info->appointment_type_id, - 'count' => $info->count, + 'count' => $info->count ?? 0, 'locked_count' => $info->locked_count, 'max_total' => $info->max_total, 'created_at' => date('Y-m-d H:i:s'),