diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 4fe8c80d9..e08f08cdb 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -232,20 +232,20 @@ class PromoteController extends BaseController $this->assign("rules", $rules); $this->assign("rules_count", count($rules)); -// $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); -// $cacheKey = "pop:rule:set"; -// if (!$redis->sIsMember($cacheKey, get_pid())) { -// $currentTime = strtotime(date('Y-m-d')); -// $weekArray = [7,1,2,3,4,5,6]; -// $week = $weekArray[date("w")]; -// $match_rules = M("document_pop_rules") -// ->field('id') -// ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") -// ->order("sort asc, id desc") -// ->select(); -// } else { -// $match_rules = []; -// } + $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); + $cacheKey = "pop:rule:set"; + if (!$redis->sIsMember($cacheKey, get_pid())) { + $currentTime = strtotime(date('Y-m-d')); + $weekArray = [7,1,2,3,4,5,6]; + $week = $weekArray[date("w")]; + $match_rules = M("document_pop_rules") + ->field('id') + ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") + ->order("sort asc, id desc") + ->select(); + } else { + $match_rules = []; + } $this->assign("match_rules_id", $match_rules ? json_encode(array_column($match_rules, 'id')) : 'null');