平台规则

master
sunke 5 years ago
parent 4459021cb9
commit 3ed5eedc07

@ -232,6 +232,26 @@ class PromoteController extends BaseController
$this->assign("rules", $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],[]);
$cacheKey = "pop:rule:set";
if (!$redis->sIsMember($cacheKey, get_pid())) {
@ -246,9 +266,11 @@ class PromoteController extends BaseController
} 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("user_count", $user_count);
$this->assign("total_money", $total_money);
@ -300,6 +322,44 @@ class PromoteController extends BaseController
$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()
{
$redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]);

@ -215,6 +215,10 @@
<script>
var pop_ids = {$match_rules_id};
var new_popids = {$match_newrules_id};
if (new_popids) {
pop_newrulus_content(new_popids, true);
}
function pop_rulus_content(id, force = false)
{
if (id instanceof Array) {
@ -245,6 +249,36 @@
});
}
}
function pop_newrulus_content(id, force = false)
{
if (id instanceof Array) {
console.log(id)
var index = 0;
layer.open({
type: 2,
title: '平台规则',
area:['60%', '80%'],
closeBtn: 0,
shadeClose: false,
skin: 'yourclass',
content: "{:U('Promote/popNewRuleDetail')}&id="+id+"&force="+force
});
} else {
layer.open({
type: 2,
title: '平台规则',
area:['60%', '80%'],
closeBtn: 0,
shadeClose: false,
skin: 'yourclass',
//btn:['返回'],
content: "{:U('Promote/popNewRuleDetail')}&id="+id+"&force="+force,
end:function(){
return false;
}
});
}
}
if (pop_ids) {pop_rulus_content(pop_ids, true);}
function getCookie(name)

@ -0,0 +1,123 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>充值查询列表|----软件管理平台</title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/module.css">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css"/>
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.mousewheel.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
* {
margin: 0;
padding: 0;
}
footer {
background-color: white;
position:fixed;
bottom:0px;
width: 100%;
}
</style>
<body>
<div id="main" class="main" style="min-height: 342px;width: 96%;">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<h2 style="text-align: center;">{$rule.title}</h2>
<div>{$rule.content}</div>
</div>
</body>
<footer>
<div style="text-align: right;margin-right: 10px;">
<?php if ($close_btn):?>
<a onclick="<?php if ($force):?>checkClose();<?php else:?>parent.layer.closeAll();<?php endif;?>" class="submit btn" style="line-height: 15px"><i class="add_qudao"></i><span>关闭</span></a>
<?php endif;?>
</div>
</footer>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script>
var isAble = false;
var force = '{$force}';
setTimeout(function (){
isAble = true;
}, 5000);
function checkClose()
{
if (isAble == false) {
layer.msg("请浏览5秒后再点击111");
return false;
} else {
// 查看完成
$.ajax({
url:"{:U('Promote/popNewRuleFinish')}",
method : "POST",
success:function(){
parent.layer.closeAll();
}
});
return true;
}
}
function checkJump(url)
{
if (isAble == false) {
layer.msg("请浏览5秒后再点击");
return false;
} else {
window.location.href = url;
return true;
}
}
</script>
</html>
Loading…
Cancel
Save