|
|
|
@ -241,47 +241,51 @@ class PromoteController extends BaseController
|
|
|
|
|
}else {
|
|
|
|
|
$belongs_tag = 1;
|
|
|
|
|
}
|
|
|
|
|
// if (intval($promoteBelong) == $belongs_tag) {
|
|
|
|
|
// $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
|
// $newcacheKey = "pop:newrule:set";
|
|
|
|
|
// if (!$redis->sIsMember($newcacheKey, get_pid())) {
|
|
|
|
|
// $currentTime = strtotime(date('Y-m-d'));
|
|
|
|
|
// $weekArray = [7,1,2,3,4,5,6];
|
|
|
|
|
// $week = $weekArray[date("w")];
|
|
|
|
|
// $match_newrules = M("document_pop_rules")
|
|
|
|
|
// ->field('id')
|
|
|
|
|
// ->where(['id' => 2])
|
|
|
|
|
// ->order("sort asc, id desc")
|
|
|
|
|
// ->select();
|
|
|
|
|
// } else {
|
|
|
|
|
// $match_newrules = [];
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// $match_newrules = [];
|
|
|
|
|
// }
|
|
|
|
|
// $match_newrules_route = M("document_pop_rules")
|
|
|
|
|
// ->where(['id' => 2])
|
|
|
|
|
// ->getField('document_route');
|
|
|
|
|
if (intval($promoteBelong) == $belongs_tag) {
|
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
|
$newcacheKey = "pop:newrule:set";
|
|
|
|
|
if (!$redis->sIsMember($newcacheKey, get_pid())) {
|
|
|
|
|
$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_newrules = M("document_pop_rules")
|
|
|
|
|
->field('id')
|
|
|
|
|
->where(['id' => 2])
|
|
|
|
|
$match_rules = M("document_pop_rules")
|
|
|
|
|
->field('id,document_route,pop_time')
|
|
|
|
|
->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})")
|
|
|
|
|
->order("sort asc, id desc")
|
|
|
|
|
->select();
|
|
|
|
|
} else {
|
|
|
|
|
$match_newrules = [];
|
|
|
|
|
} else {
|
|
|
|
|
$match_rules = [];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$match_newrules = [];
|
|
|
|
|
}
|
|
|
|
|
$match_newrules_route = M("document_pop_rules")
|
|
|
|
|
->where(['id' => 2])
|
|
|
|
|
->getField('document_route');
|
|
|
|
|
$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 = [];
|
|
|
|
|
}
|
|
|
|
|
}else {$match_rules = [];}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign("match_rules_id", $match_rules ? json_encode(array_column($match_rules, 'id')) : 'null');
|
|
|
|
|
$this->assign("match_newrules_id", $match_newrules ? json_encode(array_column($match_newrules, 'id')) : 'null');
|
|
|
|
|
$this->assign("match_newrules_route", $match_newrules_route);
|
|
|
|
|
//$this->assign("match_newrules_id", $match_newrules ? json_encode(array_column($match_newrules, 'id')) : 'null');
|
|
|
|
|
$this->assign("match_rules_route", $match_rules ? json_encode(array_column($match_rules, 'document_route')) : 'null');
|
|
|
|
|
$this->assign("pop_time1", $match_rules ? json_encode(array_column($match_rules, 'pop_time')) : 'null');
|
|
|
|
|
|
|
|
|
|
$this->assign("user_count", $user_count);
|
|
|
|
|
$this->assign("total_money", $total_money);
|
|
|
|
@ -309,7 +313,7 @@ class PromoteController extends BaseController
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function popRuleDetail($id=0, $p=1, $row=1, $force=false)
|
|
|
|
|
public function popRuleDetail($id=0, $p=1, $row=1, $force=false, $pop = false)
|
|
|
|
|
{
|
|
|
|
|
$result = M("document_pop_rules")->where("id in ({$id})")->page($p, $row)->select();
|
|
|
|
|
if (empty($result)) {
|
|
|
|
@ -327,6 +331,7 @@ class PromoteController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
$this->assign("count", $count);
|
|
|
|
|
$this->assign("force", $force);
|
|
|
|
|
$this->assign("pop", $pop);
|
|
|
|
|
// return $this->success("获取数据成功", $result, true);
|
|
|
|
|
//$this->show("<h2 style='text-align: center;'>{$result['title']}</h2>".$result['content']);
|
|
|
|
|
$this->assign("rule",$result[0]);
|
|
|
|
@ -370,7 +375,7 @@ class PromoteController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function popRuleFinish()
|
|
|
|
|
public function popRuleFinish($pop = false)
|
|
|
|
|
{
|
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
|
$cacheKey = "pop:rule:set";
|
|
|
|
@ -378,7 +383,12 @@ class PromoteController extends BaseController
|
|
|
|
|
$redis->sadd($cacheKey, get_pid());
|
|
|
|
|
} else {
|
|
|
|
|
$redis->sadd($cacheKey, get_pid());
|
|
|
|
|
$redis->exprieAt($cacheKey, strtotime(date('Y-m-d')) + 86400);
|
|
|
|
|
if ($pop) {
|
|
|
|
|
$redis->exprieAt($cacheKey, strtotime('next sunday') + 24*3600);
|
|
|
|
|
}else {
|
|
|
|
|
$redis->exprieAt($cacheKey, strtotime(date('Y-m-d')) + 86400);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return $this->success("成功", [], true);
|
|
|
|
|
}
|
|
|
|
|