本文整理汇总了PHP中Shipment::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Shipment::whereIn方法的具体用法?PHP Shipment::whereIn怎么用?PHP Shipment::whereIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shipment
的用法示例。
在下文中一共展示了Shipment::whereIn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postStatus
public function postStatus()
{
$delivery_trigger = 'DELIVERED';
$returned_trigger = $this->fl_status['RETURN'];
$undelivered_trigger = $this->fl_status['NOT DELIVERED'];
$key = \Input::get('key');
//$user = \Apiauth::user($key);
if (is_null($key) || $key == '') {
$actor = 'no id : no name';
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty key'));
return \Response::json(array('status' => 'ERR:EMPTYKEY', 'timestamp' => time(), 'message' => 'Empty Key'));
}
$logistic = \Logistic::where('api_key', '=', $key)->first();
$json = \Input::json();
$reslog = \Input::all();
$slog = $json;
$reslog['timestamp'] = new \MongoDate();
$reslog['consignee_logistic_id'] = $logistic->logistic_code;
$reslog['consignee_olshop_cust'] = $logistic->consignee_olshop_cust;
\Threeplstatuslog::insert($reslog);
$this->saveStatus($slog, $logistic->consignee_olshop_cust, $logistic->logistic_code);
$batch = \Input::get('batch');
$awbarray = array();
$awbs = array();
$statusarray = array();
$inawbstatus = array();
foreach ($json as $j) {
$tawb = trim($j['awb']);
$awbarray[] = $tawb;
$awbs[$tawb] = $j;
$inawbstatus[$tawb] = 'NOT FOUND';
}
/*
$reslog = $json;
$reslog['consignee_logistic_id'] = $logistic->logistic_code;
$reslog['consignee_olshop_cust'] = $logistic->consignee_olshop_cust;
\Threeplstatuslog::insert($reslog);
*/
$result = array();
$orderlist = \Shipment::whereIn('awb', $awbarray)->get();
if ($orderlist) {
foreach ($orderlist as $order) {
$pre = clone $order;
$lst = trim($awbs[$order->awb]['last_status']);
if ($lst == $delivery_trigger) {
$order->status = \Config::get('jayon.trans_status_mobile_delivered');
$order->position = 'CUSTOMER';
}
if (in_array($lst, $returned_trigger) || $lst == 'RETURN') {
$order->status = \Config::get('jayon.trans_status_mobile_return');
}
if (in_array($lst, $undelivered_trigger) || $lst == 'NOT DELIVERED') {
$order->status = \Config::get('jayon.trans_status_mobile_return');
}
$lts = isset($awbs[$order->awb]['timestamp']) && $awbs[$order->awb]['timestamp'] != '' ? $awbs[$order->awb]['timestamp'] : $awbs[$order->awb]['delivered_date'] . ' ' . $awbs[$order->awb]['delivered_time'];
$order->logistic_status = $awbs[$order->awb]['last_status'];
$order->logistic_status_ts = $lts;
$order->logistic_raw_status = $awbs[$order->awb];
$saved = $order->save();
if ($saved) {
$inawbstatus[$order->awb] = 'STATUS UPDATED';
}
$ts = new \MongoDate();
$sdata = array();
$sdata['timestamp'] = $ts;
$sdata['action'] = 'api_shipment_change_status';
$sdata['reason'] = 'api_update';
$sdata['objectType'] = 'shipment';
$sdata['object'] = $order->toArray();
$sdata['preObject'] = $pre->toArray();
$sdata['actor'] = $this->name;
$sdata['actor_id'] = '';
\Shipmentlog::insert($sdata);
}
$actor = 'FL : STATUS PUSH';
foreach ($inawbstatus as $k => $v) {
$statusarray[] = array('AWB' => $k, 'status' => $v);
}
if (count($statusarray) > 0) {
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'FL status update'));
return \Response::json(array('status' => 'OK', 'timestamp' => time(), 'message' => 'FL Status Update', 'statusarray' => $statusarray));
} else {
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty order list'));
return \Response::json(array('status' => 'ERR:EMPTYORDER', 'timestamp' => time(), 'message' => 'Empty Order List'));
}
} else {
$actor = 'FL : STATUS PUSH';
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty order list'));
return \Response::json(array('status' => 'ERR:EMPTYORDER', 'timestamp' => time(), 'message' => 'Empty Order List'));
}
}
示例2: postStatus
public function postStatus()
{
/*
"awb":"awb1",
"order_id":"no order",
"last_status":"kode status kiriman FL ",
"cn_name":"penerima",
"delivered_date":"tanggal",
"delivered_time":"jam"
*/
$delivery_trigger = 'delivered';
$returned_trigger = 'returned';
$key = \Input::get('key');
//$user = \Apiauth::user($key);
if (is_null($key) || $key == '') {
$actor = 'no id : no name';
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty key'));
return \Response::json(array('status' => 'ERR:EMPTYKEY', 'timestamp' => time(), 'message' => 'Empty Key'));
}
$logistic = \Logistic::where('api_key', '=', $key)->first();
$json = \Input::json();
$batch = \Input::get('batch');
$awbarray = array();
$awbs = array();
$statusarray = array();
$inawbstatus = array();
foreach ($json as $j) {
$awbarray[] = $j['awb'];
$awbs[$j['awb']] = $j;
$inawbstatus[$j['awb']] = 'NOT FOUND';
}
$result = array();
$orderlist = \Shipment::whereIn('awb', $awbarray)->get();
if ($orderlist) {
foreach ($orderlist as $order) {
$pre = clone $order;
if ($awbs[$order->awb]['last_status'] == $delivery_trigger) {
$order->status = \Config::get('jayon.trans_status_mobile_delivered');
$order->position = 'CUSTOMER';
}
if ($awbs[$order->awb]['last_status'] == $returned_trigger) {
$order->status = \Config::get('jayon.trans_status_mobile_return');
}
$lts = isset($awbs[$order->awb]['timestamp']) && $awbs[$order->awb]['timestamp'] != '' ? $awbs[$order->awb]['timestamp'] : $awbs[$order->awb]['delivered_date'] . ' ' . $awbs[$order->awb]['delivered_time'];
$order->logistic_status = $awbs[$order->awb]['last_status'];
$order->logistic_status_ts = $lts;
$order->logistic_raw_status = $awbs[$order->awb];
$saved = $order->save();
if ($saved) {
$inawbstatus[$order->awb] = 'STATUS UPDATED';
}
$ts = new \MongoDate();
$hdata = array();
$hdata['historyTimestamp'] = $ts;
$hdata['historyAction'] = 'api_shipment_change_status';
$hdata['historySequence'] = 1;
$hdata['historyObjectType'] = 'shipment';
$hdata['historyObject'] = $order->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'] = $order->toArray();
$sdata['preObject'] = $pre->toArray();
$sdata['actor'] = $this->name;
$sdata['actor_id'] = '';
\Shipmentlog::insert($sdata);
}
$actor = 'FL : STATUS PUSH';
foreach ($inawbstatus as $k => $v) {
$statusarray[] = array('AWB' => $k, 'status' => $v);
}
if (count($statusarray) > 0) {
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'FL status update'));
return \Response::json(array('status' => 'OK', 'timestamp' => time(), 'message' => 'FL Status Update', 'statusarray' => $statusarray));
} else {
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty order list'));
return \Response::json(array('status' => 'ERR:EMPTYORDER', 'timestamp' => time(), 'message' => 'Empty Order List'));
}
} else {
$actor = 'FL : STATUS PUSH';
\Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty order list'));
return \Response::json(array('status' => 'ERR:EMPTYORDER', 'timestamp' => time(), 'message' => 'Empty Order List'));
}
}
示例3: getPrintlabel
public function getPrintlabel($sessionname, $printparam, $format = 'html')
{
$pr = explode(':', $printparam);
$columns = $pr[0];
$resolution = $pr[1];
$cell_width = $pr[2];
$cell_height = $pr[3];
$margin_right = $pr[4];
$margin_bottom = $pr[5];
$font_size = $pr[6];
$code_type = $pr[7];
$left_offset = $pr[8];
$top_offset = $pr[9];
$session = Printsession::find($sessionname)->toArray();
$labels = Shipment::whereIn('_id', $session)->get()->toArray();
$skus = array();
foreach ($labels as $l) {
$skus[] = $l['_id'];
}
$skus = array_unique($skus);
$products = Shipment::whereIn('_id', $skus)->get()->toArray();
$plist = array();
foreach ($products as $product) {
$plist[$product['_id']] = $product;
}
return View::make('asset.printlabel')->with('columns', $columns)->with('resolution', $resolution)->with('cell_width', $cell_width)->with('cell_height', $cell_height)->with('margin_right', $margin_right)->with('margin_bottom', $margin_bottom)->with('font_size', $font_size)->with('code_type', $code_type)->with('left_offset', $left_offset)->with('top_offset', $top_offset)->with('products', $plist)->with('labels', $labels);
}
示例4: sendData
public function sendData($req, $client, $logistic, $logistic_id)
{
$delivery_trigger = 'KIRIMAN DITERIMA OLEH';
$returned_trigger = 'KEMBALI KE KOTA ASAL';
$data_string = json_encode($req);
//print $data_string;
//$request->setHeader("Accept" , "application/json");
/*
$response = $client->request('POST', $base_url , array('json'=>$req,
'query'=>array('key'=> $logistic->api_key ),
'auth' => array($logistic->api_user, $logistic->api_pass, 'Basic'),
'headers' => array('Accept' => 'application/json') ) );
$awblist = json_decode($response->getBody());
*/
$base_url = 'http://j-express.id/serverapi.jet/api/tracking/tracking-list.php';
$postArr = array('awbs' => $data_string);
$url = "http://j-express.id/serverapi.jet/api/tracking/tracking-list.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postArr));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$result = curl_exec($ch);
/*
$ch = curl_init($base_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
print $result;
die();
*/
$awblist = json_decode($result);
$res[] = $awblist;
Logger::api($this->name, $data_string, $awblist);
$slog = json_decode($result, true);
$this->saveStatus($slog, $logistic->logistic_code, $logistic_id);
$awbs = array();
$ffs = array();
print_r($awblist);
$reslog = $res;
$reslog['timestamp'] = new MongoDate();
$reslog['consignee_logistic_id'] = $logistic->logistic_code;
$reslog['consignee_olshop_cust'] = $logistic_id;
Threeplstatuslog::insert($reslog);
try {
if (is_array($awblist)) {
foreach ($awblist as $awb) {
if (!is_null($awb->cn_no) && $awb->status != 'AWB TIDAK DITEMUKAN') {
$awbarray[] = trim($awb->cn_no);
$awbs[$awb->cn_no] = $awb;
}
}
if (count($awbs) > 0) {
//print_r($awbs);
$orderlist = Shipment::whereIn('awb', $awbarray)->get();
foreach ($orderlist as $order) {
$pre = clone $order;
if ($awbs[$order->awb]->status == $delivery_trigger) {
$order->status = Config::get('jayon.trans_status_mobile_delivered');
$order->position = 'CUSTOMER';
}
if ($awbs[$order->awb]->status == $returned_trigger) {
$order->status = Config::get('jayon.trans_status_mobile_return');
}
//$order->district = $awbs[$order->awb]->district;
$order->logistic_status = $awbs[$order->awb]->status;
$order->logistic_status_ts = $awbs[$order->awb]->time;
$order->logistic_raw_status = $awbs[$order->awb];
$order->save();
$ts = new MongoDate();
$hdata = array();
$hdata['historyTimestamp'] = $ts;
$hdata['historyAction'] = 'api_shipment_change_status';
$hdata['historySequence'] = 1;
$hdata['historyObjectType'] = 'shipment';
$hdata['historyObject'] = $order->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'] = $order->toArray();
$sdata['preObject'] = $pre->toArray();
$sdata['actor'] = $this->name;
$sdata['actor_id'] = '';
Shipmentlog::insert($sdata);
}
}
//.........这里部分代码省略.........
示例5: postCanceldata
public function postCanceldata()
{
$in = Input::get();
$results = Shipment::whereIn('delivery_id', $in['ids'])->get();
date_default_timezone_set('Asia/Jakarta');
//print_r($results->toArray());
//if($results){
$res = false;
//}else{
$ts = new MongoDate();
foreach ($results as $sh) {
$sh->status = Config::get('jayon.trans_status_canceled');
//$sh->last_action_ts = $ts;
//$sh->last_action = 'Cancel Data';
$sh->delivery_note = $in['reason'];
$sh->save();
//print_r($sh);
//print_r(Auth::user());
$hdata = array();
$hdata['historyTimestamp'] = $ts;
$hdata['historyAction'] = 'cancel_data';
$hdata['historySequence'] = 1;
$hdata['historyObjectType'] = 'shipment';
$hdata['historyObject'] = $sh->toArray();
$hdata['actor'] = Auth::user()->fullname;
$hdata['actor_id'] = isset(Auth::user()->_id) ? Auth::user()->_id : Auth::user()->id;
//print_r($hdata);
History::insert($hdata);
$sdata = array();
$sdata['timestamp'] = $ts;
$sdata['action'] = 'cancel_data';
$sdata['reason'] = $in['reason'];
$sdata['objectType'] = 'shipment';
$sdata['object'] = $sh->toArray();
$sdata['actor'] = Auth::user()->fullname;
$sdata['actor_id'] = isset(Auth::user()->_id) ? Auth::user()->_id : Auth::user()->id;
Shipmentlog::insert($sdata);
$res = true;
}
//}
if ($res) {
return Response::json(array('result' => 'OK'));
} else {
return Response::json(array('result' => 'ERR:CANCELFAILED'));
}
}
示例6: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
date_default_timezone_set('Asia/Jakarta');
$base_url = 'http://www.jayonexpress.com/jexadmin/api/v1/service/awb';
//$base_url = 'http://localhost/jexadmin/public/api/v1/service/awb';
$logistic_id = '7735';
$logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
$orders = Shipment::where('awb', '=', '')->where('logistic_type', '=', 'external')->where(function ($q) {
$q->where('status', '=', \Config::get('jayon.trans_status_admin_dated'))->orWhere('status', '=', \Config::get('jayon.trans_status_confirmed'));
})->where('consignee_olshop_cust', '=', $logistic_id)->where(function ($q) {
$q->where('consignee_olshop_service', '=', 'COD')->orWhere('consignee_olshop_service', '=', 'CCOD');
})->get();
if ($orders && count($orders->toArray()) > 0) {
$req = array();
/*
foreach($orders as $ord){
$req[] = array('order_id'=>$ord->no_sales_order, 'ff_id'=>$ord->consignee_olshop_orderid);
}
*/
$req = $orders->toArray();
$reslog = $req;
$reslog['timestamp'] = new \MongoDate();
$reslog['consignee_logistic_id'] = $logistic->logistic_code;
$reslog['consignee_olshop_cust'] = $logistic->consignee_olshop_cust;
Threepluploadlog::insert($reslog);
//print json_encode($req);
//die();
//$client = new GuzzleClient(['defaults'=>['exceptions'=>false]]);
try {
print_r($req);
//$response = $client->request('POST', $base_url , array('json'=>$req, 'query'=>array('key'=> $logistic->api_key ) ) );
$data_string = json_encode($req);
$url = $base_url . '?key=' . $logistic->api_key;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
$result = curl_exec($ch);
//$awblist = json_decode($response->getBody());
$awblist = json_decode($result);
print $result;
//die();
$awbs = array();
$ffs = array();
foreach ($awblist as $awb) {
$ffs[] = $awb->ff_id;
$awbs[$awb->ff_id] = $awb->awb;
}
$orderlist = Shipment::whereIn('fulfillment_code', $ffs)->get();
foreach ($orderlist as $order) {
$pre = clone $order;
$order->awb = $awbs[$order->fulfillment_code];
//$order->bucket = Config::get('jayon.bucket_tracker');
$order->position = '3PL';
$order->uploaded = 1;
$order->save();
$ts = new MongoDate();
$hdata = array();
$hdata['historyTimestamp'] = $ts;
$hdata['historyAction'] = 'api_shipment_change_awb';
$hdata['historySequence'] = 1;
$hdata['historyObjectType'] = 'shipment';
$hdata['historyObject'] = $order->toArray();
$hdata['actor'] = $this->name;
$hdata['actor_id'] = '';
//History::insert($hdata);
$sdata = array();
$sdata['timestamp'] = $ts;
$sdata['action'] = 'api_shipment_change_awb';
$sdata['reason'] = 'api_update';
$sdata['objectType'] = 'shipment';
$sdata['object'] = $order->toArray();
$sdata['preObject'] = $pre->toArray();
$sdata['actor'] = $this->name;
$sdata['actor_id'] = '';
print_r($sdata);
//try{
Shipmentlog::insert($sdata);
//}catch(Exception $e){
// print_r($e);
//}
}
} catch (Exception $e) {
print $e;
}
} else {
print 'Empty order list' . "\r\n";
}
$actor = $this->name;
Event::fire('log.api', array('JexAwbDaemon', 'get', $actor, 'JEX PUSH DATA AWB PULL'));
}
示例7: postMoveorder
public function postMoveorder()
{
$in = Input::get();
$results = Shipment::whereIn('_id', $in['ids'])->get();
//print_r($results->toArray());
//if($results){
$res = false;
//}else{
foreach ($results as $r) {
if ($r->logistic_type == 'external') {
if ($in['bucket'] == Config::get('jayon.bucket_tracker')) {
if (isset($r->awb) && $r->awb != '') {
$r->bucket = $in['bucket'];
$r->save();
}
}
} elseif ($r->logistic_type == 'internal') {
}
}
$res = true;
//}
if ($res) {
return Response::json(array('result' => 'OK:MOVED'));
} else {
return Response::json(array('result' => 'ERR:MOVEFAILED'));
}
}
示例8: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
//$base_url = 'http://localhost/jexadmin/public/api/v1/service/status';
$base_url = 'http://www.jayonexpress.com/jexadmin/api/v1/service/status';
$logistic_id = '7735';
$delivery_trigger = 'delivered';
$returned_trigger = 'returned';
$canceled_trigger = 'canceled';
$logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
$orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where('status', '!=', 'delivered')->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);
}
$req[] = array('awb' => '007735-16-122015-00155749');
$client = new GuzzleClient();
$response = $client->request('POST', $base_url, array('json' => $req, 'query' => array('key' => $logistic->api_key)));
//print( $response->getBody() );
$awblist = json_decode($response->getBody());
$reslog = $awblist;
$reslog['consignee_logistic_id'] = $logistic->logistic_code;
$reslog['consignee_olshop_cust'] = $logistic_id;
Threeplstatuslog::insert($reslog);
$this->saveStatus($awblist, $logistic->logistic_code, $logistic_id);
$awbs = array();
$ffs = array();
foreach ($awblist as $awb) {
$awbarray[] = trim($awb->awb);
$awbs[$awb->awb] = $awb;
}
print_r($awbs);
$orderlist = Shipment::whereIn('awb', $awbarray)->get();
foreach ($orderlist as $order) {
$pre = clone $order;
if ($awbs[$order->awb]->status == $delivery_trigger) {
$order->status = Config::get('jayon.trans_status_mobile_delivered');
$order->delivered_time = $awbs[$order->awb]->delivery_time;
$order->position = 'CUSTOMER';
}
if ($awbs[$order->awb]->status == $returned_trigger) {
$order->status = Config::get('jayon.trans_status_mobile_return');
}
if ($awbs[$order->awb]->status == $canceled_trigger) {
$order->status = Config::get('jayon.trans_status_canceled');
}
$order->district = $awbs[$order->awb]->district;
$order->logistic_status = $awbs[$order->awb]->status;
$order->logistic_status_ts = $awbs[$order->awb]->timestamp;
$order->logistic_raw_status = $awbs[$order->awb];
$order->logistic_delivered_time = $awbs[$order->awb]->delivery_time;
$order->logistic_pickup_time = $awbs[$order->awb]->pickup_time;
$order->logistic_last_note = $awbs[$order->awb]->note;
$order->save();
$ts = new MongoDate();
$hdata = array();
$hdata['historyTimestamp'] = $ts;
$hdata['historyAction'] = 'api_shipment_change_status';
$hdata['historySequence'] = 1;
$hdata['historyObjectType'] = 'shipment';
$hdata['historyObject'] = $order->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'] = $order->toArray();
$sdata['preObject'] = $pre->toArray();
$sdata['actor'] = $this->name;
$sdata['actor_id'] = '';
Shipmentlog::insert($sdata);
}
Logger::api($this->name, $req, $awblist);
} else {
print 'Empty order list' . "\r\n";
}
$actor = $this->name;
Event::fire('log.api', array('JexStatusDaemon', 'get', $actor, 'JEX STATUS PULL'));
}