|
@@ -53,11 +53,18 @@ class bonus_share
|
|
|
}
|
|
|
public function get($share_id = 0)
|
|
|
{
|
|
|
- if($share_id == 0) {
|
|
|
+ $share_id = intval($share_id);
|
|
|
+ if($share_id <= 0) {
|
|
|
$count = count($this->mShareIds);
|
|
|
- $share_id = mt_rand(1,$count);
|
|
|
+ $pos = mt_rand(0,$count - 1);
|
|
|
+ $share_id = $this->mShareIds[$pos];
|
|
|
}
|
|
|
|
|
|
- return $this->mDatas[$share_id];
|
|
|
+ if(array_key_exists($share_id,$this->mDatas)) {
|
|
|
+ return $this->mDatas[$share_id];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return $this->mDatas[self::default_id];
|
|
|
+ }
|
|
|
}
|
|
|
}
|