更新文章错误

This commit is contained in:
shengchanzhe 2023-09-02 21:11:04 +08:00
parent 2549309570
commit 237fb150f6

View File

@ -73,12 +73,9 @@ class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, L
*/ */
public function lists(): array public function lists(): array
{ {
$query = Article::where($this->searchWhere); $query = Article::where($this->searchWhere);
if($this->adminInfo['root']!=1){ if($this->adminInfo['root']!=1){
$companyIds = CompanyLogic::getAllCompanyIds(); $query->where('company_id', $this->adminInfo['company_id']);
if (!empty($companyIds)) {
$query->whereIn('company_id', $companyIds);
}
} }
$ArticleLists = $query->with(['company']) $ArticleLists = $query->with(['company'])
@ -99,7 +96,11 @@ class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, L
*/ */
public function count(): int public function count(): int
{ {
return Article::where($this->searchWhere)->count(); $query = Article::where($this->searchWhere);
if($this->adminInfo['root']!=1){
$query->where('company_id', $this->adminInfo['company_id']);
}
return $query->count();
} }
public function extend() public function extend()