コード例 #1
0
 public function lost()
 {
     $log = KLogger::instance(KLOGGER_PATH . "processors/", KLogger::DEBUG);
     $log->logInfo("usergameaction > lost > start userId : " . $this->userId . " opponentId : " . $this->opponentId . " action : " . $this->action_ . " time : " . $this->time . " room groupId : " . $this->roomGroupId . " gameId : " . $this->gameId . " normal : " . $this->normal . " type : " . $this->type . " double : " . $this->double);
     if (!empty($this->userId)) {
         $user = GameUsers::getGameUserById($this->userId);
         if (!empty($user)) {
             $userId = $user->getUserId();
             if (!empty($userId)) {
                 $user->getUserLevel();
                 $opponent = GameUsers::getGameUserById($this->opponentId);
                 $opponentId = null;
                 if (!empty($opponent)) {
                     $opponentId = $opponent->getUserId();
                     $opponent->getUserLevel();
                 }
                 $result = GameUtils::gameResult($user, $opponent, $this->roomGroupId, $this->action_, $this->gameId, $this->double, $this->normal, $this->type, $this->time);
                 if (!empty($result) && $result->success) {
                     $log->logInfo("usergameaction > lost > success ");
                 } else {
                     $log->logError("usergameaction > lost > error :  " . $result->result);
                 }
                 unset($userId);
                 unset($user);
             } else {
                 $log->logError("usergameaction > lost > user Id is empty ");
             }
         } else {
             $log->logError("usergameaction > lost > user Id is empty ");
         }
     } else {
         $log->logError("usergameaction > lost > user Id is empty ");
     }
 }
コード例 #2
0
    exit(1);
}
if (!empty($userId)) {
    $user = GameUsers::getGameUserById($userId);
    if (!empty($user)) {
        $userId = $user->getUserId();
        if (!empty($userId)) {
            $user->getUserLevel();
            $opponent = GameUsers::getGameUserById($opponentId);
            $opponentId = null;
            if (!empty($opponent)) {
                $opponentId = $opponent->getUserId();
                $opponent->getUserLevel();
            }
            $log->logInfo("gameResult : userId > " . $userId . " opponentId > " . $opponentId . " roomgroupId > " . $roomGroupId . " gameId > " . $gameId . " double > " . $double . " normal > " . $normal . " type > " . $type);
            $result = GameUtils::gameResult($user, $opponent, $roomGroupId, $action, $gameId, $double, $normal, $type);
            unset($userId);
            unset($user);
        } else {
            $log->logError("User not found");
            $result->result = "User not found";
        }
    } else {
        $log->logError("User not found");
        $result->result = "User not found";
    }
} else {
    $log->logError("User not found");
    $result->result = "User not found";
}
echo json_encode($result);