|
@@ -3,6 +3,7 @@
|
|
|
namespace App\Repositories;
|
|
|
|
|
|
use App\Models\Post;
|
|
|
+use App\Repositories\Circle\CircleRepository;
|
|
|
use App\Traits\PostTrait;
|
|
|
use App\Traits\UserTrait;
|
|
|
use Illuminate\Support\Carbon;
|
|
@@ -16,6 +17,11 @@ class BeanRepository
|
|
|
use PostTrait;
|
|
|
use UserTrait;
|
|
|
|
|
|
+ public function __construct(CircleRepository $circleRepository)
|
|
|
+ {
|
|
|
+ $this->circleRepository = $circleRepository;
|
|
|
+ }
|
|
|
+
|
|
|
public function beanDetail($request)
|
|
|
{
|
|
|
try {
|
|
@@ -222,23 +228,32 @@ class BeanRepository
|
|
|
// $star_home['battle']['end'] = $activityInfo['end'];
|
|
|
// $star_home['battle']['news'] = Redis::get('battle_latest_info_'.$activityInfo['id'])??'战场四平八稳,劳驾老板亲自去战场督战';
|
|
|
|
|
|
+ $circleList = $this->circleRepository->circleLists(['is_recommend' => 1]);
|
|
|
+ $circles = [];
|
|
|
+ foreach ($circleList as $circle) {
|
|
|
+ $temp = [];
|
|
|
+ $temp['circle_id'] = $circle['id'];
|
|
|
+ $temp['circle_name'] = mb_substr($circle['name'], 0, 6);
|
|
|
+ $circles[] = $temp;
|
|
|
+ }
|
|
|
+ $star_detail['circles'] = $circles;
|
|
|
//聊天室
|
|
|
$tmpChatroom = Redis::get('user_service_chatroom');
|
|
|
- $chatrooms = $tmpChatroom?json_decode($tmpChatroom,true):[];
|
|
|
+ $chatrooms = $tmpChatroom ? json_decode($tmpChatroom, true) : [];
|
|
|
$current = Carbon::now()->format('H:i:s');
|
|
|
$chatRoomsData1 = [];
|
|
|
$chatRoomsData0 = [];
|
|
|
foreach ($chatrooms as &$chatroom) {
|
|
|
- if ($chatroom['start']<$chatroom['end']) {
|
|
|
- if ($current<$chatroom['start'] || $current>$chatroom['end']) {
|
|
|
+ if ($chatroom['start'] < $chatroom['end']) {
|
|
|
+ if ($current < $chatroom['start'] || $current > $chatroom['end']) {
|
|
|
$chatroom['is_open'] = 0;
|
|
|
$chatRoomsData0[] = $chatroom;
|
|
|
} else {
|
|
|
$chatroom['is_open'] = 1;
|
|
|
$chatRoomsData1[] = $chatroom;
|
|
|
}
|
|
|
- } elseif ($chatroom['start']>$chatroom['end']) {
|
|
|
- if ($current>$chatroom['end'] && $current<$chatroom['start']) {
|
|
|
+ } elseif ($chatroom['start'] > $chatroom['end']) {
|
|
|
+ if ($current > $chatroom['end'] && $current < $chatroom['start']) {
|
|
|
$chatroom['is_open'] = 0;
|
|
|
$chatRoomsData0[] = $chatroom;
|
|
|
} else {
|
|
@@ -372,7 +387,7 @@ class BeanRepository
|
|
|
$star_detail['invite']['bean'] = config("customer.share_post_bean") ?? 0;
|
|
|
} else {
|
|
|
Log::debug($request['invite_code']);
|
|
|
- return jsonError('邀请码有误');
|
|
|
+ //return jsonError('邀请码有误');
|
|
|
}
|
|
|
|
|
|
$star_detail['mybean']['user_count'] = intval($user_bean['user_count']) ?? 0;//已入驻老板
|
|
@@ -381,8 +396,15 @@ class BeanRepository
|
|
|
|
|
|
$star_detail['daily_news'] = $this->getNews($request);
|
|
|
$star_detail['exchange'] = $exchange;
|
|
|
-
|
|
|
-
|
|
|
+ $circleList = $this->circleRepository->circleLists(['is_recommend' => 1]);
|
|
|
+ $circles = [];
|
|
|
+ foreach ($circleList as $circle) {
|
|
|
+ $temp = [];
|
|
|
+ $temp['circle_id'] = $circle['id'];
|
|
|
+ $temp['circle_name'] = mb_substr($circle['name'], 0, 6);
|
|
|
+ $circles[] = $temp;
|
|
|
+ }
|
|
|
+ $star_detail['circles'] = $circles;
|
|
|
|
|
|
return $star_detail;
|
|
|
|
|
@@ -422,21 +444,21 @@ class BeanRepository
|
|
|
|
|
|
//聊天室
|
|
|
$tmpChatroom = Redis::get('user_service_chatroom');
|
|
|
- $chatrooms = $tmpChatroom?json_decode($tmpChatroom,true):[];
|
|
|
+ $chatrooms = $tmpChatroom ? json_decode($tmpChatroom, true) : [];
|
|
|
$current = Carbon::now()->format('H:i:s');
|
|
|
$chatRoomsData1 = [];
|
|
|
$chatRoomsData0 = [];
|
|
|
foreach ($chatrooms as &$chatroom) {
|
|
|
- if ($chatroom['start']<$chatroom['end']) {
|
|
|
- if ($current<$chatroom['start'] || $current>$chatroom['end']) {
|
|
|
+ if ($chatroom['start'] < $chatroom['end']) {
|
|
|
+ if ($current < $chatroom['start'] || $current > $chatroom['end']) {
|
|
|
$chatroom['is_open'] = 0;
|
|
|
$chatRoomsData0[] = $chatroom;
|
|
|
} else {
|
|
|
$chatroom['is_open'] = 1;
|
|
|
$chatRoomsData1[] = $chatroom;
|
|
|
}
|
|
|
- } elseif ($chatroom['start']>$chatroom['end']) {
|
|
|
- if ($current>$chatroom['end'] && $current<$chatroom['start']) {
|
|
|
+ } elseif ($chatroom['start'] > $chatroom['end']) {
|
|
|
+ if ($current > $chatroom['end'] && $current < $chatroom['start']) {
|
|
|
$chatroom['is_open'] = 0;
|
|
|
$chatRoomsData0[] = $chatroom;
|
|
|
} else {
|