فهرست منبع

Update CollectionService

Daniel Supernault 2 سال پیش
والد
کامیت
3bf792072a

+ 3 - 0
app/Http/Controllers/Api/ApiV1Controller.php

@@ -2648,6 +2648,9 @@ class ApiV1Controller extends Controller
 			        	$status->id,
 			        	$count
 			        );
+                    $collection->updated_at = now();
+                    $collection->save();
+                    CollectionService::setCollection($collection->id, $collection);
 				});
 		}
 

+ 8 - 0
app/Http/Controllers/CollectionController.php

@@ -168,6 +168,10 @@ class CollectionController extends Controller
         	$count
         );
 
+        $collection->updated_at = now();
+        $collection->save();
+        CollectionService::setCollection($collection->id, $collection);
+
         return StatusService::get($status->id);
     }
 
@@ -305,6 +309,10 @@ class CollectionController extends Controller
 
         $item->delete();
 
+        $collection->updated_at = now();
+        $collection->save();
+        CollectionService::setCollection($collection->id, $collection);
+
         return 200;
     }
 }

+ 4 - 4
app/Services/CollectionService.php

@@ -84,8 +84,8 @@ class CollectionService
 				'description' => $collection->description,
 				'thumb' => url('/storage/no-preview.png'),
 				'url' => $collection->url(),
-				'updated_at' => $collection->updated_at,
-				'published_at' => $collection->published_at,
+				'updated_at' => str_replace('+00:00', 'Z', $collection->updated_at->format(DATE_RFC3339_EXTENDED)),
+				'published_at' => str_replace('+00:00', 'Z', $collection->published_at->format(DATE_RFC3339_EXTENDED)),
 			];
 		});
 
@@ -117,8 +117,8 @@ class CollectionService
 			'description' => $collection->description,
 			'thumb' => self::getThumb($id),
 			'url' => $collection->url(),
-			'updated_at' => $collection->updated_at,
-			'published_at' => $collection->published_at
+			'updated_at' => str_replace('+00:00', 'Z', $collection->updated_at->format(DATE_RFC3339_EXTENDED)),
+			'published_at' => str_replace('+00:00', 'Z', $collection->published_at->format(DATE_RFC3339_EXTENDED)),
 		];
 		Cache::put(self::CACHE_KEY . 'get:' . $id, $res, 86400);
 		$res['post_count'] = self::count($id);