关联删除
This commit is contained in:
parent
f6f2fa39f9
commit
cbe9f1ab50
@ -3,7 +3,6 @@
|
|||||||
namespace App\Imports;
|
namespace App\Imports;
|
||||||
|
|
||||||
use App\Events\BatchStockUpdateEvent;
|
use App\Events\BatchStockUpdateEvent;
|
||||||
use App\Jobs\SyncCostToMiaoXuan;
|
|
||||||
use App\Models\DailyStockRecord;
|
use App\Models\DailyStockRecord;
|
||||||
use App\Models\GoodsSku;
|
use App\Models\GoodsSku;
|
||||||
use App\Models\TodayPrice;
|
use App\Models\TodayPrice;
|
||||||
@ -55,7 +54,6 @@ class InventoryImport implements ToArray, SkipsEmptyRows
|
|||||||
'cost' => $row[4],
|
'cost' => $row[4],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
SyncCostToMiaoXuan::dispatch($row[0], $row[4]);
|
|
||||||
$updateIds[] = $goodsSku['id'];
|
$updateIds[] = $goodsSku['id'];
|
||||||
DailyStockRecord::query()->where('sku_id', $goodsSku['id'])->where('day', $day)->update([
|
DailyStockRecord::query()->where('sku_id', $goodsSku['id'])->where('day', $day)->update([
|
||||||
'arrived_today_num' => $row[3],
|
'arrived_today_num' => $row[3],
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
namespace App\Imports;
|
namespace App\Imports;
|
||||||
|
|
||||||
use App\Events\BatchStockUpdateEvent;
|
use App\Events\BatchStockUpdateEvent;
|
||||||
use App\Jobs\SyncCostToMiaoXuan;
|
|
||||||
use App\Models\DailyStockRecord;
|
use App\Models\DailyStockRecord;
|
||||||
use App\Models\GoodsSku;
|
use App\Models\GoodsSku;
|
||||||
use App\Utils\DateTimeUtils;
|
use App\Utils\DateTimeUtils;
|
||||||
@ -50,7 +49,6 @@ class NewSetImport implements ToArray, SkipsEmptyRows
|
|||||||
'stock' => $row[2] + $goodsSku['stock'],
|
'stock' => $row[2] + $goodsSku['stock'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
SyncCostToMiaoXuan::dispatch($row[0], $row[3]);
|
|
||||||
$updateIds[] = $goodsSku['id'];
|
$updateIds[] = $goodsSku['id'];
|
||||||
// 今日到货
|
// 今日到货
|
||||||
$record = DailyStockRecord::query()
|
$record = DailyStockRecord::query()
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Jobs;
|
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
|
|
||||||
class SyncCostToMiaoXuan implements ShouldQueue
|
|
||||||
{
|
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
||||||
|
|
||||||
public $externalSkuId;
|
|
||||||
public $cost;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new job instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct($externalSkuId, $cost)
|
|
||||||
{
|
|
||||||
$this->externalSkuId = $externalSkuId;
|
|
||||||
$this->cost = $cost;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the job.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws GuzzleException
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
$url = 'http://shop.chutang66.com/miaoxuan/cost';
|
|
||||||
$method = 'PUT';
|
|
||||||
$headers = [
|
|
||||||
'headers' => ['Content-type' => 'application/x-www-form-urlencoded;charset=UTF-8'],
|
|
||||||
'form_params' => [
|
|
||||||
'external_sku_id' => $this->externalSkuId,
|
|
||||||
'cost' => $this->cost,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
(new Client())->request($method, $url, $headers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -24,9 +24,6 @@ class MiaoXuan extends BusinessClient
|
|||||||
|
|
||||||
public function incrQuantity($businessGoodsSku, $num, $incremental)
|
public function incrQuantity($businessGoodsSku, $num, $incremental)
|
||||||
{
|
{
|
||||||
$appendParams = Goods::incrQuantity($this->shop->id, $num, $businessGoodsSku);
|
|
||||||
$url = 'http://shop.chutang66.com/miaoxuan/stock';
|
|
||||||
$this->formDataPostRequest($url, $appendParams);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadOrdersAndSave($beginTime, $endTime, $downloadType = 'default', $page = 1)
|
public function downloadOrdersAndSave($beginTime, $endTime, $downloadType = 'default', $page = 1)
|
||||||
@ -35,12 +32,6 @@ class MiaoXuan extends BusinessClient
|
|||||||
|
|
||||||
public function batchIncrQuantity($businessGoodsSkus, $num, $incremental)
|
public function batchIncrQuantity($businessGoodsSkus, $num, $incremental)
|
||||||
{
|
{
|
||||||
$batchAppendParams = [];
|
|
||||||
foreach ($businessGoodsSkus as $businessGoodsSku) {
|
|
||||||
$appendParams = Goods::incrQuantity($this->shop->id, $num, $businessGoodsSku);
|
|
||||||
$batchAppendParams[] = $appendParams;
|
|
||||||
}
|
|
||||||
$this->batchAsyncPostRequest('http://shop.chutang66.com/miaoxuan/stock', $batchAppendParams);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadGoods($skuId)
|
public function downloadGoods($skuId)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user