|
@@ -34,30 +34,70 @@ array_map(function ($n)use($date, $tabName, $new, &$array, &$array2) {
|
|
|
$array2[] = (int) ($total / $new * 100); # 输出
|
|
|
}, $numbers);
|
|
|
//
|
|
|
+
|
|
|
+$result = new stdClass();
|
|
|
+$dic = new stdClass();
|
|
|
+$dic->data1 = $array;
|
|
|
+$dic->data2 = $array2;
|
|
|
+
|
|
|
+$result->data = $dic;
|
|
|
+echo json_encode($result);
|
|
|
*/
|
|
|
|
|
|
-//------new----
|
|
|
+//------new----/*
|
|
|
$zoneid = 1;//先默认是1,其他区还没有
|
|
|
-$curLoginUidArr = gMem()->hgetall($key);
|
|
|
+//$r = (strtotime($date)+28800);
|
|
|
+$day = intval((strtotime($date)+28800) / 86400);
|
|
|
+$memKey = "gamerun-loginUser-byUid-zone".$zoneid."-day_".$day;
|
|
|
+
|
|
|
+if(!gMem()->exists($memKey)){
|
|
|
+ $result = new stdClass();
|
|
|
+ $dic = new stdClass();
|
|
|
+ $dic->data1 = array(0,0,0,0,0,0,0,0);
|
|
|
+ $dic->data2 = array(0,0,0,0,0,0,0);
|
|
|
+ $result->data = $dic;
|
|
|
+
|
|
|
+ echo json_encode($result);
|
|
|
+}
|
|
|
+
|
|
|
+$retArr = array();
|
|
|
+$perArr = array();
|
|
|
+
|
|
|
+$curLoginUidDic = gMem()->hgetall($memKey);
|
|
|
+$total = count((array)$curLoginUidDic);
|
|
|
+$retArr[] = $total;
|
|
|
|
|
|
$numbersArr = array(1, 2, 3, 4, 5, 6,7);
|
|
|
-$day = intval(strtotime($date)/24/60/60);
|
|
|
foreach ($numbersArr as $type) {
|
|
|
- $typeDay = intval(strtotime("$day +$type day")/24/60/60);
|
|
|
+ $typeDay = $day + $type;
|
|
|
$memKey = "gamerun-loginUser-byUid-zone".$zoneid."-day_".$typeDay;
|
|
|
|
|
|
- $typeArr = gMem()->hgetall($memKey);
|
|
|
- $retainArr = array();
|
|
|
- foreach ($curLoginUidArr as $uid=>$val) {
|
|
|
- if(in_array($uid, $typeArr)){
|
|
|
- $retainArr[]=$uid;
|
|
|
+ if(!gMem()->exists($memKey)){
|
|
|
+ $retArr[] = 0;
|
|
|
+ } else {
|
|
|
+ $typeDic = gMem()->hgetall($memKey);
|
|
|
+ $n = 0;
|
|
|
+ foreach ($curLoginUidDic as $uid=>$val) {
|
|
|
+ if(property_exists($typeDic, $uid)){
|
|
|
+ $n += 1;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ $retArr[] = $n;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+$index = 0;
|
|
|
+foreach ($retArr as $num) {
|
|
|
+ if($index == 0){
|
|
|
+ $index += 1;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $per = intval($num/$total*100);
|
|
|
+ $perArr[] = $per;
|
|
|
+}
|
|
|
|
|
|
$result = new stdClass();
|
|
|
-$result->data1 = $array;
|
|
|
-$result->data2 = $array2;
|
|
|
+$result->data1 =$retArr;
|
|
|
+$result->data2 = $perArr;
|
|
|
echo json_encode($result);
|