|
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
|
namespace App\Repositories;
|
|
|
use App\Models\Post;
|
|
|
+use App\Traits\PostTrait;
|
|
|
use Illuminate\Support\Carbon;
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
@@ -8,6 +9,7 @@ use Tymon\JWTAuth\Facades\JWTAuth;
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
class BeanRepository
|
|
|
{
|
|
|
+ use PostTrait;
|
|
|
public function beanDetail($request)
|
|
|
{
|
|
|
try {
|
|
@@ -243,21 +245,11 @@ class BeanRepository
|
|
|
Log::debug($yesterday_quantity_issued);
|
|
|
Log::debug($exchange);
|
|
|
|
|
|
- $post_detail = new Post();
|
|
|
if (isset($request['post_id']) && $request['post_id']){
|
|
|
- $post = $post_detail->
|
|
|
- join('post_data', 'post_data.post_id', '=', 'post.id')
|
|
|
- ->select('post.*','post_data.pv')
|
|
|
- ->find($request['post_id']);
|
|
|
+ $post = $this->getPostInfo($request['post_id'], 1);
|
|
|
if ($post){
|
|
|
- $post->created_time = Carbon::parse($post->created_at)->diffForHumans();
|
|
|
- $imgs = [];
|
|
|
- foreach($post->imgs as $img){
|
|
|
- $imgs[] = $img['img'];
|
|
|
- }
|
|
|
- unset($post->imgs);
|
|
|
- $post->imgs = $imgs;
|
|
|
- $post->topic = $post->topic();
|
|
|
+ $post['created_time'] = Carbon::parse($post['created_at'])->diffForHumans();
|
|
|
+ $post['topic'] = $this->getTopic($post['topic_ids']);
|
|
|
$star_detail['post'] = $post;
|
|
|
}else{
|
|
|
Log::debug($request['post_id']);
|