Commit 6d43a93e authored by 王源's avatar 王源 🎧

Merge branch 'pull_fulfillmentOrders'

parents 4abe8c0f 54f5d43f
......@@ -26,33 +26,25 @@ class ExceptionLogProducer extends ProducerMessage
// 获取trace中真实文件和行数
if (!empty($data['trace'])) {
preg_match('/(\/var\/www\/html\/.+?\/app\/.+?\.php)(?=\()/', $data['trace'], $matchFiles);
put_log('$matchFiles: ' . json_encode($matchFiles), 'ExceptionLogProducerPreg.log');
if (!empty($matchFiles[0])) {
$data['file'] = $matchFiles[0];
$file = str_replace('/', '\/', $matchFiles[0]);
$file = str_replace('.', '\.', $file);
$pattern = '/(?<=' . $file . '\()[0-9]+(?=\))/';
put_log('$pattern: ' . $pattern, 'ExceptionLogProducerPreg.log');
preg_match($pattern, $data['trace'], $matchLines);
put_log('$matchLines: ' . json_encode($matchLines), 'ExceptionLogProducerPreg.log');
if (!empty($matchLines[0])) {
$data['line'] = $matchLines[0];
}
}
}
put_log("file: {$data['file']}", 'ExceptionLogProducerEcho.log');
if (!empty($data['file'])) {
// 只对项目app文件夹下的错误获取编码人
preg_match('/(\/var\/www\/html\/.+?\/app\/)/', $data['file'], $matchPaths);
put_log('$matchPaths: ' . json_encode($matchPaths), 'ExceptionLogProducerPreg.log');
if (!empty($matchPaths[0])) {
try {
put_log("cd {$matchPaths[0]} && git blame -L {$data['line']},{$data['line']} {$data['file']}", 'ExceptionLogProducerEcho.log');
exec("cd {$matchPaths[0]} && git blame -L {$data['line']},{$data['line']} {$data['file']}", $output);
put_log("output: " . json_encode($output), 'ExceptionLogProducerEcho.log');
if (!empty($output[0]) && is_string($output[0])) {
preg_match('/(?<=\()[^ ]+/', $output[0], $matchCoders);
put_log('$matchCoders: ' . json_encode($matchCoders), 'ExceptionLogProducerPreg.log');
if (!empty($matchCoders[0])) {
$data['coder'] = $matchCoders[0];
}
......@@ -62,8 +54,6 @@ class ExceptionLogProducer extends ProducerMessage
}
}
}
put_log('----------', 'ExceptionLogProducerPreg.log');
put_log('----------', 'ExceptionLogProducerEcho.log');
$this->payload = $data;
}
......
......@@ -86,4 +86,13 @@ interface ShopifyServiceInterface
*/
public function updateFulfillmentTracking($fulfillmentId, $params, $shopifySiteId);
/**
* 通过id数组获取shopify的location数据
* @param $ids
* @param string[] $columns
* @return array 默认keyBy('id')
* @author zero
*/
public function getLocationsByIds($ids, $columns = ['*']);
}
......@@ -15,6 +15,7 @@ use Meibuyu\Micro\Shopify\lib\Collection;
use Meibuyu\Micro\Shopify\lib\CustomCollection;
use Meibuyu\Micro\Shopify\lib\Event;
use Meibuyu\Micro\Shopify\lib\Fulfillment;
use Meibuyu\Micro\Shopify\lib\FulfillmentOrder;
use Meibuyu\Micro\Shopify\lib\FulfillmentService;
use Meibuyu\Micro\Shopify\lib\Graphql;
use Meibuyu\Micro\Shopify\lib\InventoryItem;
......@@ -61,6 +62,7 @@ use Meibuyu\Micro\Shopify\lib\Webhook;
* @method Order Order(integer $id = null)
* @method Event Event(integer $id = null)
* @method Fulfillment Fulfillment(integer $id = null)
* @method FulfillmentOrder FulfillmentOrder()
* @method FulfillmentService FulfillmentService(integer $id = null)
* @method GraphQL GraphQL()
*
......@@ -83,6 +85,7 @@ class ShopifyApp
'Order',
'Event',
'Fulfillment',
'FulfillmentOrder',
'FulfillmentService',
'GraphQL',
];
......@@ -90,6 +93,7 @@ class ShopifyApp
protected $childResources = array(
'Fulfillment' => 'Order',
'FulfillmentEvent' => 'Fulfillment',
'FulfillmentOrder' => 'Order',
'OrderRisk' => 'Order',
'ProductImage' => 'Product',
'ProductVariant' => 'Product',
......
<?php
namespace Meibuyu\Micro\Shopify\lib;
/**
* Class FulfillmentOrder
* @package Meibuyu\Micro\Shopify\lib
*
* @property-read Event $Event
*
* @method array cancel() Cancel a fulfillment order
* @method array close() Marks a fulfillment order as incomplete
* @method array move() Moves a fulfillment order to a new location
*/
class FulfillmentOrder extends AbstractShopify
{
protected $resourceKey = 'fulfillment_order';
protected $customPostActions = [
'cancel',
'close',
'move',
];
}
......@@ -11,6 +11,6 @@ namespace Meibuyu\Micro\Shopify\lib;
class InventoryItem extends AbstractShopify
{
protected $resourceKey = 'inventory_item';
protected $resourceKey = 'inventory_item_123';
}
......@@ -19,7 +19,7 @@ namespace Meibuyu\Micro\Shopify\lib;
class InventoryLevel extends AbstractShopify
{
protected $resourceKey = 'inventory_level';
protected $resourceKey = 'inventory_level_123';
protected $customPostActions = [
'adjust',
......
......@@ -16,6 +16,7 @@ namespace Meibuyu\Micro\Shopify\lib;
* @property-read Event $Event
*
* @method Fulfillment Fulfillment(integer $id = null)
* @method FulfillmentOrder FulfillmentOrder()
* @method Event Event(integer $id = null)
*
* @method array close() Close an Order
......@@ -29,6 +30,7 @@ class Order extends AbstractShopify
protected $childResource = [
'Fulfillment',
'FulfillmentOrder',
'Event',
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment