mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 14:56:13 -06:00
#3126 alibaba-theme improvment "e.3"
This commit is contained in:
parent
dbafd43a88
commit
f30fb16705
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class VisiosoftModuleAdvsAddIsBuyingFields extends Migration
|
||||||
|
{
|
||||||
|
protected $delete = false;
|
||||||
|
|
||||||
|
protected $stream = [
|
||||||
|
'slug' => 'advs',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fields = [
|
||||||
|
'is_buying' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
'config' => [
|
||||||
|
'default' => false,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $assignments = [
|
||||||
|
'is_buying'
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -67,6 +67,25 @@ class AdvCriteria extends EntryCriteria
|
|||||||
return $ads;
|
return $ads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buyingLeads($status = null){
|
||||||
|
$advModel = new AdvModel();
|
||||||
|
$latest_advs = AdvModel::query()
|
||||||
|
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||||
|
->where('status', '=', 'approved')
|
||||||
|
->where('slug', '!=', '')
|
||||||
|
->where('is_buying', ($status == 'buying' ? true : false))
|
||||||
|
->orderBy('publish_at', 'desc')
|
||||||
|
->paginate($this->settings->value('streams::per_page'));
|
||||||
|
|
||||||
|
|
||||||
|
$ads = $advModel->getLocationNames($latest_advs);
|
||||||
|
foreach ($ads as $index => $ad) {
|
||||||
|
$ads[$index]->detail_url = $advModel->getAdvDetailLinkByModel($ad, 'list');
|
||||||
|
$ads[$index] = $advModel->AddAdsDefaultCoverImage($ad);
|
||||||
|
}
|
||||||
|
return $ads;
|
||||||
|
}
|
||||||
|
|
||||||
public function allAdvs()
|
public function allAdvs()
|
||||||
{
|
{
|
||||||
$advModel = new AdvModel();
|
$advModel = new AdvModel();
|
||||||
|
|||||||
@ -200,6 +200,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
|
|
||||||
if ($country != null) {
|
if ($country != null) {
|
||||||
$adv->setAttribute('country_name', $country->name);
|
$adv->setAttribute('country_name', $country->name);
|
||||||
|
$adv->setAttribute('country_abv', $country->abv);
|
||||||
}
|
}
|
||||||
if ($city != null) {
|
if ($city != null) {
|
||||||
$adv->setAttribute('city_name', $city->name);
|
$adv->setAttribute('city_name', $city->name);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user