__share = new Share(); $this->__hashids = new Hashids\Hashids('zhhashsalt'); } public function insertHashcode($ids, $idtype) { $this->__timetmp = gettimeofday(); $this->__share->endtime = time(); $this->__share->intime = time(); $this->__share->hashcode = $this->__hashids->encode($this->__timetmp['sec']); $this->__share->ids = $ids; $this->__share->idtype = $idtype; return array('status' => $this->__share->insert(), 'hashcode' => $this->__share->hashcode); } public function updateHashcode($ids, $idtype) { $this->__timetmp = gettimeofday(); $this->__share->hashcode = $this->__hashids->encode($this->__timetmp['sec']); return array('status' => $this->__share->update(array('where' => 'ids=? AND idtype=?', 'param' => array($ids, $idtype))), 'hashcode' => $this->__share->hashcode); } public function deleteHashcode($ids,$idtype) { $hashcode = $this->getHashCode($ids,$idtype); return $this->__share->delete(array('where' => 'sid=?', 'param' => array($hashcode['sid']))); } public function getCount($ids, $idtype) { return $this->__share->Count(array('where' => 'ids=? AND idtype=?', 'param' => array($ids, $idtype))); } public function getHashCode($ids,$idtype) { return $this->__share->getOne(array('where' => 'ids=? AND idtype=?', 'param' => array($ids, $idtype), 'asArray' => true)); } public function getSectionCount($ids) { return $this->__share->getOne(array('where' => 'ids=? AND idtype=2', 'param' => array($ids), 'asArray' => true)); } public function getCountByKey($key) { return $this->__share->Count(array('where' => 'hashcode=?', 'param' => array($key))); } public function getOne($key) { return $this->__share->getOne(array('where' => 'hashcode=?', 'param' => array($key), 'asArray' => true)); } }