Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfsky committed Jan 17, 2020
2 parents b064f00 + 8f2fa61 commit 915d6fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/Http/Controllers/Ask/QuestionController.php
Expand Up @@ -314,6 +314,9 @@ public function suggest(Request $request)
if (!$question) {
continue;
}
if($question->status == 0){
continue;
}
$suggestList .= '<li>';

if ($question->status === 2) {
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Article.php
Expand Up @@ -65,7 +65,7 @@ public static function boot()
/*获取相关文章*/
public static function correlations($tagIds,$size=6)
{
$questions = self::whereHas('tags', function($query) use ($tagIds) {
$questions = self::where("status",">",0)->whereHas('tags', function($query) use ($tagIds) {
$query->whereIn('tag_id', $tagIds);
})->orderBy('created_at','DESC')->take($size)->get();
return $questions;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Question.php
Expand Up @@ -93,7 +93,7 @@ public function getImagesAttribute($value)
/*获取相关问题*/
public static function correlations($tagIds, $size = 6)
{
$questions = self::whereHas('tags', function ($query) use ($tagIds) {
$questions = self::where("status",">",0)->whereHas('tags', function ($query) use ($tagIds) {
$query->whereIn('tag_id', $tagIds);
})->orderBy('created_at', 'DESC')->take($size)->get();
return $questions;
Expand Down

0 comments on commit 915d6fe

Please sign in to comment.