mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-12 16:26:07 -06:00
update
This commit is contained in:
parent
c55cf375d4
commit
8fc17027f8
@ -146,6 +146,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
$query = $query->whereDate('advs_advs.created_at', $param['created_at']);
|
||||
}
|
||||
|
||||
if (!empty($param['start_publish_at']) && !empty($param['finish_publish_at'])) {
|
||||
$query = $query->whereBetween('advs_advs.publish_at', [Carbon::make($param['start_publish_at'] . " 23:59"), Carbon::make($param['finish_publish_at'] . " 00:00")]);
|
||||
}
|
||||
|
||||
foreach ($param as $para => $value) {
|
||||
if (substr($para, 0, 3) === "cf_") {
|
||||
$id = substr($para, 3);
|
||||
@ -304,7 +308,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
{
|
||||
if (count($adv->files) != 0) {
|
||||
$fileName = $adv->files[0]->name;
|
||||
$ext = explode('.',$fileName);
|
||||
$ext = explode('.', $fileName);
|
||||
if ($ext[1] != 'svg') {
|
||||
$fileName = 'tn-' . $fileName;
|
||||
}
|
||||
@ -316,10 +320,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
|
||||
// Create thumbnail image
|
||||
|
||||
$arrContextOptions=array(
|
||||
"ssl"=>array(
|
||||
"verify_peer"=>false,
|
||||
"verify_peer_name"=>false,
|
||||
$arrContextOptions = array(
|
||||
"ssl" => array(
|
||||
"verify_peer" => false,
|
||||
"verify_peer_name" => false,
|
||||
),
|
||||
);
|
||||
|
||||
@ -401,7 +405,8 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
return $this->model->orderBy('created_at', 'DESC')->whereIn('advs_advs.id', $ids)->get();
|
||||
}
|
||||
|
||||
public function hideAdsWithoutOutOfStock($ads) {
|
||||
public function hideAdsWithoutOutOfStock($ads)
|
||||
{
|
||||
return $ads->filter(
|
||||
function ($entry) {
|
||||
return (($entry->is_get_adv == true && $entry->stock > 0) || ($entry->is_get_adv == false));
|
||||
@ -584,14 +589,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
->get();
|
||||
}
|
||||
|
||||
public function currentAds() {
|
||||
public function currentAds()
|
||||
{
|
||||
return $this->newQuery()->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||
->where('status', '=', 'approved')
|
||||
->where('slug', '!=', '')
|
||||
->orderBy('publish_at', 'desc');
|
||||
}
|
||||
|
||||
public function expiredAds() {
|
||||
public function expiredAds()
|
||||
{
|
||||
return $this->newQuery()
|
||||
->whereDate('finish_at', '<', date("Y-m-d H:i:s"))
|
||||
->where('slug', '!=', '')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user