|
@@ -15,12 +15,13 @@ class statistics_helper
|
|
|
|
|
|
private $mItems;
|
|
|
private $mOther;
|
|
|
- private $mAppCount;
|
|
|
+ private $mIOSCount;
|
|
|
+ private $mAndroidCount;
|
|
|
private $mWapCount;
|
|
|
|
|
|
private $mRecordTime;
|
|
|
|
|
|
- const interval_time = 30;
|
|
|
+ const interval_time = 600;
|
|
|
|
|
|
public static function instance()
|
|
|
{
|
|
@@ -40,11 +41,14 @@ class statistics_helper
|
|
|
$record_time = $params['star_time'];
|
|
|
if($this->read_data($record_time))
|
|
|
{
|
|
|
- $this->mAppCount += $params['app_count'];
|
|
|
- $this->mWapCount += $params['wap_count'];
|
|
|
+ $this->mIOSCount += $params['ios_count'];
|
|
|
+ $this->mAndroidCount += $params['android_count'];
|
|
|
+ $this->mWapCount += $params['wap_count'];
|
|
|
$this->add_items($params);
|
|
|
$this->add_others($params);
|
|
|
- $data = ['function' => $this->mItems,'other' => $this->mOther,'app_count' => $this->mAppCount,'wap_count' => $this->mWapCount];
|
|
|
+
|
|
|
+ $data = ['function' => $this->mItems,'other' => $this->mOther,
|
|
|
+ 'ios_count' => $this->mIOSCount,'android_count' => $this->mAndroidCount,'wap_count' => $this->mWapCount];
|
|
|
$stat_call = new \statistics\statcall($record_time);
|
|
|
$stat_call->update($data);
|
|
|
}
|
|
@@ -59,7 +63,8 @@ class statistics_helper
|
|
|
if($record == false) {
|
|
|
$this->reinit();
|
|
|
} else {
|
|
|
- $this->mAppCount = $record['app_count'];
|
|
|
+ $this->mIOSCount = $record['ios_count'];
|
|
|
+ $this->mAndroidCount = $record['android_count'];
|
|
|
$this->mWapCount = $record['wap_count'];
|
|
|
$this->mItems = $record['function'];
|
|
|
$this->mOther = $record['other'];
|
|
@@ -94,9 +99,9 @@ class statistics_helper
|
|
|
{
|
|
|
if(empty($oper['count'])) {
|
|
|
$oper['count'] = 0;
|
|
|
+ } else {
|
|
|
+ $oper['count'] += intval($value);
|
|
|
}
|
|
|
-
|
|
|
- $oper['count'] += intval($value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -118,7 +123,7 @@ class statistics_helper
|
|
|
{
|
|
|
$data = ['star_time'=> $this->mRecordTime,'end_time' => time(),
|
|
|
'function' => $this->mItems,'other' => $this->mOther,
|
|
|
- 'app_count' => $this->mAppCount,'wap_count' => $this->mWapCount];
|
|
|
+ 'ios_count' => $this->mIOSCount,'android_count' => $this->mAndroidCount,'wap_count' => $this->mWapCount];
|
|
|
QueueClient::push("savelog",$data);
|
|
|
$this->reinit();
|
|
|
}
|
|
@@ -128,9 +133,15 @@ class statistics_helper
|
|
|
|
|
|
if($this->act($act) == false) return;
|
|
|
if($this->op($act,$op) == false) return;
|
|
|
- if($param['from_app'] == true) {
|
|
|
- $this->mAppCount += 1;
|
|
|
- } else {
|
|
|
+
|
|
|
+ $client_type = $param['client_type'];
|
|
|
+ if($client_type == 'ios') {
|
|
|
+ $this->mIOSCount += 1;
|
|
|
+ }
|
|
|
+ elseif($client_type == 'android') {
|
|
|
+ $this->mAndroidCount += 1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
$this->mWapCount += 1;
|
|
|
}
|
|
|
|
|
@@ -163,7 +174,7 @@ class statistics_helper
|
|
|
|
|
|
private function add_other($key,$count)
|
|
|
{
|
|
|
- if(isset($this->mOther[$key]) == false) {
|
|
|
+ if(array_key_exists($key,$this->mOther) == false) {
|
|
|
$this->mOther[$key] = [];
|
|
|
$this->mOther[$key]['count'] = $count;
|
|
|
} else {
|
|
@@ -188,7 +199,7 @@ class statistics_helper
|
|
|
if($op != 'index') return false;
|
|
|
|
|
|
$special_id = intval($param['special_id']);
|
|
|
- if($special_id > 0) {
|
|
|
+ if($special_id >= 0) {
|
|
|
$key = 'special_' . $special_id;
|
|
|
return $this->add_other($key,1);
|
|
|
} else {
|
|
@@ -230,7 +241,8 @@ class statistics_helper
|
|
|
$this->mItems = [];
|
|
|
$this->mOther = [];
|
|
|
$this->mWapCount = 0;
|
|
|
- $this->mAppCount = 0;
|
|
|
+ $this->mIOSCount = 0;
|
|
|
+ $this->mAndroidCount = 0;
|
|
|
$this->mRecordTime = time();
|
|
|
}
|
|
|
}
|