|
@@ -13,29 +13,75 @@ use trans_wapper;
|
|
|
use Exception;
|
|
|
use session_helper;
|
|
|
|
|
|
-class special_support
|
|
|
+class special_support extends storage
|
|
|
{
|
|
|
- public function limit_type()
|
|
|
+ private $special_id;
|
|
|
+ private $comment_id;
|
|
|
+
|
|
|
+ public function __construct($special_id,$comment_id)
|
|
|
{
|
|
|
+ $this->special_id = intval($special_id);
|
|
|
+ $this->comment_id = intval($comment_id);
|
|
|
+ }
|
|
|
+ public function is_special() {
|
|
|
+ return ($this->special_id > 0 && $this->comment_id <= 0);
|
|
|
+ }
|
|
|
|
|
|
+ public function limit_type()
|
|
|
+ {
|
|
|
+ return storage::NORMAL_SUPPORT;
|
|
|
}
|
|
|
public function storage_tag()
|
|
|
{
|
|
|
-
|
|
|
+ if($this->is_special()) {
|
|
|
+ return "special_support";
|
|
|
+ } else {
|
|
|
+ return "special_comment_{$this->special_id}";
|
|
|
+ }
|
|
|
}
|
|
|
- public function support_count()
|
|
|
+ public function supported()
|
|
|
{
|
|
|
-
|
|
|
+ if($this->is_special()) {
|
|
|
+ return parent::base_supported($this->special_id);
|
|
|
+ } else {
|
|
|
+ return parent::base_supported($this->comment_id);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- public function onSuppored()
|
|
|
+ public function support()
|
|
|
{
|
|
|
-
|
|
|
+ if($this->is_special())
|
|
|
+ {
|
|
|
+ $ret = parent::base_support($this->special_id);
|
|
|
+ if($ret) {
|
|
|
+ $this->add_special_likes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $ret = parent::base_support($this->comment_id);
|
|
|
+ if($ret) {
|
|
|
+ $this->add_comment_likes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $ret;
|
|
|
}
|
|
|
- public function onUnSupported()
|
|
|
+ private function add_special_likes()
|
|
|
+ {
|
|
|
+ $mb_special = Model('mb_special');
|
|
|
+ $mb_special->table('mb_special')->where(['special_id' => $this->special_id])->update([ 'likes' => ['exp', 'likes + 1'] ]);
|
|
|
+ }
|
|
|
+ private function add_comment_likes()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+ public function unsupport()
|
|
|
+ {
|
|
|
+ if($this->is_special()) {
|
|
|
+ return parent::base_unsupport($this->special_id);
|
|
|
+ } else {
|
|
|
+ return parent::base_unsupport($this->comment_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class special_submitor extends storage
|
|
@@ -52,19 +98,10 @@ class special_submitor extends storage
|
|
|
}
|
|
|
|
|
|
public function submited() {
|
|
|
- return $this->supported($this->special_id);
|
|
|
+ return $this->base_supported($this->special_id);
|
|
|
}
|
|
|
public function submit() {
|
|
|
- parent::support($this->special_id);
|
|
|
- }
|
|
|
- public function support_count()
|
|
|
- {
|
|
|
- }
|
|
|
- public function onSuppored()
|
|
|
- {
|
|
|
- }
|
|
|
- public function onUnSupported()
|
|
|
- {
|
|
|
+ parent::base_support($this->special_id);
|
|
|
}
|
|
|
}
|
|
|
|