|
@@ -23,7 +23,11 @@ class ctl_item
|
|
|
private $mOpened;
|
|
|
private $mPrice;
|
|
|
|
|
|
- private $mRatio;
|
|
|
+ private $mCommitSucc;
|
|
|
+ private $mCommitFail;
|
|
|
+ private $mNotifySucc;
|
|
|
+ private $mNotifyFail;
|
|
|
+
|
|
|
|
|
|
public function __construct($chname,$card_type,$amount,$max_speed,$priority,$storge,$opened,$quality)
|
|
|
{
|
|
@@ -40,7 +44,11 @@ class ctl_item
|
|
|
$this->mOpened = $opened;
|
|
|
$this->mRecords = [];
|
|
|
$this->mPrice = 0.0;
|
|
|
- $this->mRatio = new ratio();
|
|
|
+
|
|
|
+ $this->mCommitSucc = 0;
|
|
|
+ $this->mCommitFail = 0;
|
|
|
+ $this->mNotifySucc = 0;
|
|
|
+ $this->mNotifyFail = 0;
|
|
|
|
|
|
$this->load(time() - ctl_item::speed_secs + 1);
|
|
|
}
|
|
@@ -122,6 +130,29 @@ class ctl_item
|
|
|
return $this->mPrice;
|
|
|
}
|
|
|
public function set_ratio($ratio) {
|
|
|
- $this->mRatio->update($ratio);
|
|
|
+ $this->mCommitSucc = $ratio[0];
|
|
|
+ $this->mCommitFail = $ratio[1];
|
|
|
+ $this->mNotifySucc = $ratio[2];
|
|
|
+ $this->mNotifyFail = $ratio[3];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function commit_ratio()
|
|
|
+ {
|
|
|
+ $count = $this->mCommitSucc + $this->mCommitFail;
|
|
|
+ if($count > 0) {
|
|
|
+ return [true,$this->mCommitSucc / $count];
|
|
|
+ } else {
|
|
|
+ return [false,0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function notify_ratio()
|
|
|
+ {
|
|
|
+ $count = $this->mNotifySucc + $this->mNotifyFail;
|
|
|
+ if($count > 0) {
|
|
|
+ return [true,$this->mCommitSucc / $count];
|
|
|
+ } else {
|
|
|
+ return [false,0];
|
|
|
+ }
|
|
|
}
|
|
|
}
|