|
|
|
@ -233,14 +233,32 @@ class PromoteController extends BaseController
|
|
|
|
|
$this->assign("rules_count", count($rules));
|
|
|
|
|
|
|
|
|
|
$promoteBelong = M('promote', 'tab_')->where(['id'=>get_pid()])->getField('company_belong');
|
|
|
|
|
if ($promoteBelong == 1 || $promoteBelong == 2) {
|
|
|
|
|
$compang_belongs = 1;
|
|
|
|
|
}else {
|
|
|
|
|
$compang_belongs = 2;
|
|
|
|
|
}
|
|
|
|
|
$belongs = M("document_pop_rules")
|
|
|
|
|
->where(['id' => 2])
|
|
|
|
|
->getField('belongs');
|
|
|
|
|
if(intval($belongs) == 2) {
|
|
|
|
|
$belongs_tag = 0;
|
|
|
|
|
->where(['belongs' => $compang_belongs])->count();
|
|
|
|
|
if (intval($belongs) > 0) {
|
|
|
|
|
$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,document_route,pop_time')
|
|
|
|
|
->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week}) or (type = 2 and pop_time = 8)")
|
|
|
|
|
->order("sort asc, id desc")
|
|
|
|
|
->select();
|
|
|
|
|
} else {
|
|
|
|
|
$match_rules = [];
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
$belongs_tag = 1;
|
|
|
|
|
$match_rules = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (intval($promoteBelong) == $belongs_tag) {
|
|
|
|
|
// $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
|
// $newcacheKey = "pop:newrule:set";
|
|
|
|
@ -262,22 +280,8 @@ class PromoteController extends BaseController
|
|
|
|
|
// $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],[]);
|
|
|
|
|
$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,document_route,pop_time')
|
|
|
|
|
->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week}) or (type = 2 and pop_time = 8)")
|
|
|
|
|
->order("sort asc, id desc")
|
|
|
|
|
->select();
|
|
|
|
|
} else {
|
|
|
|
|
$match_rules = [];
|
|
|
|
|
}
|
|
|
|
|
}else {$match_rules = [];}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -315,11 +319,19 @@ class PromoteController extends BaseController
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
$promoteBelong = M('promote', 'tab_')->where(['id'=>get_pid()])->getField('company_belong');
|
|
|
|
|
if ($promoteBelong == 1 || $promoteBelong == 2) {
|
|
|
|
|
$belongs = 1;
|
|
|
|
|
}else {
|
|
|
|
|
$belongs = 2;
|
|
|
|
|
}
|
|
|
|
|
$map1['id'] = ['in', $id];
|
|
|
|
|
$map1['belongs'] = $belongs;
|
|
|
|
|
$result = M("document_pop_rules")->where($map1)->page($p, $row)->select();
|
|
|
|
|
if (empty($result)) {
|
|
|
|
|
return $this->error("未找到数据", [], true);
|
|
|
|
|
}
|
|
|
|
|
$count = M("document_pop_rules")->where("id in ({$id})")->count();
|
|
|
|
|
$count = M("document_pop_rules")->where($map1)->count();
|
|
|
|
|
if ($p + 1 <= $count) {
|
|
|
|
|
$this->assign("next_page",$p+1);
|
|
|
|
|
}
|
|
|
|
|