1
0
AntonLV 7 жил өмнө
parent
commit
db3efe463f

+ 1 - 6
inc/classes/BxDolViewQuery.php

@@ -62,15 +62,10 @@ class BxDolViewQuery extends BxDolObjectQuery
         $iDate = (int)$this->getOne("SELECT `date` FROM `{$this->_sTableTrack}` WHERE `object_id` = :object_id " . $sWhere, $aBindings);
         $iDate = (int)$this->getOne("SELECT `date` FROM `{$this->_sTableTrack}` WHERE `object_id` = :object_id " . $sWhere, $aBindings);
         $iDateNow = time();
         $iDateNow = time();
 
 
-        if(!$iDate) {
+        if(!$iDate || ($iDateNow - $iDate) > $this->_iPeriod) {
             $sQuery = $this->prepare("INSERT IGNORE INTO `{$this->_sTableTrack}` SET `object_id` = ?, `viewer_id` = ?, `viewer_nip` = ?, `date` = ?", $iObjectId, $iAuthorId, $iAuthorNip, $iDateNow);
             $sQuery = $this->prepare("INSERT IGNORE INTO `{$this->_sTableTrack}` SET `object_id` = ?, `viewer_id` = ?, `viewer_nip` = ?, `date` = ?", $iObjectId, $iAuthorId, $iAuthorNip, $iDateNow);
             return (int)$this->query($sQuery) > 0;
             return (int)$this->query($sQuery) > 0;
         }
         }
-
-        if(($iDateNow - $iDate) > $this->_iPeriod) {
-            $aBindings['date'] = $iDateNow;
-            return (int)$this->query("UPDATE `{$this->_sTableTrack}` SET `date` = :date WHERE `object_id` = :object_id " . $sWhere, $aBindings) > 0;
-        }
     }
     }
 
 
     public function updateTriggerTable($iObjectId)
     public function updateTriggerTable($iObjectId)