示例#1
0
 public function UnPackExchangeResult($buff, $uType)
 {
     $oSocketType = @(include __APP_ROOT_DIR__ . "/etc/SocketType.php");
     $oExchange = new Lm_Exchange();
     $TypeInfo = $oSocketType[$uType];
     if ($TypeInfo['Type']) {
         $format = $TypeInfo['UnPackFormat'];
         $unpackArr = @unpack($TypeInfo['UnPackFormat'], $buff);
         $ExchangeInfo = $oExchange->getQueuedExchange(trim($unpackArr['uExchangeID']));
         if ($unpackArr['uResultID'] == 0) {
             if ($ExchangeInfo['ExchangeStatus'] == 1) {
                 $EndExchange = $oExchange->endExchange($ExchangeInfo['ExchangeId'], $unpackArr['uSN']);
             }
         } else {
             if ($ExchangeInfo['ReTryCount'] < 3) {
                 $reTry = $oExchange->updateExchangeQueue($ExchangeInfo['ExchangeId'], array('RetryCount' => $ExchangeInfo['ReTryCount'] + 1));
                 $addQueue = $oExchange->convertExchangeToSocket($ExchangeInfo['ExchangeId']);
             } else {
                 $oExchange->ExchangeFail($unpackArr['uExchangeID']);
             }
         }
     }
 }