andre 2 năm trước cách đây
mục cha
commit
28e61302a2
2 tập tin đã thay đổi với 34 bổ sung2 xóa
  1. 14 0
      api/KerioWhmcs.php
  2. 20 2
      app/UI/Client/EmailAlias/Pages/Aliases.php

+ 14 - 0
api/KerioWhmcs.php

@@ -494,6 +494,20 @@ class KerioWhmcs extends KerioConnectApi {
 		return $result;
 	}
 
+	/**
+	 * Count user.
+	 *
+	 * @param	string	Domain ID
+	 * @return	int	Result
+	 */
+	function countUser($domainId) {
+		$params = array(
+			'domainId' => $domainId
+		);
+		$result = $this->sendRequest('Domains.getUserCountInfo', $params);
+		return $result;
+	}
+
 	/**
 	 * Delete user.
 	 *

+ 20 - 2
app/UI/Client/EmailAlias/Pages/Aliases.php

@@ -144,7 +144,25 @@ class Aliases extends DataTable implements ClientArea
         $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
         try {
             $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
-//            $domains = $api->getDomains(['id','name']);
+            $domains = $api->getDomains(['id','name']);
+        } catch (KerioApiException $error) {
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $error,
+                'Debug Error',
+                $error->getMessage()
+            );
+            return ['error' => $error->getMessage()];
+        }
+        foreach($domains as $maildomain) {
+            if(($maildomain['name']) === $this->getWhmcsParamByKey('domain')){ 
+                $this->maildomainID = $maildomain['id'];
+                $this->maildomain = $maildomain['name'];
+            }
+        }
+        try {
+            $accCount = $api->countUser($this->maildomainID);
         } catch (KerioApiException $error) {
             logModuleCall(
                 'kerioEmail',
@@ -167,7 +185,7 @@ class Aliases extends DataTable implements ClientArea
         logModuleCall(
             'kerioEmail',
             __FUNCTION__,
-            $hosting,
+            $accCount,
             'Debug Error',
             $this->maildomain
         );