fix bug
This commit is contained in:
parent
e206e87197
commit
6dddb19629
|
@ -162,21 +162,21 @@ public function updateGoods(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::transaction(function () use ($goods, $itemIds, $noticeIdMapItemId) {
|
DB::transaction(function () use ($goods, $itemIds, $noticeIdMapItemId) {
|
||||||
$items = Good::query()->whereIn('itemid', $itemIds)->with('good_item')->get();
|
$items = Good::query()->whereIn('itemid', $itemIds)->with('item')->get();
|
||||||
$notices = [];
|
$notices = [];
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$item->fill($goods[$item->itemId]);
|
$item->fill($goods[$item->itemid]);
|
||||||
if ($item->isDirty()) {
|
if ($item->isDirty()) {
|
||||||
$item->save();
|
$item->save();
|
||||||
}
|
}
|
||||||
$item->good_item->fill($goods[$item->itemId]);
|
$item->item->fill($goods[$item->itemid]);
|
||||||
if ($item->good_item->isDirty()) {
|
if ($item->item->isDirty()) {
|
||||||
$item->good_item->save();
|
$item->item->save();
|
||||||
}
|
}
|
||||||
$notices[] = $noticeIdMapItemId[$item->itemId];
|
$notices[] = $noticeIdMapItemId[$item->itemid];
|
||||||
}
|
}
|
||||||
\App\Models\Notice::query()->whereIn('notice_id', $notices)
|
\App\Models\Notice::query()->whereIn('notice_id', $notices)
|
||||||
->update(['state', 3]);
|
->update(['state' => 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Good extends Base
|
||||||
'market_price','settlement','category_id', 'category_name'
|
'market_price','settlement','category_id', 'category_name'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function goodItem(): HasOne
|
public function item(): HasOne
|
||||||
{
|
{
|
||||||
return $this->hasOne(GoodsItem::class, 'item_id', 'itemid');
|
return $this->hasOne(GoodsItem::class, 'item_id', 'itemid');
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public function up()
|
||||||
$table->integer('notice_id')->unique()->comment('通知id');
|
$table->integer('notice_id')->unique()->comment('通知id');
|
||||||
$table->integer('notice_type')->comment('通知type');
|
$table->integer('notice_type')->comment('通知type');
|
||||||
$table->text('raw_content')->comment('原始消息内容');
|
$table->text('raw_content')->comment('原始消息内容');
|
||||||
$table->tinyInteger('state')->default(1)->comment('消息状态,1待消费,2消费进行中,3处理完成');
|
$table->tinyInteger('state')->default(1)->comment('消息状态,1待消费,3处理完成');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user