Beispiel #1
0
 public function myCloudOverviewAction(Request $request)
 {
     // @apitodo 需改成leaf
     $api = CloudAPIFactory::create('root');
     $content = $api->get("/users/{$api->getAccessKey()}/overview");
     $info = $api->get('/me');
     if (isset($info['licenseDomains'])) {
         $info['licenseDomainCount'] = count(explode(';', $info['licenseDomains']));
     }
     $isBinded = $this->getAppService()->getBinded();
     $email = isset($isBinded['email']) ? str_replace(substr(substr($isBinded['email'], 0, stripos($isBinded['email'], '@')), -4), '****', $isBinded['email']) : null;
     $eduSohoOpenClient = new EduSohoOpenClient();
     $currentTime = date('Y-m-d', time());
     $account = isset($content['account']) ? $content['account'] : null;
     $day = '';
     if (isset($content['account']['arrearageDate']) && $content['account']['arrearageDate'] != 0) {
         $day = ceil((strtotime($currentTime) - $content['account']['arrearageDate']) / 86400);
     }
     $user = isset($content['user']) ? $content['user'] : null;
     $endDate = isset($content['user']['endDate']) ? str_replace('-', '.', $content['user']['endDate']) : '';
     $startDate = isset($content['user']['startDate']) ? str_replace('-', '.', $content['user']['startDate']) : '';
     $packageDate = isset($content['user']['endDate']) ? ceil((strtotime($content['user']['endDate']) - strtotime($currentTime)) / 86400) : '';
     $tlp = isset($content['service']['tlp']) ? $content['service']['tlp'] : 0;
     $storage = isset($content['service']['storage']) ? $content['service']['storage'] : null;
     $storageDate = isset($content['service']['storage']['expire']) ? ceil(($content['service']['storage']['expire'] - strtotime($currentTime)) / 86400) : '';
     $month = isset($content['service']['storage']['bill']['date']) ? substr($content['service']['storage']['bill']['date'], -2) : '';
     $startYear = isset($content['service']['storage']['startMonth']) ? substr($content['service']['storage']['startMonth'], 0, 4) : '';
     $startMonth = isset($content['service']['storage']['startMonth']) ? substr($content['service']['storage']['startMonth'], -2) : '';
     $endYear = isset($content['service']['storage']['endMonth']) ? substr($content['service']['storage']['endMonth'], 0, 4) : '';
     $endMonth = isset($content['service']['storage']['endMonth']) ? substr($content['service']['storage']['endMonth'], -2) : '';
     $storageStart = $startYear . '.' . $startMonth;
     $storageEnd = $endYear . '.' . $endMonth;
     $live = isset($content['service']['live']) ? $content['service']['live'] : null;
     $liveDate = isset($content['service']['live']['expire']) ? ceil(($content['service']['live']['expire'] - strtotime($currentTime)) / 86400) : '';
     $sms = isset($content['service']['sms']) ? $content['service']['sms'] : null;
     $notices = $eduSohoOpenClient->getNotices();
     $notices = json_decode($notices, true);
     if ($this->getWebExtension()->isTrial()) {
         $trialHtml = $this->getCloudCenterExperiencePage();
     }
     return $this->render('TopxiaAdminBundle:App:my-cloud.html.twig', array('content' => $content, 'packageDate' => $packageDate, 'storageDate' => $storageDate, 'startDate' => $startDate, 'endDate' => $endDate, 'liveDate' => $liveDate, 'storageStart' => $storageStart, 'storageEnd' => $storageEnd, 'day' => $day, 'month' => $month, 'storage' => $storage, 'live' => $live, 'user' => $user, 'sms' => $sms, 'account' => $account, "notices" => $notices, 'info' => $info, 'isBinded' => $isBinded, 'email' => $email, 'tlp' => $tlp, 'trialhtml' => isset($trialHtml['content']) ? $trialHtml['content'] : null));
 }
Beispiel #2
0
 public function myCloudOverviewAction(Request $request)
 {
     $content = $this->getEduCloudService()->getUserOverview();
     $info = $this->getEduCloudService()->getAccountInfo();
     if (isset($info['licenseDomains'])) {
         $info['licenseDomainCount'] = count(explode(';', $info['licenseDomains']));
     }
     $isBinded = $this->getAppService()->getBinded();
     $email = isset($isBinded['email']) ? str_replace(substr(substr($isBinded['email'], 0, stripos($isBinded['email'], '@')), -4), '****', $isBinded['email']) : null;
     $eduSohoOpenClient = new EduSohoOpenClient();
     $currentTime = date('Y-m-d', time());
     $account = isset($content['account']) ? $content['account'] : null;
     $day = '';
     if (isset($content['account']['arrearageDate']) && $content['account']['arrearageDate'] != 0) {
         $day = ceil((strtotime($currentTime) - $content['account']['arrearageDate']) / 86400);
     }
     $user = isset($content['user']) ? $content['user'] : null;
     $endDate = isset($content['user']['endDate']) ? str_replace('-', '.', $content['user']['endDate']) : '';
     $startDate = isset($content['user']['startDate']) ? str_replace('-', '.', $content['user']['startDate']) : '';
     $packageDate = isset($content['user']['endDate']) ? ceil((strtotime($content['user']['endDate']) - strtotime($currentTime)) / 86400) : '';
     $tlp = isset($content['service']['tlp']) ? $content['service']['tlp'] : 0;
     $storage = isset($content['service']['storage']) ? $content['service']['storage'] : null;
     $storageDate = isset($content['service']['storage']['expire']) ? ceil(($content['service']['storage']['expire'] - strtotime($currentTime)) / 86400) : '';
     $month = isset($content['service']['storage']['bill']['date']) ? substr($content['service']['storage']['bill']['date'], 0, 1) : '';
     $startYear = isset($content['service']['storage']['startMonth']) ? substr($content['service']['storage']['startMonth'], 0, 4) : '';
     $startMonth = isset($content['service']['storage']['startMonth']) ? substr($content['service']['storage']['startMonth'], -2) : '';
     $endYear = isset($content['service']['storage']['endMonth']) ? substr($content['service']['storage']['endMonth'], 0, 4) : '';
     $endMonth = isset($content['service']['storage']['endMonth']) ? substr($content['service']['storage']['endMonth'], -2) : '';
     $storageStart = $startYear . '.' . $startMonth;
     $storageEnd = $endYear . '.' . $endMonth;
     $live = isset($content['service']['live']) ? $content['service']['live'] : null;
     $liveDate = isset($content['service']['live']['expire']) ? ceil(($content['service']['live']['expire'] - strtotime($currentTime)) / 86400) : '';
     $sms = isset($content['service']['sms']) ? $content['service']['sms'] : null;
     $notices = $eduSohoOpenClient->getNotices();
     $notices = json_decode($notices, true);
     return $this->render('TopxiaAdminBundle:App:my-cloud.html.twig', array('content' => $content, 'packageDate' => $packageDate, 'storageDate' => $storageDate, 'startDate' => $startDate, 'endDate' => $endDate, 'liveDate' => $liveDate, 'storageStart' => $storageStart, 'storageEnd' => $storageEnd, 'day' => $day, 'month' => $month, 'storage' => $storage, 'live' => $live, 'user' => $user, 'sms' => $sms, 'account' => $account, "notices" => $notices, 'info' => $info, 'isBinded' => $isBinded, 'email' => $email, 'tlp' => $tlp));
 }