|
@@ -68,11 +68,11 @@ class PostRepository
|
|
|
|
|
|
//验证小号
|
|
|
$userInfo = $this->getUserInfo($request['uid']);
|
|
|
- Log::debug('发布内容小号信息:'.json_encode($userInfo));
|
|
|
- if(!$userInfo || $userInfo['type'] != 1){
|
|
|
+ Log::debug('发布内容小号信息:' . json_encode($userInfo));
|
|
|
+ if (!$userInfo || $userInfo['type'] != 1) {
|
|
|
return Response::create([
|
|
|
- 'message' => '所选小号信息有误',
|
|
|
- 'status_code' => 500
|
|
|
+ 'message' => '所选小号信息有误',
|
|
|
+ 'status_code' => 500
|
|
|
]);
|
|
|
}
|
|
|
//验证话题
|
|
@@ -88,7 +88,7 @@ class PostRepository
|
|
|
|
|
|
//验证内容字数
|
|
|
$html = strip_tags($request['content']);
|
|
|
- if(mb_strlen($html,'UTF8') > 1000){
|
|
|
+ if (mb_strlen($html, 'UTF8') > 1000) {
|
|
|
return Response::create([
|
|
|
'message' => '所传内容不能超过1000字',
|
|
|
'status_code' => 500
|
|
@@ -99,7 +99,7 @@ class PostRepository
|
|
|
'uid' => $userInfo['uid'],
|
|
|
'username' => $userInfo['username'],
|
|
|
'mobile' => $userInfo['mobile'],
|
|
|
- 'avatar' => $userInfo['avatar']??'',
|
|
|
+ 'avatar' => $userInfo['avatar'] ?? '',
|
|
|
'type' => $request['type'],
|
|
|
'img' => $request['img'],
|
|
|
'video' => $request['video'] ?? '',
|
|
@@ -157,10 +157,10 @@ class PostRepository
|
|
|
}
|
|
|
|
|
|
$virus = $this->behavior->where('behavior_identification', 'publish')->first();
|
|
|
- if($virus){
|
|
|
- if($post->title){
|
|
|
+ if ($virus) {
|
|
|
+ if ($post->title) {
|
|
|
$desc = $post->title;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$desc = subtext(strip_tags($post->content), 20);
|
|
|
}
|
|
|
$this->rabbitMqUtil->push('virus_add', [
|
|
@@ -210,7 +210,7 @@ class PostRepository
|
|
|
]);
|
|
|
|
|
|
$members = $this->getSystemMember($number);
|
|
|
- if(!$members || $members['status_code'] != 200){
|
|
|
+ if (!$members || $members['status_code'] != 200) {
|
|
|
return Response::create([
|
|
|
'message' => $members['message'],
|
|
|
'status_code' => 500
|
|
@@ -269,9 +269,9 @@ class PostRepository
|
|
|
$virus = $this->behavior
|
|
|
->whereIn('behavior_identification', ['read', 'forward', 'like', 'collect'])
|
|
|
->pluck('virus_behavior_id', 'behavior_identification');
|
|
|
- if($post->title){
|
|
|
+ if ($post->title) {
|
|
|
$desc = $post->title;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$desc = subtext(strip_tags($post->content), 20);
|
|
|
}
|
|
|
$data = [
|
|
@@ -283,8 +283,8 @@ class PostRepository
|
|
|
'action_id' => $post->id,
|
|
|
];
|
|
|
|
|
|
- foreach($members['data'] as $key => $member){
|
|
|
- if(isset($virus['read']) && $request['add_pv'] > $key){
|
|
|
+ foreach ($members['data'] as $key => $member) {
|
|
|
+ if (isset($virus['read']) && $request['add_pv'] > $key) {
|
|
|
$newData = array_merge($data, [
|
|
|
'behavior_id' => $virus['read'],
|
|
|
'behavior_flag' => 'read',
|
|
@@ -293,7 +293,7 @@ class PostRepository
|
|
|
$this->rabbitMqUtil->push('virus_add', $newData);
|
|
|
}
|
|
|
|
|
|
- if(isset($virus['like']) && $request['add_praise_count'] > $key){
|
|
|
+ if (isset($virus['like']) && $request['add_praise_count'] > $key) {
|
|
|
$newData = array_merge($data, [
|
|
|
'behavior_id' => $virus['like'],
|
|
|
'behavior_flag' => 'like',
|
|
@@ -302,7 +302,7 @@ class PostRepository
|
|
|
$this->rabbitMqUtil->push('virus_add', $newData);
|
|
|
}
|
|
|
|
|
|
- if(isset($virus['collect']) && $request['add_collect_count'] > $key){
|
|
|
+ if (isset($virus['collect']) && $request['add_collect_count'] > $key) {
|
|
|
$newData = array_merge($data, [
|
|
|
'behavior_id' => $virus['collect'],
|
|
|
'behavior_flag' => 'collect',
|
|
@@ -311,7 +311,7 @@ class PostRepository
|
|
|
$this->rabbitMqUtil->push('virus_add', $newData);
|
|
|
}
|
|
|
|
|
|
- if(isset($virus['forward']) && $request['add_share_count'] > $key){
|
|
|
+ if (isset($virus['forward']) && $request['add_share_count'] > $key) {
|
|
|
$newData = array_merge($data, [
|
|
|
'behavior_id' => $virus['forward'],
|
|
|
'behavior_flag' => 'forward',
|
|
@@ -363,7 +363,7 @@ class PostRepository
|
|
|
'username' => $userInfo['username'],
|
|
|
'reply_uid' => 0,
|
|
|
'reply_username' => '',
|
|
|
- 'avatar' => $userInfo['avatar']??'',
|
|
|
+ 'avatar' => $userInfo['avatar'] ?? '',
|
|
|
'content' => $request['content'],
|
|
|
'is_delete' => 0,
|
|
|
];
|
|
@@ -400,10 +400,10 @@ class PostRepository
|
|
|
DB::commit();
|
|
|
|
|
|
$virus = $this->behavior->where('behavior_identification', 'comment')->first();
|
|
|
- if($virus){
|
|
|
- if($post->title){
|
|
|
+ if ($virus) {
|
|
|
+ if ($post->title) {
|
|
|
$desc = $post->title;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$desc = subtext(strip_tags($post->content), 20);
|
|
|
}
|
|
|
$this->rabbitMqUtil->push('virus_add', [
|
|
@@ -925,7 +925,8 @@ class PostRepository
|
|
|
'comment' => 0,
|
|
|
];
|
|
|
foreach ($result as $row) {
|
|
|
- if ($value == date('Y-m-d', strtotime($row['created_at']))) {
|
|
|
+ //-86400 因为每天零点以后统计昨天
|
|
|
+ if ($value == date('Y-m-d', strtotime($row['created_at']) - 86400)) {
|
|
|
$info[$value]['read'] = $row['read_count'];
|
|
|
$info[$value]['post'] = $row['post_count'];
|
|
|
$info[$value]['share'] = $row['share_count'];
|