修改bug

master
elf 3 years ago
parent 3a192b1f2b
commit 303e78256a

@ -1221,6 +1221,7 @@ class PromoteService {
foreach ($rules as $rule) { foreach ($rules as $rule) {
if ($this->isLimitRuleContains($rule, $promote) && $this->isLimitRuleEeffective($rule)) { if ($this->isLimitRuleContains($rule, $promote) && $this->isLimitRuleEeffective($rule)) {
$access = false; $access = false;
break;
} }
} }
return $access; return $access;
@ -1241,21 +1242,21 @@ class PromoteService {
private function isLimitRuleEeffective($rule) private function isLimitRuleEeffective($rule)
{ {
if ($rule['started_at'] === null && $rule['ended_at'] === null) { if ($rule['started_at'] === null && $rule['ended_at'] === null) {
return false; return true;
} elseif ($rule['started_at'] === null && $rule['ended_at'] !== null) { } elseif ($rule['started_at'] === null && $rule['ended_at'] !== null) {
if (time() < strtotime($rule['ended_at'] . ' 23:59:59')) { if (time() <= strtotime($rule['ended_at'] . ' 23:59:59')) {
return false; return true;
} }
} elseif ($rule['started_at'] !== null && $rule['ended_at'] === null) { } elseif ($rule['started_at'] !== null && $rule['ended_at'] === null) {
if (time() >= strtotime($rule['started_at'] . ' 00:00:00')) { if (time() >= strtotime($rule['started_at'] . ' 00:00:00')) {
return false; return true;
} }
} else { } else {
if (time() >= strtotime($rule['started_at'] . ' 00:00:00') && time() < strtotime($rule['ended_at'] . ' 23:59:59')) { if (time() >= strtotime($rule['started_at'] . ' 00:00:00') && time() < strtotime($rule['ended_at'] . ' 23:59:59')) {
return false; return true;
} }
} }
return true; return false;
} }
public function getPromoteCompanyBySite($url) public function getPromoteCompanyBySite($url)

Loading…
Cancel
Save