|
@@ -33,15 +33,14 @@ abstract class storage
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- if($this->supported($uniqueid)) {
|
|
|
|
|
|
+ if($this->base_supported($uniqueid)) {
|
|
$supported = false;
|
|
$supported = false;
|
|
- $supports = $this->unsupport($uniqueid);
|
|
|
|
|
|
+ $this->base_unsupport($uniqueid);
|
|
} else {
|
|
} else {
|
|
$supported = true;
|
|
$supported = true;
|
|
- $supports = $this->support($uniqueid);
|
|
|
|
|
|
+ $this->base_support($uniqueid);
|
|
}
|
|
}
|
|
-
|
|
|
|
- return ['likes' => $supports,'supported' => $supported,'inoherb_id' => $uniqueid];
|
|
|
|
|
|
+ return $supported;
|
|
}
|
|
}
|
|
|
|
|
|
private function session_data()
|
|
private function session_data()
|
|
@@ -63,7 +62,7 @@ abstract class storage
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- protected function supported($uniqueid)
|
|
|
|
|
|
+ protected function base_supported($uniqueid)
|
|
{
|
|
{
|
|
$this->session_data();
|
|
$this->session_data();
|
|
if(algorithm::binary_search($this->mCurStorage,$uniqueid)) {
|
|
if(algorithm::binary_search($this->mCurStorage,$uniqueid)) {
|
|
@@ -73,29 +72,30 @@ abstract class storage
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- protected function support($uniqueid)
|
|
|
|
|
|
+ protected function base_support($uniqueid)
|
|
{
|
|
{
|
|
- $this->session_data();
|
|
|
|
|
|
+ $this->session_data();
|
|
if(algorithm::binary_search($this->mCurStorage,$uniqueid) == false) {
|
|
if(algorithm::binary_search($this->mCurStorage,$uniqueid) == false) {
|
|
$pos = algorithm::lower_bonud($this->mCurStorage,$uniqueid);
|
|
$pos = algorithm::lower_bonud($this->mCurStorage,$uniqueid);
|
|
algorithm::array_insert($this->mCurStorage,$pos,$uniqueid);
|
|
algorithm::array_insert($this->mCurStorage,$pos,$uniqueid);
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- protected function unsupport($uniqueid)
|
|
|
|
|
|
+ protected function base_unsupport($uniqueid)
|
|
{
|
|
{
|
|
$this->session_data();
|
|
$this->session_data();
|
|
if(algorithm::binary_search($this->mCurStorage,$uniqueid) == true) {
|
|
if(algorithm::binary_search($this->mCurStorage,$uniqueid) == true) {
|
|
$pos = algorithm::lower_bonud($this->mCurStorage,$uniqueid);
|
|
$pos = algorithm::lower_bonud($this->mCurStorage,$uniqueid);
|
|
algorithm::array_erase($this->mCurStorage,$pos);
|
|
algorithm::array_erase($this->mCurStorage,$pos);
|
|
- $this->onUnSupported();
|
|
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- return $this->support_count();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
abstract protected function limit_type();
|
|
abstract protected function limit_type();
|
|
abstract protected function storage_tag();
|
|
abstract protected function storage_tag();
|
|
- abstract protected function support_count();
|
|
|
|
- abstract protected function onSuppored();
|
|
|
|
- abstract protected function onUnSupported();
|
|
|
|
}
|
|
}
|