!270 问题处理

Merge pull request !270 from 杨建炊/fix-release-1.0.0/yjc-migrate
This commit is contained in:
杨建炊 2024-12-12 08:11:15 +00:00 committed by Gitee
commit acd48764fa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 20 additions and 5 deletions

View File

@ -49,11 +49,12 @@ class CheckSkuQualityPeriod extends Command
//查询未处理过的快过期的异常订单 //查询未处理过的快过期的异常订单
$purchaseRecords = DB::table('purchase_records as a') $purchaseRecords = DB::table('purchase_records as a')
->select("a.created_at", "a.num", "b.title", "b.stock", "a.id", "b.id as sku_id", "b.external_sku_id") ->select("a.created_at","a.date", "a.num", "b.title", "b.stock", "a.id", "b.id as sku_id", "b.external_sku_id")
->leftJoin('goods_skus as b', 'a.sku_id', '=', 'b.id') ->leftJoin('goods_skus as b', 'a.external_sku_id', '=', 'b.external_sku_id')
->where("a.check_status", "=", 0) ->where("a.check_status", "=", 0)
->whereBetween('a.expire_time', [$startTime, $endTime])->get(); ->whereBetween('a.expire_time', [$startTime, $endTime])->get();
Log::info('purchaseRecords', (array)$purchaseRecords); Log::info('采购临期记录', [$purchaseRecords]);
if ($purchaseRecords->isNotEmpty()) { if ($purchaseRecords->isNotEmpty()) {
$messageService = new MessageService(); $messageService = new MessageService();
$updateIds = []; $updateIds = [];
@ -67,7 +68,6 @@ class CheckSkuQualityPeriod extends Command
} }
$updateIds[] = $v->id; $updateIds[] = $v->id;
//更新下状态 //更新下状态
} }
PurchaseRecords::query()->whereIn('id', $updateIds)->update([ PurchaseRecords::query()->whereIn('id', $updateIds)->update([
"check_status" => 1 "check_status" => 1

View File

@ -47,7 +47,9 @@ class BusinessOrderUpdateListener implements ShouldQueue
if (!empty($event->goodsSku)) { if (!empty($event->goodsSku)) {
//查询库存是否满足告警规则 //查询库存是否满足告警规则
//查找昨日统计的库存数据 //查找昨日统计的库存数据
$inventory = $event->goodsSku['yesterday_num'] ?? 0; $record = DailyStockRecord::query()->where('sku_id', $event->goodsSku->id)->where("inventory", '>', 0)->orderByDesc('day')->first();
Log::info("库存告警record", [$record]);
$inventory = $record->inventory ?? 0;
$expireTime = Carbon::now()->addMinutes(30)->toDateTimeString(); $expireTime = Carbon::now()->addMinutes(30)->toDateTimeString();
$proportion = Cache::remember(CacheKeyEnum::STOCK_RULE_PROPORTION, $expireTime, function () { $proportion = Cache::remember(CacheKeyEnum::STOCK_RULE_PROPORTION, $expireTime, function () {
$developerConfig = DeveloperConfig::query()->where("key", "=", DevConfigKeyEnum::STOCK_RULE_PROPORTION)->first(); $developerConfig = DeveloperConfig::query()->where("key", "=", DevConfigKeyEnum::STOCK_RULE_PROPORTION)->first();

View File

@ -4,7 +4,9 @@ namespace App\Services\Business\KuaiTuanTuan;
use App\Events\BusinessOrdersUpdate; use App\Events\BusinessOrdersUpdate;
use App\Models\BusinessGoodsSku; use App\Models\BusinessGoodsSku;
use App\Models\GoodsSku;
use App\Services\Business\BusinessFactory; use App\Services\Business\BusinessFactory;
use Illuminate\Support\Facades\Log;
class Goods class Goods
{ {
@ -43,6 +45,16 @@ class Goods
); );
if (empty($businessGoodSku->id)) { if (empty($businessGoodSku->id)) {
$businessGoodSku->save(); $businessGoodSku->save();
if (!empty($businessGoodSku->external_sku_id)) {
$shop = $businessGoodSku->shop;
$sku = GoodsSku::query()
->where('external_sku_id', $businessGoodSku->external_sku_id)
->first();
Log::info("商品下载新增sku",[$businessGoodSku]);
if(!empty($sku)){
BusinessFactory::init()->make($shop['plat_id'])->setShopWithId($shop['id'])->incrQuantity($businessGoodSku, $sku->sale_stock, false);
}
}
} else { } else {
$businessGoodSku->update($data); $businessGoodSku->update($data);
} }

1
public/nginx.htaccess Normal file
View File

@ -0,0 +1 @@
try_files $uri $uri/ /index.php?$query_string;