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) {
|
||||
$items = Good::query()->whereIn('itemid', $itemIds)->with('good_item')->get();
|
||||
$items = Good::query()->whereIn('itemid', $itemIds)->with('item')->get();
|
||||
$notices = [];
|
||||
foreach ($items as $item) {
|
||||
$item->fill($goods[$item->itemId]);
|
||||
$item->fill($goods[$item->itemid]);
|
||||
if ($item->isDirty()) {
|
||||
$item->save();
|
||||
}
|
||||
$item->good_item->fill($goods[$item->itemId]);
|
||||
if ($item->good_item->isDirty()) {
|
||||
$item->good_item->save();
|
||||
$item->item->fill($goods[$item->itemid]);
|
||||
if ($item->item->isDirty()) {
|
||||
$item->item->save();
|
||||
}
|
||||
$notices[] = $noticeIdMapItemId[$item->itemId];
|
||||
$notices[] = $noticeIdMapItemId[$item->itemid];
|
||||
}
|
||||
\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'
|
||||
];
|
||||
|
||||
public function goodItem(): HasOne
|
||||
public function item(): HasOne
|
||||
{
|
||||
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_type')->comment('通知type');
|
||||
$table->text('raw_content')->comment('原始消息内容');
|
||||
$table->tinyInteger('state')->default(1)->comment('消息状态,1待消费,2消费进行中,3处理完成');
|
||||
$table->tinyInteger('state')->default(1)->comment('消息状态,1待消费,3处理完成');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user