mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#2474 e-madencilik ads number bug
This commit is contained in:
parent
35b0e80fee
commit
cabe49f00d
@ -84,9 +84,14 @@ class AdvCriteria extends EntryCriteria
|
||||
return $ads;
|
||||
}
|
||||
|
||||
public function findAdsByCategoryId($catId, $level = 1)
|
||||
public function findAdsByCategoryId($catId, $level = 1, $limit = 20)
|
||||
{
|
||||
return $this->advRepository->getByCat($catId, $level);
|
||||
return $this->advRepository->getByCat($catId, $level, $limit);
|
||||
}
|
||||
|
||||
public function countAdsByCategoryId($catId, $level = 1)
|
||||
{
|
||||
return $this->advRepository->countByCat($catId, $level);
|
||||
}
|
||||
|
||||
public function getCurrentLocale()
|
||||
|
||||
@ -4,6 +4,7 @@ use Anomaly\FilesModule\File\Contract\FileRepositoryInterface;
|
||||
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Intervention\Image\Facades\Image;
|
||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||
@ -377,15 +378,19 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
return $ads;
|
||||
}
|
||||
|
||||
public function getByCat($catID, $level = 1)
|
||||
public function getByCat($catID, $level = 1, $limit = 20)
|
||||
{
|
||||
$advs = $this->model
|
||||
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||
->where('status', 'approved')
|
||||
->where('slug', '!=', '')
|
||||
->where('cat' . $level, $catID)
|
||||
->limit(20)
|
||||
->get();
|
||||
->where('cat' . $level, $catID);
|
||||
|
||||
if ($limit) {
|
||||
$advs = $advs->limit($limit);
|
||||
}
|
||||
|
||||
$advs = $advs->get();
|
||||
|
||||
$ads = $this->model->getLocationNames($advs);
|
||||
|
||||
@ -397,6 +402,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
return $ads;
|
||||
}
|
||||
|
||||
public function countByCat($catID, $level = 1)
|
||||
{
|
||||
return DB::table('advs_advs')
|
||||
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||
->where('status', 'approved')
|
||||
->where('slug', '!=', '')
|
||||
->where('cat' . $level, $catID)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function getCategoriesWithAdID($id)
|
||||
{
|
||||
$adv = $this->model->find($id);
|
||||
|
||||
@ -35,7 +35,9 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
||||
|
||||
public function latestAds();
|
||||
|
||||
public function getByCat($catID, $level = 1);
|
||||
public function getByCat($catID, $level = 1, $limit = 20);
|
||||
|
||||
public function countByCat($catID, $level = 1);
|
||||
|
||||
public function getCategoriesWithAdID($id);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user