|
@@ -50,8 +50,8 @@ class ranklist
|
|
}
|
|
}
|
|
}
|
|
}
|
|
elseif($num == 2) {
|
|
elseif($num == 2) {
|
|
- $this->member_id = func_get_arg(0);
|
|
|
|
- $this->list_date = func_get_arg(1);
|
|
|
|
|
|
+ $this->member_id = intval(func_get_arg(0));
|
|
|
|
+ $this->list_date = intval(func_get_arg(1));
|
|
$this->list_sn = ranklist_helper::make_sn($this->member_id,$this->list_date);
|
|
$this->list_sn = ranklist_helper::make_sn($this->member_id,$this->list_date);
|
|
|
|
|
|
$param = $this->mod_toplist->getByListSn($this->list_sn);
|
|
$param = $this->mod_toplist->getByListSn($this->list_sn);
|
|
@@ -69,7 +69,7 @@ class ranklist
|
|
if($this->update) {
|
|
if($this->update) {
|
|
$data = array();
|
|
$data = array();
|
|
$data['list_value'] = $this->list_value;
|
|
$data['list_value'] = $this->list_value;
|
|
- $data['supports'] = serialize($this->supports);
|
|
|
|
|
|
+ $data['supports'] = $this->supports;
|
|
$data['friends'] = serialize($this->friends);
|
|
$data['friends'] = serialize($this->friends);
|
|
$data['top_id'] = $this->top_id;
|
|
$data['top_id'] = $this->top_id;
|
|
$data['top_money'] = $this->top_money;
|
|
$data['top_money'] = $this->top_money;
|
|
@@ -82,7 +82,7 @@ class ranklist
|
|
$data['list_sn'] = $this->list_sn;
|
|
$data['list_sn'] = $this->list_sn;
|
|
$data['member_id'] = $this->member_id;
|
|
$data['member_id'] = $this->member_id;
|
|
$data['list_date'] = $this->list_date;
|
|
$data['list_date'] = $this->list_date;
|
|
- $data['supports'] = serialize($this->supports);
|
|
|
|
|
|
+ $data['supports'] = $this->supports;
|
|
$data['friends'] = serialize($this->friends);
|
|
$data['friends'] = serialize($this->friends);
|
|
$data['top_id'] = $this->top_id;
|
|
$data['top_id'] = $this->top_id;
|
|
$data['top_money'] = $this->top_money;
|
|
$data['top_money'] = $this->top_money;
|
|
@@ -158,33 +158,21 @@ class ranklist
|
|
{
|
|
{
|
|
return $this->supports();
|
|
return $this->supports();
|
|
}
|
|
}
|
|
- public function supports_count()
|
|
|
|
|
|
+
|
|
|
|
+ public function support()
|
|
{
|
|
{
|
|
- return count($this->supports);
|
|
|
|
|
|
+ $this->supports += 1;
|
|
|
|
+ $this->dirty = true;
|
|
}
|
|
}
|
|
- public function support($other_id)
|
|
|
|
- {
|
|
|
|
- if(algorithm_helper::bsearch($other_id,$this->supports) == -1) {
|
|
|
|
- array_push($this->supports,$other_id);
|
|
|
|
- sort($this->supports);
|
|
|
|
- $this->dirty = true;
|
|
|
|
|
|
|
|
- return true;
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- public function unsupport($other_id)
|
|
|
|
|
|
+ public function unsupport()
|
|
{
|
|
{
|
|
- $pos = algorithm_helper::bsearch($other_id,$this->supports);
|
|
|
|
- if($pos == -1) {
|
|
|
|
- return false;
|
|
|
|
- } else {
|
|
|
|
- array_splice($this->supports,$pos,1);
|
|
|
|
|
|
+ if($this->supports >= 1) {
|
|
|
|
+ $this->supports -= 1;
|
|
$this->dirty = true;
|
|
$this->dirty = true;
|
|
- return true;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
private function init($param)
|
|
private function init($param)
|
|
{
|
|
{
|
|
if(!empty($param)) {
|
|
if(!empty($param)) {
|
|
@@ -195,7 +183,7 @@ class ranklist
|
|
$this->list_rank = intval($param['list_rank']);
|
|
$this->list_rank = intval($param['list_rank']);
|
|
$this->top_id = intval($param['top_id']);
|
|
$this->top_id = intval($param['top_id']);
|
|
$this->top_money = $param['top_money'];
|
|
$this->top_money = $param['top_money'];
|
|
- $this->supports = empty($param['supports']) ? array() : unserialize(($param['supports']));
|
|
|
|
|
|
+ $this->supports = intval($param['supports']);
|
|
$this->friends = empty($param['$friends']) ? array() : unserialize(($param['$friends']));
|
|
$this->friends = empty($param['$friends']) ? array() : unserialize(($param['$friends']));
|
|
|
|
|
|
$this->update = true;
|
|
$this->update = true;
|
|
@@ -204,7 +192,7 @@ class ranklist
|
|
$this->list_rank = 0;
|
|
$this->list_rank = 0;
|
|
$this->top_id = 0;
|
|
$this->top_id = 0;
|
|
$this->top_money = 0.00;
|
|
$this->top_money = 0.00;
|
|
- $this->supports = array();
|
|
|
|
|
|
+ $this->supports = 0;
|
|
$this->friends = array();
|
|
$this->friends = array();
|
|
|
|
|
|
$this->update = false;
|
|
$this->update = false;
|