From cabf508ca7aec0e8d473eb08591e9f8381e9c999 Mon Sep 17 00:00:00 2001 From: liugang Date: Sat, 8 Jul 2023 10:30:20 +0800 Subject: [PATCH] * userModel: the getContactLists method return different result based on the $mode parameter. --- module/user/model.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/module/user/model.php b/module/user/model.php index 1164e27165..a2556ddfc6 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1443,19 +1443,20 @@ class userModel extends model /** * Get contact list of a user. * - * @param string $account - * @param string $params withempty|withnote - * + * @param string $account + * @param string $params withempty|withnote + * @param string $mode pairs|list * @access public * @return array */ - public function getContactLists($account, $params = '') + public function getContactLists(string $account, string $params = '', string $mode = 'pairs'): array { - $contacts = $this->dao->select('id, listName')->from(TABLE_USERCONTACT) + $this->dao->select('id, listName')->from(TABLE_USERCONTACT) ->where('account')->eq($account) ->orWhere('public')->eq(1) - ->orderBy('public, id_desc') - ->fetchPairs(); + ->orderBy('public, id_desc'); + + $contacts = $mode == 'pairs' ? $this->dao->fetchPairs() : $this->dao->fetchAll(); if(empty($contacts)) return array(); if(strpos($params, 'withempty') !== false) $contacts = array('' => '') + $contacts;