From 6459a366137984a7dfbec09e9e87e6ded34e2ef9 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 15 Apr 2025 14:34:00 +0800 Subject: [PATCH] * [refac] if there is no periodic to-do, do not call the related functions. --- module/todo/model.php | 2 ++ module/todo/tao.php | 2 ++ module/user/model.php | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/module/todo/model.php b/module/todo/model.php index 824cfa91ca..075283c99e 100755 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -332,6 +332,8 @@ class todoModel extends model */ public function createByCycle(array $todoList): void { + if(empty($todoList)) return; + $this->loadModel('action'); $today = helper::today(); $now = helper::now(); diff --git a/module/todo/tao.php b/module/todo/tao.php index e721c5afbb..9686123ad7 100644 --- a/module/todo/tao.php +++ b/module/todo/tao.php @@ -159,6 +159,8 @@ class todoTao extends todoModel */ protected function getCycleList(array $todoList, string $orderBy = 'date_asc'): array { + if(empty($todoList)) return []; + return $this->dao->select('*')->from(TABLE_TODO) ->where('type')->eq('custom') ->andWhere('deleted')->eq('0') diff --git a/module/user/model.php b/module/user/model.php index b91f2cd1fc..a582c79e34 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -899,7 +899,7 @@ class userModel extends model /* 登录后创建周期性待办。*/ /* Create cycle todo after login. */ $todoList = $this->dao->select('*')->from(TABLE_TODO)->where('cycle')->eq(1)->andWhere('deleted')->eq('0')->andWhere('account')->eq($user->account)->fetchAll('id'); - $this->loadModel('todo')->createByCycle($todoList); + if($todoList) $this->loadModel('todo')->createByCycle($todoList); } if($user->avatar)