public function actionDau()
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $params_str = http_build_query(['starttime' => date('Ymd', strtotime($_POST['starttime'])), 'endtime' => date('Ymd', strtotime($_POST['endtime'])), 'platform' => $_POST['platform'], 'channel' => $_POST['channel'], 'server' => $_POST['server']]);
     $curl = new Curl();
     $response = $curl->setOption(CURLOPT_HTTPHEADER, ['Accept:application/json'])->get(\Yii::$app->session['api_url'] . '/daus?' . $params_str);
     $data = Json::decode($response);
     return $data;
 }
 /**
  * ACU PCU
  * @return array
  */
 public function actionOnlday()
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $params_str = http_build_query(['starttime' => date('Ymd', strtotime($_POST['starttime'])), 'endtime' => date('Ymd', strtotime($_POST['endtime'])), 'platform' => $_POST['platform'], 'channel' => $_POST['channel'], 'server' => $_POST['server']]);
     $curl = new Curl();
     $response = $curl->setOption(CURLOPT_HTTPHEADER, ['Accept:application/json'])->get(Yii::$app->session['api_url'] . '/onl/day?' . $params_str);
     $data = Json::decode($response);
     $result = ['acu' => $data['acu'], 'pcu' => $data['pcu'], 'year' => date('Y', strtotime($_POST['starttime'])), 'month' => date('m', strtotime($_POST['starttime'])), 'day' => date('d', strtotime($_POST['starttime'])), 'subtitle' => $_POST['starttime'] . ' -- ' . $_POST['endtime']];
     return $result;
 }
Esempio n. 3
0
 /**
  * @return array
  * 激活玩家数据
  */
 public function actionAvp()
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $params_str = http_build_query(['starttime' => date('Ymd', strtotime($_POST['starttime'])), 'endtime' => date('Ymd', strtotime($_POST['endtime'])), 'platform' => $_POST['platform'], 'channel' => $_POST['channel'], 'server' => $_POST['server']]);
     $curl = new Curl();
     $response = $curl->setOption(CURLOPT_HTTPHEADER, ['Accept:application/json'])->get(Yii::$app->session['api_url'] . '/avps?' . $params_str);
     $data = Json::decode($response);
     $series = array_column($data, 'player_num');
     $categories = array_column($data, 'ymd');
     $max = !empty($series) ? max($series) : 0;
     return ['max' => $max, 'categories' => $categories, 'series' => $series];
 }