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


PHP Process::save方法代码示例

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


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

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     try {
         $log = new Process();
         $log->name = "get-links";
         $log->status = "running";
         $log->save();
         //Check new links
         Rss::chunk(100, function ($rss) {
             foreach ($rss as $value) {
                 $this->loadRss($value);
                 $value->touch();
             }
         });
         //Remove old links
         $filterDate = new DateTime('now');
         $filterDate->sub(new DateInterval('P1D'));
         Link::where('date', '<', $filterDate)->where('updated_at', '<', $filterDate)->delete();
         $log->status = "finished";
         $log->save();
     } catch (Exception $e) {
         $this->info($url);
         $this->info($e->getMessage());
     }
 }
开发者ID:vmariano,项目名称:shared-links-ranking,代码行数:30,代码来源:LinksCommand.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     try {
         $log = new Process();
         $log->name = "get-shares";
         $log->status = "running";
         $log->save();
         $filterDate = new DateTime('now');
         $filterDate->sub(new DateInterval('P1D'));
         //Load shares
         Link::where('date', '>', $filterDate)->chunk(100, function ($links) {
             foreach ($links as $value) {
                 $shares = $this->getSharesCount($value->final_url);
                 $ref = Stats::where('id_link', $value->id)->orderBy('created_at', 'DESC')->first();
                 if (!$ref) {
                     $ref = new stdClass();
                     $ref->total = 0;
                 }
                 $stat = new Stats();
                 $stat->id_link = $value->id;
                 $stat->facebook = $shares['facebook'] != null ? $shares['facebook'] : $value->facebook;
                 $stat->twitter = $shares['twitter'] != null ? $shares['twitter'] : $value->twitter;
                 $stat->linkedin = $shares['linkedin'] != null ? $shares['linkedin'] : $value->linkedin;
                 $stat->googleplus = $shares['googleplus'] != null ? $shares['googleplus'] : $value->googleplus;
                 $stat->total = $stat->facebook + $stat->twitter + $stat->linkedin + $stat->googleplus;
                 $stat->dif_total = $stat->total - $ref->total;
                 $stat->save();
                 $value->facebook = $stat->facebook;
                 $value->twitter = $stat->twitter;
                 $value->linkedin = $stat->linkedin;
                 $value->googleplus = $stat->googleplus;
                 $value->total = $stat->total;
                 $value->save();
             }
         });
         $log->status = "finished";
         $log->save();
     } catch (Exception $e) {
         $this->info($url);
         $this->info($e->getMessage());
     }
 }
开发者ID:vmariano,项目名称:shared-links-ranking,代码行数:47,代码来源:SharesCommand.php

示例3: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $log = new Process();
     $log->name = "make-history";
     $log->status = "running";
     $log->save();
     $today = Carbon::today();
     $topToday = array();
     $newspapers = Newspaper::select('id')->get();
     $tags = Tag::select('id')->get();
     foreach ($newspapers as $key => $n) {
         $top = $this->getTopLink($today, $n->id, false);
         if ($top) {
             $topToday[] = $top;
         }
     }
     foreach ($tags as $key => $t) {
         $top = $this->getTopLink($today, false, $t->id);
         if ($top) {
             $topToday[] = $top;
         }
     }
     $topToday = array_unique($topToday);
     //Remove links for today
     History::where('date', '=', $today)->delete();
     //Save history
     foreach ($topToday as $key => $t) {
         $this->info($t->title);
         try {
             $h = new History();
             $h->id_ref = $t->id;
             unset($t->id);
             $h->fill($t->toArray());
             $h->date = $today;
             $h->save();
         } catch (Exception $e) {
         }
     }
     $log->status = "finished";
     $log->save();
 }
开发者ID:vmariano,项目名称:shared-links-ranking,代码行数:46,代码来源:HistoryCommand.php

示例4: stopProcess

 /**
  * Stops a background process in progress.
  *
  * @param Process $process The process to stop.
  * @return bool True if the process was stopped, false if not.
  */
 public static function stopProcess(Process $process)
 {
     if ($process->status == Process::STATUS_STARTING || $process->status == Process::STATUS_IN_PROGRESS) {
         $pid = $process->pid;
         $process->stopped = date('Y-m-d G:i:s');
         if ($pid) {
             $command = "kill " . escapeshellarg($pid);
             exec($command);
         }
         // Consider a "STOPPED" status instead.
         $process->status = Process::STATUS_STOPPED;
         $process->pid = null;
         $process->save();
         return true;
     } else {
         return false;
     }
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:24,代码来源:Dispatcher.php

示例5: asyncNext

 public function asyncNext()
 {
     $agent = AgentModel::find(Session::get('agent_id'));
     $agent->is_active = true;
     $agent->save();
     $status = StatusModel::where('store_id', $agent->store_id)->first();
     if (Session::has('process_id')) {
         $process = ProcessModel::find(Session::get('process_id'));
         $process->end_time = date('H:i:s');
         if (Input::has('ticket_type') && Input::get('ticket_type') != '') {
             $process->ticket_type = Input::get('ticket_type');
         }
         $process->save();
         Session::forget('process_id');
     }
     if (Input::get('is_next') == '1') {
         if ($status->current_queue_no + 1 <= $status->last_queue_no) {
             $status->current_queue_no = $status->current_queue_no + 1;
             $status->save();
             $process = new ProcessModel();
             $process->agent_id = Session::get('agent_id');
             $process->queue_no = $status->current_queue_no;
             $process->start_time = date('H:i:s');
             $process->save();
             Session::set('process_id', $process->id);
             return Response::json(['result' => 'success', 'currentQueueNo' => $status->current_queue_no, 'lastQueueNo' => $status->last_queue_no, 'processId' => $process->id]);
         } else {
             $agent->is_active = false;
             $agent->save();
             return Response::json(['result' => 'failed', 'msg' => 'The queue is empty']);
         }
     } else {
         $agent->is_active = false;
         $agent->save();
         return Response::json(['result' => 'failed', 'msg' => 'Your status is DEACTIVE']);
     }
 }
开发者ID:victory21th,项目名称:QM-Laravel,代码行数:37,代码来源:ProcessController.php

示例6: post

 /**
  * Implementation for 'POST' method for Rest API
  *
  * @param  mixed $proUid Primary key
  *
  * @return array $result Returns array within multiple records or a single record depending if
  *                       a single selection was requested passing id(s) as param
  */
 protected function post($proUid, $proParent, $proTime, $proTimeunit, $proStatus, $proTypeDay, $proType, $proAssignment, $proShowMap, $proShowMessage, $proShowDelegate, $proShowDynaform, $proCategory, $proSubCategory, $proIndustry, $proUpdateDate, $proCreateDate, $proCreateUser, $proHeight, $proWidth, $proTitleX, $proTitleY, $proDebug, $proDynaforms, $proDerivationScreenTpl)
 {
     try {
         $result = array();
         $obj = new Process();
         $obj->setProUid($proUid);
         $obj->setProParent($proParent);
         $obj->setProTime($proTime);
         $obj->setProTimeunit($proTimeunit);
         $obj->setProStatus($proStatus);
         $obj->setProTypeDay($proTypeDay);
         $obj->setProType($proType);
         $obj->setProAssignment($proAssignment);
         $obj->setProShowMap($proShowMap);
         $obj->setProShowMessage($proShowMessage);
         $obj->setProShowDelegate($proShowDelegate);
         $obj->setProShowDynaform($proShowDynaform);
         $obj->setProCategory($proCategory);
         $obj->setProSubCategory($proSubCategory);
         $obj->setProIndustry($proIndustry);
         $obj->setProUpdateDate($proUpdateDate);
         $obj->setProCreateDate($proCreateDate);
         $obj->setProCreateUser($proCreateUser);
         $obj->setProHeight($proHeight);
         $obj->setProWidth($proWidth);
         $obj->setProTitleX($proTitleX);
         $obj->setProTitleY($proTitleY);
         $obj->setProDebug($proDebug);
         $obj->setProDynaforms($proDynaforms);
         $obj->setProDerivationScreenTpl($proDerivationScreenTpl);
         $obj->save();
     } catch (Exception $e) {
         throw new RestException(412, $e->getMessage());
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:43,代码来源:Process.php

示例7: array

    $session = array('id' => @$r['0'], 'court' => @$r['0.0'], 'clerk' => @$r['0.2'], 'scheduled' => @$r['0.3'], 'date of occurence' => @$r['0.4']);
    $session['judge'] = array();
    for ($i0 = 0; isset($r['0.1.' . $i0]); $i0++) {
        $session['judge'][$i0] = @$r['0.1.' . $i0 . ''];
    }
    $case = array('id' => @$r['1'], 'area of law' => @$r['1.0']);
    $case['type of case'] = array();
    for ($i0 = 0; isset($r['1.1.' . $i0]); $i0++) {
        $case['type of case'][$i0] = @$r['1.1.' . $i0 . ''];
    }
    $case['session'] = array();
    for ($i0 = 0; isset($r['1.2.' . $i0]); $i0++) {
        $case['session'][$i0] = @$r['1.2.' . $i0 . ''];
    }
    $Process = new Process($ID, $session, $case);
    if ($Process->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF'] . '?Process=' . urlencode($Process->getId()));
    } else {
        die('');
    }
    exit;
    // do not show the interface
}
$buttons = "";
if (isset($_REQUEST['new'])) {
    $new = true;
} else {
    $new = false;
}
if (isset($_REQUEST['edit']) || $new) {
    $edit = true;
开发者ID:sapray,项目名称:ampersand-models,代码行数:31,代码来源:Process.php


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