From 081ace2c53077e47cdc926fafd1eee22c4c33b9d Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Sat, 11 Nov 2023 09:53:23 +0800 Subject: [PATCH] fixed --- app/common/logic/task/TaskLogic.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/common/logic/task/TaskLogic.php b/app/common/logic/task/TaskLogic.php index b4c444030..2dac2f5fa 100644 --- a/app/common/logic/task/TaskLogic.php +++ b/app/common/logic/task/TaskLogic.php @@ -952,6 +952,9 @@ class TaskLogic extends BaseLogic $townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find(); // 行政村数量 $villageCount = Db::name('geo_village')->where(['street_code' => $townCompany['street']])->count(); + if ($villageCount == 0) { + throw new Exception('没有找到对应的行政村'.__FILE__.__LINE__); + } // 村公司 $villageCompanyList = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(street,:responsible_area)", ['company_type' => 17,'responsible_area'=>$townCompany['responsible_area']], true); $ids = array_column($villageCompanyList, 'id'); @@ -1018,7 +1021,9 @@ class TaskLogic extends BaseLogic if ($dayCount == $taskTemplateInfo['stage_day_one']) { // 目标任务金额 行政村数量*6000 + 小组服务团队数量*3000 $targetShareholderedMoney = bcadd(bcmul($villageCount, 6000, 2), bcmul($groupServiceCompanyCount, 3000, 2), 2); - + if ($targetShareholderedMoney == 0) { + throw new Exception('目标任务金额为0异常'.__FILE__.__LINE__); + } $companyIds = []; foreach ($groupServiceCompanyList as $groupServiceCompany) { $companyIds[] = $groupServiceCompany['id']; @@ -2368,6 +2373,9 @@ class TaskLogic extends BaseLogic $task = Task::where('id', $taskSchedulePlan['task_id'])->with('director_info')->find(); // 完成任务情况 list($groupServiceCompanyCount, $doneTaskGroupServiceCompanyCount) = self::taskType3DoneInfo($groupServiceCompanyList); + if ($groupServiceCompanyCount == 0) { + throw new Exception('小组服务公司数量为0异常'.__FILE__.__LINE__); + } $doneRate = bcdiv($doneTaskGroupServiceCompanyCount, $groupServiceCompanyCount,2); // <80% 未完成任务 关闭本次任务 if (bccomp($doneRate, 0.8, 2) == -1) { @@ -2568,7 +2576,9 @@ class TaskLogic extends BaseLogic if($taskDayCount == $stageDayTwoAccumulative) { // 小组服务公司总数 $groupServiceCompanyCount = Company::where(['street' => $townCompany['street'], 'company_type'=> 18])->count(); - + if ($groupServiceCompanyCount == 0) { + throw new Exception('小组服务公司数量为0异常'.__FILE__.__LINE__); + } // 小组服务完成股金上交数 $sharecapitalPaidCount = 0; foreach ($villageCompanyList as $villageCompany) {