mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
123 lines
3.9 KiB
PHP
123 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Events\StockUpdateEvent;
|
|
use App\Exports\DiffTodayPriceGoodsExport;
|
|
use App\Models\BusinessGoodsSku;
|
|
use App\Models\BusinessOrder;
|
|
use App\Models\GoodsSku;
|
|
use App\Models\GoodsType;
|
|
use App\Models\Log;
|
|
use App\Models\Shop;
|
|
use App\Models\ShopSender;
|
|
use App\Models\ShopShip;
|
|
use App\Models\TodayPrice;
|
|
use App\Services\Business\BusinessFactory;
|
|
use App\Services\Business\KuaiTuanTuan\FaceSheet;
|
|
use App\Utils\DateTimeUtils;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\DB;
|
|
use App\Jobs\BusinessGoodsSkuIncrQuantity;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
|
|
class Test extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'test';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = '测试';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function old()
|
|
{
|
|
$resp = [
|
|
'pdd_waybill_search_response' => [
|
|
'waybill_apply_subscription_cols' => [
|
|
[
|
|
'wp_type' => 3,
|
|
'branch_account_cols' => [
|
|
[
|
|
'quantity' => 0,
|
|
'shipp_address_cols' => [
|
|
[
|
|
'country' => '中国',
|
|
'province' => '云南省',
|
|
'city' => '昆明市',
|
|
'district' => '官渡区',
|
|
'detail' => '肖家营花卉市场1期-2',
|
|
],
|
|
[
|
|
'country' => '中国',
|
|
'province' => '云南省',
|
|
'city' => '昆明市',
|
|
'district' => '官渡区',
|
|
'detail' => '肖家营花卉市场1期-3',
|
|
],
|
|
[
|
|
'country' => '中国',
|
|
'province' => '云南省',
|
|
'city' => '昆明市',
|
|
'district' => '官渡区',
|
|
'detail' => '肖家营花卉市场1期',
|
|
],
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
$shopId = 6;
|
|
$shopShip = ShopShip::query()
|
|
->where('shop_id', $shopId)
|
|
->first();
|
|
if (empty($shopShip)) {
|
|
exit(1);
|
|
}
|
|
if (!isset($resp['pdd_waybill_search_response']['waybill_apply_subscription_cols'])) {
|
|
exit(2);
|
|
}
|
|
foreach ($resp['pdd_waybill_search_response']['waybill_apply_subscription_cols'] as $subCols) {
|
|
foreach ($subCols['branch_account_cols'] as $accountCols) {
|
|
foreach ($accountCols['shipp_address_cols'] as $item) {
|
|
$item['wp_code'] = $subCols['wp_code'];
|
|
ShopSender::query()->updateOrCreate(
|
|
['shop_id' => $shopId, 'shop_ship_id' => $shopShip->id, 'detail' => $item['detail']],
|
|
$item
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|