|
|
|
@ -232,23 +232,64 @@ 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 {
|
|
|
|
|
$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(['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 {
|
|
|
|
|
$match_rules = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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_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);
|
|
|
|
@ -276,8 +317,40 @@ 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)
|
|
|
|
|
{
|
|
|
|
|
$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($map1)->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);
|
|
|
|
|
$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]);
|
|
|
|
|
$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);
|
|
|
|
@ -297,10 +370,24 @@ class PromoteController extends BaseController
|
|
|
|
|
// return $this->success("获取数据成功", $result, true);
|
|
|
|
|
//$this->show("<h2 style='text-align: center;'>{$result['title']}</h2>".$result['content']);
|
|
|
|
|
$this->assign("rule",$result[0]);
|
|
|
|
|
$this->display('pop_rule_detail');
|
|
|
|
|
$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($pop = false)
|
|
|
|
|
{
|
|
|
|
|
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);
|
|
|
|
|
$cacheKey = "pop:rule:set";
|
|
|
|
@ -308,7 +395,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);
|
|
|
|
|
}
|
|
|
|
@ -2049,7 +2141,7 @@ class PromoteController extends BaseController
|
|
|
|
|
$gameId = $_POST['game_id'];
|
|
|
|
|
$promoteId = $_POST['promote_id'];
|
|
|
|
|
$applyService = new ApplyService();
|
|
|
|
|
$applyService->cancelGame($gameId, $promoteId);
|
|
|
|
|
$applyService->offlineGame($gameId, $promoteId);
|
|
|
|
|
recordPromoteLogs('游戏管理','专服管理下架游戏');
|
|
|
|
|
$this->ajaxReturn(['status' => true, 'msg' => '下架成功']);
|
|
|
|
|
}
|
|
|
|
|