wesmiler 2 年之前
父节点
当前提交
36c6e9dff8
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      app/Services/Api/ArticleService.php

+ 3 - 1
app/Services/Api/ArticleService.php

@@ -172,7 +172,9 @@ class ArticleService extends BaseService
         }
 
         $info = $this->model->where(['id'=> $id,'status'=>1,'mark'=>1])
-            ->where('publish_at','<=', date('Y-m-d H:i:s'))
+            ->where(function($query) {
+                $query->where('publish_at','<=', date('Y-m-d H:i:s'))->orWhereNull('publish_at');
+            })
             ->select($field)
             ->first();
         $info = $info? $info->toArray() : [];