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


PHP Prefs::isRunning方法代码示例

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


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

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $logistic_id = 'CGKN00027';
     $logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
     if (Prefs::isRunning($this->name)) {
         $l = array();
         $l['ts'] = new MongoDate();
         $l['error'] = 'process already running';
         $l['consignee_logistic_id'] = $logistic->logistic_code;
         $l['consignee_olshop_cust'] = $logistic_id;
         Threeplstatuserror::insert($l);
         die('process already running');
     }
     $orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where(function ($sq) {
         $sq->where('status', '!=', 'delivered')->where('status', '!=', 'undelivered')->where('status', '!=', 'canceled')->where('status', '!=', 'returned');
     })->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->get();
     $res = array();
     print 'count ' . count($orders->toArray());
     if ($orders && count($orders->toArray()) > 0) {
         $req = array();
         foreach ($orders as $ord) {
             //$req[] = array('order_id'=>$ord->no_sales_order.'-'.$ord->consignee_olshop_orderid,'awb'=>$ord->awb);
             $req[] = array('order_id' => $ord->consignee_olshop_orderid, 'awb' => $ord->consignee_olshop_orderid);
         }
         $client = new GuzzleClient();
         //TO DO : Send data in chunk
         $reqchunks = array_chunk($req, 100);
         foreach ($reqchunks as $rq) {
             $this->sendData($rq, $client, $logistic, $logistic_id);
         }
     } else {
         print 'Empty order list' . "\r\n";
     }
     $actor = $this->name;
     Event::fire('log.api', array('JayaStatusDaemon', 'get', $actor, 'JAYA STATUS PULL'));
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:41,代码来源:JayaStatusDaemon.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $logistic_id = 'B234-JKT';
     $delivery_trigger = $this->e21status['DELIVERED'];
     $returned_trigger = $this->e21status['RETURNED'];
     $undelivered_trigger = $this->e21status['UNDELIVERED'];
     $logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
     if (Prefs::isRunning($this->name)) {
         $l = array();
         $l['ts'] = new MongoDate();
         $l['error'] = 'process already running';
         $l['consignee_logistic_id'] = $logistic->logistic_code;
         $l['consignee_olshop_cust'] = $logistic_id;
         Threeplstatuserror::insert($l);
         die('process already running');
     }
     if ($logistic) {
     } else {
         die('logistic data not found');
     }
     $token = '';
     $token_file = public_path() . '/storage/21oauth.key';
     if (file_exists($token_file)) {
         $token = file_get_contents(public_path() . '/storage/21oauth.key');
     }
     if ($token == '') {
         $token = $this->getToken($logistic);
     } else {
         $token = json_decode($token);
         if (isset($token->access_token)) {
             $token = $token->access_token;
         }
     }
     $orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where(function ($sq) {
         $sq->where('status', '!=', 'delivered')->where('status', '!=', 'undelivered')->where('status', '!=', 'canceled')->where('status', '!=', 'returned');
     })->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->get();
     if ($orders && count($orders->toArray()) > 0) {
         $req = array();
         foreach ($orders as $ord) {
             $result = $this->sendRequest($ord->awb, $logistic, $token);
             $res = json_decode($result, true);
             if (isset($res['code']) && ($res['code'] == '0' || $res['code'] == 0)) {
                 print 'reset token' . "\r\n";
                 $token = $this->getToken($logistic);
                 $res = $this->sendRequest($ord->awb, $logistic, $token);
                 $res = json_decode($result, true);
             }
             $reslog = $res;
             $reslog['timestamp'] = new MongoDate();
             $reslog['consignee_logistic_id'] = $logistic->logistic_code;
             $reslog['consignee_olshop_cust'] = $logistic_id;
             Threeplstatuslog::insert($reslog);
             print_r($res);
             if (isset($res['shipment'])) {
                 $ord = Shipment::where('awb', '=', $res['shipment']['code'])->orderBy('created_at', 'desc')->first();
                 if ($ord) {
                     $pre = clone $ord;
                     $laststat = $res['shipment']['statuses'];
                     $laststat = array_pop($laststat);
                     $lst = trim($laststat['status']);
                     if (in_array($lst, $delivery_trigger) || $lst == 'RECEIVED') {
                         $ord->status = \Config::get('jayon.trans_status_mobile_delivered');
                         $ord->position = 'CUSTOMER';
                     }
                     if (in_array($lst, $returned_trigger) || $lst == 'RETURN') {
                         $ord->status = \Config::get('jayon.trans_status_mobile_return');
                     }
                     if (in_array($lst, $undelivered_trigger) || $lst == 'NOT DELIVERED') {
                         $ord->status = \Config::get('jayon.trans_status_undelivered');
                     }
                     //$ord->district = $ls->district;
                     $ord->logistic_status = $laststat['status'];
                     $ord->logistic_status_ts = $laststat['datetime'];
                     $ord->logistic_raw_status = $laststat;
                     $ord->save();
                     $ts = new MongoDate();
                     $hdata = array();
                     $hdata['historyTimestamp'] = $ts;
                     $hdata['historyAction'] = 'api_shipment_change_status';
                     $hdata['historySequence'] = 1;
                     $hdata['historyObjectType'] = 'shipment';
                     $hdata['historyObject'] = $ord->toArray();
                     $hdata['actor'] = $this->name;
                     $hdata['actor_id'] = '';
                     //History::insert($hdata);
                     $sdata = array();
                     $sdata['timestamp'] = $ts;
                     $sdata['action'] = 'api_shipment_change_status';
                     $sdata['reason'] = 'api_update';
                     $sdata['objectType'] = 'shipment';
                     $sdata['object'] = $ord->toArray();
                     $sdata['preObject'] = $pre->toArray();
                     $sdata['actor'] = $this->name;
                     $sdata['actor_id'] = '';
                     Shipmentlog::insert($sdata);
//.........这里部分代码省略.........
开发者ID:awidarto,项目名称:bilnatracker,代码行数:101,代码来源:E21ExpressStatus.php

示例3: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //$base_url = 'http://localhost/jexadmin/public/api/v1/service/status';
     $base_url = 'http://api.sap-express.com/api/tracking/list/ref/';
     //$base_url = 'http://182.23.64.151/serverapi.sap/api/tracking/list/id/';
     $base_url = 'http://api.sap-express.com/api/tracking/list';
     $logistic_id = 'CGKN00284';
     $delivery_trigger = 'DELIVERED';
     $returned_trigger = 'UNDELIVERED';
     $logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
     if (Prefs::isRunning($this->name)) {
         $l = array();
         $l['ts'] = new MongoDate();
         $l['error'] = 'process already running';
         $l['consignee_logistic_id'] = $logistic->logistic_code;
         $l['consignee_olshop_cust'] = $logistic_id;
         Threeplstatuserror::insert($l);
         die('process already running');
     }
     $orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where(function ($sq) {
         $sq->where('status', '!=', 'delivered')->where('status', '!=', 'undelivered')->where('status', '!=', 'canceled')->where('status', '!=', 'returned');
     })->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->get();
     if ($orders && count($orders->toArray()) > 0) {
         $req = array();
         foreach ($orders as $ord) {
             //$req[] = array('awb'=>$ord->awb);
             //$client = new GuzzleClient();
             //$request = $client->get($url, array());
             //$request->setAuth('sapclientapi', 'SAPCLIENTAPI_2014');
             //$response = $request->send();
             //print $response->getBody();
             //$url = $base_url.$ord->consignee_olshop_orderid;
             $username = 'sapclientapi';
             $password = 'SAPCLIENTAPI_2014';
             $url = $base_url . '?ref=' . $ord->consignee_olshop_orderid;
             print $url;
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}");
             curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
             //$result = curl_exec($ch);
             if (!($result = curl_exec($ch))) {
                 die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
             }
             $status_code = curl_getinfo($ch);
             //get status code
             //$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);   //get status code
             curl_close($ch);
             //print $result;
             $res = json_decode($result, true);
             $reslog = $res;
             $reslog['timestamp'] = new MongoDate();
             $reslog['consignee_logistic_id'] = $logistic->logistic_code;
             $reslog['consignee_olshop_cust'] = $logistic_id;
             Threeplstatuslog::insert($reslog);
             print_r($res);
             if (isset($res['cn_no'])) {
                 $pre = clone $ord;
                 $ls = $res['laststatus'];
                 if ($ls['status'] == $delivery_trigger) {
                     $ord->status = Config::get('jayon.trans_status_mobile_delivered');
                     $ord->position = 'CUSTOMER';
                 }
                 if ($ls['status'] == $returned_trigger) {
                     $ord->status = Config::get('jayon.trans_status_mobile_return');
                 }
                 //$ord->district = $ls->district;
                 $ord->logistic_status = $ls['status'];
                 $ord->logistic_status_ts = $ls['time'];
                 $ord->logistic_raw_status = $ls;
                 $ord->save();
                 $ts = new MongoDate();
                 $hdata = array();
                 $hdata['historyTimestamp'] = $ts;
                 $hdata['historyAction'] = 'api_shipment_change_status';
                 $hdata['historySequence'] = 1;
                 $hdata['historyObjectType'] = 'shipment';
                 $hdata['historyObject'] = $ord->toArray();
                 $hdata['actor'] = $this->name;
                 $hdata['actor_id'] = '';
                 //History::insert($hdata);
                 $sdata = array();
                 $sdata['timestamp'] = $ts;
                 $sdata['action'] = 'api_shipment_change_status';
                 $sdata['reason'] = 'api_update';
                 $sdata['objectType'] = 'shipment';
                 $sdata['object'] = $ord->toArray();
                 $sdata['preObject'] = $pre->toArray();
                 $sdata['actor'] = $this->name;
                 $sdata['actor_id'] = '';
                 Shipmentlog::insert($sdata);
                 $this->saveStatus($res, $logistic->logistic_code, $logistic_id);
             }
//.........这里部分代码省略.........
开发者ID:awidarto,项目名称:bilnatracker,代码行数:101,代码来源:SapStatusDaemon.php

示例4: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $logistic_id = '3758';
     $delivery_trigger = $this->kjktstatus['DELIVERED'];
     $returned_trigger = $this->kjktstatus['RETURNED'];
     $undelivered_trigger = $this->kjktstatus['UNDELIVERED'];
     $logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
     if (Prefs::isRunning($this->name)) {
         $l = array();
         $l['ts'] = new MongoDate();
         $l['error'] = 'process already running';
         $l['consignee_logistic_id'] = $logistic->logistic_code;
         $l['consignee_olshop_cust'] = $logistic_id;
         Threeplstatuserror::insert($l);
         die('process already running');
     }
     if ($logistic) {
     } else {
         die('logistic data not found');
     }
     $orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where(function ($sq) {
         $sq->where('status', '!=', 'delivered')->where('status', '!=', 'canceled')->where('status', '!=', 'undelivered')->where('status', '!=', 'returned');
     })->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->get();
     if ($orders && count($orders->toArray()) > 0) {
         $req = array();
         foreach ($orders as $ord) {
             $result = $this->sendRequest($ord->awb, $logistic);
             $res = json_decode($result, true);
             $reslog = $res;
             $reslog['timestamp'] = new MongoDate();
             $reslog['consignee_logistic_id'] = $logistic->logistic_code;
             $reslog['consignee_olshop_cust'] = $logistic_id;
             Threeplstatuslog::insert($reslog);
             print_r($res);
             if (isset($res['result_code']) && $res['result_code'] == 1) {
                 $ord = Shipment::where('awb', '=', $res['data']['order_no'])->orderBy('created_at', 'desc')->first();
                 if ($ord) {
                     $pre = clone $ord;
                     $laststat = $res['data'];
                     $lst = intval(trim($laststat['status_code']));
                     if (in_array($lst, $delivery_trigger)) {
                         $ord->status = \Config::get('jayon.trans_status_mobile_delivered');
                         $ord->position = 'CUSTOMER';
                     }
                     if (in_array($lst, $returned_trigger)) {
                         $ord->status = \Config::get('jayon.trans_status_mobile_return');
                     }
                     /*
                     if( in_array( $lst , $undelivered_trigger) ){
                         $ord->status = \Config::get('jayon.trans_status_undelivered');
                     }
                     */
                     //$ord->district = $ls->district;
                     $ord->logistic_status = $laststat['status_description'];
                     $ord->logistic_status_ts = date('Y-m-d H:i:s', time());
                     $ord->logistic_raw_status = $laststat;
                     $ord->save();
                     $ts = new MongoDate();
                     $hdata = array();
                     $hdata['historyTimestamp'] = $ts;
                     $hdata['historyAction'] = 'api_shipment_change_status';
                     $hdata['historySequence'] = 1;
                     $hdata['historyObjectType'] = 'shipment';
                     $hdata['historyObject'] = $ord->toArray();
                     $hdata['actor'] = $this->name;
                     $hdata['actor_id'] = '';
                     //History::insert($hdata);
                     $sdata = array();
                     $sdata['timestamp'] = $ts;
                     $sdata['action'] = 'api_shipment_change_status';
                     $sdata['reason'] = 'api_update';
                     $sdata['objectType'] = 'shipment';
                     $sdata['object'] = $ord->toArray();
                     $sdata['preObject'] = $pre->toArray();
                     $sdata['actor'] = $this->name;
                     $sdata['actor_id'] = '';
                     Shipmentlog::insert($sdata);
                     $this->saveStatus($res, $logistic->logistic_code, $logistic_id);
                 }
             }
             Logger::api($this->name, $ord->awb, $res);
         }
     } else {
         print 'Empty order list' . "\r\n";
     }
     $actor = $this->name;
     Event::fire('log.api', array('KurirJKTStatusDaemon', 'get', $actor, 'KurirJKT STATUS PULL'));
     /*
     Array
     (
         [result_code] => 1
         [result_description] => success
         [data] => Array
             (
                 [order_no] => 2240
//.........这里部分代码省略.........
开发者ID:awidarto,项目名称:bilnatracker,代码行数:101,代码来源:KurirJKTStatus.php


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