|
|
|
@ -52,6 +52,7 @@ class RelationshipService
|
|
|
|
|
|
|
|
|
|
public static function delete($aid, $tid)
|
|
|
|
|
{
|
|
|
|
|
Cache::forget(self::key("wd:a_{$aid}:t_{$tid}"));
|
|
|
|
|
return Cache::forget(self::key("a_{$aid}:t_{$tid}"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -85,4 +86,24 @@ class RelationshipService
|
|
|
|
|
{
|
|
|
|
|
return self::CACHE_KEY . $suffix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getWithDate($aid, $tid)
|
|
|
|
|
{
|
|
|
|
|
$res = self::get($aid, $tid);
|
|
|
|
|
|
|
|
|
|
if(!$res || !$res['following']) {
|
|
|
|
|
$res['following_since'] = null;
|
|
|
|
|
return $res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Cache::remember(self::key("wd:a_{$aid}:t_{$tid}"), 1209600, function() use($aid, $tid, $res) {
|
|
|
|
|
$tmp = Follower::whereProfileId($aid)->whereFollowingId($tid)->first();
|
|
|
|
|
if(!$tmp) {
|
|
|
|
|
$res['following_since'] = null;
|
|
|
|
|
return $res;
|
|
|
|
|
}
|
|
|
|
|
$res['following_since'] = str_replace('+00:00', 'Z', $tmp->created_at->format(DATE_RFC3339_EXTENDED));
|
|
|
|
|
return $res;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|