【发布时间】:2019-11-20 11:47:51
【问题描述】:
public function download****()
{
// Downloads new externals (if updateable)
$site_id = 1;
$sinceLastId = $this->lastExternalSiteOrderId($site_id);
$api_version = config('services.*****.api_version');
$path = '/admin/api/' . $api_version . '/orders.json';
// GET request - Shopify.php (orders.json)
$result = $this->basicShopifyApi*****()->rest('GET', $path, ['since_id' => $sinceLastId]);
$orders = $result->body->orders;
if (!isset($orders)) {
return Response::json(['message' => 'No new ***** orders to download!'], 204);
} else {
foreach ($orders as $order) {
// Save to External Log
ExternalLog::create([
'data' => $order,
]);
// Gets updatable status
$updatable = $this->updateable($order->id);
// Saves new externals (create), if updateable
if ($updatable) {
$this->updateOrCreateExternals($order, $site_id);
}
}
}
}
// Updates a external role
public function updateOrCreateExternals($request, $site_id) {
// Saves external updates
$external = External::updateOrCreate(
[
'site_order_id' => ['order_id' => $request->id],
'site_id' => $site_id],
[
// 'order_id' => 0, // not required
'site_order_id' => $request->id,
'site_id' => $site_id, // Shopify is 1 (within ShopifyController this is correct)
'site_sub_id' => 0,
'site_account_id' => 0,
'data' => $request,
'site_order_status' => 0,
'order_created_at' => date("Y-m-d H:i:s", strtotime($request->created_at)),
'order_updated_at' => date("Y-m-d H:i:s", strtotime($request->updated_at)),
]);
echo "ShopifyExternalController@updateOrCreate function called!";
// Creates Customers, Orders, Carts, Payments for external, then set Site_Order_Status to 10
$shopifyOrderController = new shopifyOrderController();
$shopifyOrderController->updateOrCreateOrders($site_id);
}
此代码在本地工作,但在开发(暂存)服务器上它只保存第一项?
任何想法,为什么它不能在服务器上工作?
它是共享主机,cent os,PHP 7.2,不是用 Laravel Forge 或 vapor 设置的。
关于编写 YAML 脚本以正确部署站点的任何提示?
我尝试过“composer dump-autoload”,因为我最近将一些控制器名称从小写更改为大写。
【问题讨论】: