|
@@ -68,15 +68,15 @@ class PostRepository
|
|
|
// ]);
|
|
|
// }
|
|
|
//验证话题
|
|
|
- $topicIds = $this->topic->whereIn('id', explode(',', $request['topic_ids']))->pluck('id')->toArray();
|
|
|
- $topicCount = count($topicIds);
|
|
|
+ $topicIdsArray = $this->topic->whereIn('id', explode(',', $request['topic_ids']))->pluck('id')->toArray();
|
|
|
+ $topicCount = count($topicIdsArray);
|
|
|
if($topicCount == 0 || $topicCount > 5){
|
|
|
return Response::create([
|
|
|
'message' => '所选话题必须1-5个',
|
|
|
'status_code' => 500
|
|
|
]);
|
|
|
}
|
|
|
- $topicIds = implode(',', $topicIds);
|
|
|
+ $topicIds = implode(',', $topicIdsArray);
|
|
|
|
|
|
//验证内容字数
|
|
|
$html = preg_replace("/<([a-zA-Z]+)[^>]*>/","<\\1>",$request['content']);
|
|
@@ -143,6 +143,9 @@ class PostRepository
|
|
|
|
|
|
DB::commit();
|
|
|
Redis::zadd('post_trigger_type', 0, $post->id);
|
|
|
+ foreach($topicIdsArray as $id){
|
|
|
+ Redis::zincrby('topic.user_uid'.$request['uid'], 1, $id);
|
|
|
+ }
|
|
|
return Response::create();
|
|
|
|
|
|
}catch (QueryException $exception){
|