Example #1
0
 /**
  * @brief	Talk With Passgate
  * @author	fanmengzhe
  * @param	string	$strMethod	[batget]
  * @param	array	$arrInput	输入数组
  * @return	
  */
 protected static function _____($strMethod, $arrInput)
 {
     $ins = Bd_Passport_Interact::getEngine('Ral');
     $retry = 1;
     while ($retry-- >= 0) {
         $ret = $ins->Call('passgate', $strMethod, $arrInput);
         // Return false when Ral Failed
         if (!is_array($ret)) {
             self::$_errno = -1;
             Bd_Passport_Log::warning('Communication with Passgate failed.', self::$_errno);
             continue;
         }
         if (isset($ret['header']['err_no'])) {
             self::$_errno = $ret['header']['err_no'];
             self::$_errmsg = $ret['header']['errno_info'];
             Bd_Passport_Log::warning("[Input :" . json_encode($arrInput) . "]", -1);
             Bd_Passport_Log::warning("[Output:" . json_encode($ret) . "]", self::$_errno);
             continue;
         } else {
             self::$_errno = 0;
         }
         if (!isset($ret['content'])) {
             Bd_Passport_Log::warning("[Input :" . json_encode($arrInput) . "]", -1);
             Bd_Passport_Log::warning("[Output:" . json_encode($ret) . "]", self::$_errno);
             continue;
         }
         foreach ($ret['content'] as &$content) {
             if (!isset($content['result_params'])) {
                 Bd_Passport_Log::warning("[Input :" . json_encode($arrInput) . "]", -1);
                 Bd_Passport_Log::warning("[Output:" . json_encode($ret) . "]", self::$_errno);
                 continue;
             }
             foreach ($content['result_params'] as $key => &$val) {
                 if (isset($val['taginfo'])) {
                     $val['taginfo'] = self::_parseTagInfo($val['taginfo']);
                 }
                 if (isset($val['taginfo_ex'])) {
                     $val['taginfo_ex'] = self::_parseTagInfoEx($val['taginfo_ex']);
                 }
             }
         }
         return $ret;
     }
     //retry once
     return false;
 }
Example #2
0
 /**
  * @brief	Talk With Session
  *
  */
 protected static function _____($strMethod, $arrInput)
 {
     $ins = Bd_Passport_Interact::getEngine('Ral');
     //Fix Clientip . NET-ORDER , Int32(Neither UInt32 nor Long)
     $arrInput['clientip'] = Bd_Passport_Util::ip2int(CLIENT_IP);
     //If @ORP , Need Pass(ie, Session Key)
     if (self::$_is_orp) {
         $arrInput['pass'] = self::$_pass;
     }
     //If the session server is busy , Just retry once.
     $retry = 1;
     while ($retry >= 0) {
         // Do Interaction CALL HERE !!!
         $ret = $ins->Call('session', $strMethod, $arrInput);
         if (is_array($ret) && isset($ret['status'])) {
             self::$_errno = $ret['status'];
             //if (self::$_errno != 0) {
             //	Bd_Passport_Log::warning(self::$errmsgMap[self::$_errno], self::$_errno);
             //}
             if (self::RET_SSN2_SERVER_BUSY === $ret['status']) {
                 Bd_Passport_Log::warning(self::$errmsgMap[self::$_errno], self::$_errno);
                 --$retry;
                 continue;
             } else {
                 return $ret;
             }
         } else {
             //Let errno not defined , getMessage will return 'Unknown error'.
             Bd_Passport_Log::warning('Unknown Error', self::$_errno);
             self::$_errno = -1;
             return false;
         }
     }
     return false;
 }