当前位置: 首页>>代码示例>>PHP>>正文


PHP Activity::concept方法代码示例

本文整理汇总了PHP中app\Activity::concept方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::concept方法的具体用法?PHP Activity::concept怎么用?PHP Activity::concept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Activity的用法示例。


在下文中一共展示了Activity::concept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //register log in DB
     $dateBegin = new \DateTime();
     $activity = Activity::concept(ConstDb::LOAD_CRL)->first();
     if ($activity) {
         $activity->date_begin = $dateBegin->format('Y-m-d H:i:s');
         $activity->save();
     } else {
         Activity::create(['concept' => ConstDb::LOAD_CRL, 'date_begin' => $dateBegin->format('Y-m-d H:i:s')]);
     }
     //end log
     $this->info('Begin: ' . date('H:i:s'));
     $result = DB::connection('mysql_crl')->select($this->getQuery(true));
     $rows = $result[0]->total;
     $this->info("Total de filas: {$rows}");
     $begin = 0;
     $block = 10000;
     $countBlock = 1;
     $fCsv = storage_path('app/crl.csv');
     if (file_exists($fCsv)) {
         unlink($fCsv);
     }
     $fp = fopen($fCsv, 'w');
     fputs($fp, "organization, from, year, quarter, month, total \n");
     while ($rows > $begin) {
         $result = DB::connection('mysql_crl')->select($this->getQuery(false, $begin, $block));
         foreach ($result as $key => $value) {
             $array = json_decode(json_encode($value), true);
             $replace = ["\n", ',', '  '];
             $replaceTo = ["", ';', ' '];
             foreach ($array as $key => $value) {
                 $array[$key] = str_replace($replace, $replaceTo, $value);
             }
             fputs($fp, implode($array, ',') . "\n");
         }
         $this->info("End block {$countBlock}: " . date('H:i:s'));
         $begin += $block;
         $countBlock++;
     }
     fclose($fp);
     $this->info('End export CSV: ' . date('H:i:s'));
     Schema::drop('crl');
     $db = env('MONGO_DATABASE');
     $command = "mongoimport -d {$db} -c crl --type csv --file {$fCsv} --headerline";
     shell_exec($command);
     //register log in DB
     $dateEnd = new \DateTime();
     $activity = Activity::concept(ConstDb::LOAD_CRL)->first();
     if ($activity) {
         $activity->date_end = $dateEnd->format('Y-m-d H:i:s');
         $activity->save();
     } else {
         Activity::create(['concept' => ConstDb::LOAD_CRL, 'date_end' => $dateEnd->format('Y-m-d H:i:s')]);
     }
     //end log
     $this->info('End: ' . $dateEnd->format('H:i:s'));
 }
开发者ID:MiguelPazo,项目名称:ecmonitoring,代码行数:63,代码来源:LoadCrl.php

示例2: saveLog

 public function saveLog($begin, $concept)
 {
     $date = new \DateTime();
     $activity = Activity::concept($concept)->first();
     if ($activity) {
         if ($begin) {
             $activity->date_begin = $date->format('Y-m-d H:i:s');
         } else {
             $activity->date_end = $date->format('Y-m-d H:i:s');
         }
         $activity->save();
     } else {
         if ($begin) {
             Activity::create(['concept' => $concept, 'date_begin' => $date->format('Y-m-d H:i:s')]);
         } else {
             Activity::create(['concept' => $concept, 'date_end' => $date->format('Y-m-d H:i:s')]);
         }
     }
 }
开发者ID:MiguelPazo,项目名称:ecmonitoring,代码行数:19,代码来源:LoadCert.php

示例3: getLastUpdate

 public function getLastUpdate($concept)
 {
     switch ($concept) {
         case 1:
             $concept = ConstDb::LOAD_CERT;
             break;
         case 2:
             $concept = ConstDb::LOAD_CERT_VIG;
             break;
         case 3:
             $concept = ConstDb::LOAD_CRL;
             break;
         case 4:
             $concept = ConstDb::LOAD_CERT_OPER;
             break;
         default:
             $concept = ConstDb::LOAD_CERT;
             break;
     }
     $oActivity = Activity::concept($concept)->first(['date_begin']);
     $time = strtotime($oActivity->date_begin);
     $date = date('d/m/Y H:i', $time);
     return response()->json($date);
 }
开发者ID:MiguelPazo,项目名称:ecmonitoring,代码行数:24,代码来源:HomeController.php


注:本文中的app\Activity::concept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。