|
|
@ -232,6 +232,26 @@ class PromoteController extends BaseController
|
|
|
|
$this->assign("rules", $rules);
|
|
|
|
$this->assign("rules", $rules);
|
|
|
|
$this->assign("rules_count", count($rules));
|
|
|
|
$this->assign("rules_count", count($rules));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$promoteBelong = M('promote', 'tab_')->where(['id'=>get_pid()])->getField('company_belong');
|
|
|
|
|
|
|
|
if (intval($promoteBelong) == 1) {
|
|
|
|
|
|
|
|
$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 = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
$cacheKey = "pop:rule:set";
|
|
|
|
$cacheKey = "pop:rule:set";
|
|
|
|
if (!$redis->sIsMember($cacheKey, get_pid())) {
|
|
|
|
if (!$redis->sIsMember($cacheKey, get_pid())) {
|
|
|
@ -248,7 +268,9 @@ class PromoteController extends BaseController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign("match_rules_id", $match_rules ? json_encode(array_column($match_rules, 'id')) : 'null');
|
|
|
|
$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("user_count", $user_count);
|
|
|
|
$this->assign("user_count", $user_count);
|
|
|
|
$this->assign("total_money", $total_money);
|
|
|
|
$this->assign("total_money", $total_money);
|
|
|
@ -300,6 +322,44 @@ class PromoteController extends BaseController
|
|
|
|
$this->display('pop_rule_detail');
|
|
|
|
$this->display('pop_rule_detail');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function popNewRuleDetail($id=0, $p=1, $row=1, $force=false) {
|
|
|
|
|
|
|
|
$result = M("document_pop_rules")->where("id in ({$id})")->page($p, $row)->select();
|
|
|
|
|
|
|
|
if (empty($result)) {
|
|
|
|
|
|
|
|
return $this->error("未找到数据", [], true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$count = M("document_pop_rules")->where("id in ({$id})")->count();
|
|
|
|
|
|
|
|
if ($p + 1 <= $count) {
|
|
|
|
|
|
|
|
$this->assign("next_page",$p+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($p - 1 >= 0) {
|
|
|
|
|
|
|
|
$this->assign("preview_page",$p-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($p + 1 > $count) {
|
|
|
|
|
|
|
|
$this->assign("close_btn", true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->assign("count", $count);
|
|
|
|
|
|
|
|
$this->assign("force", $force);
|
|
|
|
|
|
|
|
// return $this->success("获取数据成功", $result, true);
|
|
|
|
|
|
|
|
//$this->show("<h2 style='text-align: center;'>{$result['title']}</h2>".$result['content']);
|
|
|
|
|
|
|
|
$this->assign("rule",$result[0]);
|
|
|
|
|
|
|
|
var_dump(strtotime('next sunday')+ 24*3600);die();
|
|
|
|
|
|
|
|
$this->display('pop_newrule_detail');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function popNewRuleFinish()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
|
|
|
|
$cacheKey = "pop:newrule:set";
|
|
|
|
|
|
|
|
if ($redis->exists($cacheKey)) {
|
|
|
|
|
|
|
|
$redis->sadd($cacheKey, get_pid());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$redis->sadd($cacheKey, get_pid());
|
|
|
|
|
|
|
|
$redis->exprieAt($cacheKey, strtotime('next sunday') + 24*3600);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success("成功", [], true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function popRuleFinish()
|
|
|
|
public function popRuleFinish()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|