fix kashkool
This commit is contained in:
@@ -360,11 +360,12 @@ class ProductController extends SuperController
|
||||
public function activationSnapshotStatus()
|
||||
{
|
||||
$row = Cnt::where('key', self::ACTIVATION_SNAPSHOT_KEY)->first();
|
||||
$items = $row?->value_json['items'] ?? [];
|
||||
$payload = $row?->jsonPayload() ?? [];
|
||||
$items = $payload['items'] ?? [];
|
||||
|
||||
return response()->json([
|
||||
'has_snapshot' => ! empty($items),
|
||||
'saved_at' => $row?->value_json['saved_at'] ?? null,
|
||||
'saved_at' => $payload['saved_at'] ?? null,
|
||||
'count' => count($items),
|
||||
]);
|
||||
}
|
||||
@@ -387,15 +388,13 @@ class ProductController extends SuperController
|
||||
'open_sell' => (bool) $product->open_sell,
|
||||
])->values()->all();
|
||||
|
||||
Cnt::updateOrCreate(
|
||||
['key' => self::ACTIVATION_SNAPSHOT_KEY],
|
||||
Cnt::saveJsonPayload(
|
||||
self::ACTIVATION_SNAPSHOT_KEY,
|
||||
[
|
||||
'title_fa' => 'ذخیره وضعیت محصولات',
|
||||
'value_json' => [
|
||||
'saved_at' => now()->timezone('Asia/Tehran')->format('Y-m-d H:i:s'),
|
||||
'items' => $items,
|
||||
],
|
||||
]
|
||||
'saved_at' => now()->timezone('Asia/Tehran')->format('Y-m-d H:i:s'),
|
||||
'items' => $items,
|
||||
],
|
||||
'ذخیره وضعیت محصولات'
|
||||
);
|
||||
|
||||
$affected = Product::query()->update([
|
||||
@@ -418,7 +417,7 @@ class ProductController extends SuperController
|
||||
public function restoreActivationSnapshot()
|
||||
{
|
||||
$row = Cnt::where('key', self::ACTIVATION_SNAPSHOT_KEY)->first();
|
||||
$items = $row?->value_json['items'] ?? [];
|
||||
$items = $row?->jsonPayload()['items'] ?? [];
|
||||
|
||||
if (empty($items)) {
|
||||
return response()->json(['error' => 'اسنAPSHOTی برای بازگردانی وجود ندارد.'], 422);
|
||||
|
||||
Reference in New Issue
Block a user