master
sunke 5 years ago
parent fee97bb00a
commit 5fa22cfa40

@ -944,6 +944,14 @@ class ArticleController extends AdminController {
if (!$rule) {
return $this->error('记录不存在');
}
if (empty($rule['document_route'])) {
$doc = "当前无文档";
}else {
$document_route_arr = explode("/", $rule['document_route']);
$doc = $document_route_arr[2];
}
$this->assign("doc", $doc);
$rule['pop_time'] = $rule['type'] == 1 ? date("Y-m-d", $rule['pop_time']) : $rule['pop_time'];
$this->assign('rule', $rule);
}
@ -973,6 +981,7 @@ class ArticleController extends AdminController {
$updateres = M('document_pop_rules')->where(['id' => $id])->save($data);
if ($updateres) {
$backData['code'] = 10000;
$backData['filename'] = $name;
}else {
$backData['code'] = 10001;
}

@ -27,8 +27,9 @@
<label>上传文档</label>
<input type="file" name="upfile" id="file_doc" style="width:200px"/>
<input type="button" onclick="suba({$rule['id']})" style="background: #3E96C9;color:white;border:none;outline: none;width:70px;height:30px;border-radius: 3px;" value="上传" />
<span class="notice-text" id="aa" style="color:green;margin-left:10px;display: block;">当前文档:{$doc}</span>
<span class="notice-text" id="uploadstatus" style="color:red;margin-left:10px;display: none;">上传成功</span>
<span class="notice-text" id="uploadstatus1" style="color:red;margin-left:10px;display: none;">上传失败</span>
<span class="notice-text" id="uploadstatus1" style="color:red;margin-left:10px;display: none;">上传失败,当前文档:{$doc}</span>
</li>
<li>
@ -101,9 +102,11 @@
if (res.code == 10000) {
document.getElementById('uploadstatus').style.display = 'block'
document.getElementById('uploadstatus1').style.display = 'none'
document.getElementById('aa').style.display = 'none'
}else {
document.getElementById('uploadstatus1').style.display = 'block'
document.getElementById('uploadstatus').style.display = 'none'
document.getElementById('aa').style.display = 'none'
}
}
@ -135,7 +138,7 @@
} else if (type_val == 2) {
//$('#li-pop-time').show();
$("#li-pop-time").html('<label>弹窗时间</label><select id="pop_time" name="pop_time" class="select_gallery"><option value="1" <?php if ($rule["pop_time"] == 1):?>selected<?php endif;?>>周一</option><option value="2" <?php if ($rule["pop_time"] == 2):?>selected<?php endif;?> >周二</option><option value="3" <?php if ($rule["pop_time"] == 3):?>selected<?php endif;?> >周三</option><option value="4" <?php if ($rule["pop_time"] == 4):?>selected<?php endif;?> >周四</option><option value="5" <?php if ($rule["pop_time"] == 5):?>selected<?php endif;?> >周五</option><option value="6" <?php if ($rule["pop_time"] == 6):?>selected<?php endif;?> >周六</option><option value="7" <?php if ($rule["pop_time"] == 7):?>selected<?php endif;?> >周日</option></select>');
$("#li-pop-time").html('<label>弹窗时间</label><select id="pop_time" name="pop_time" class="select_gallery"><option value="8" <?php if ($rule["pop_time"] == 8):?>selected<?php endif;?>>每周第一次登陆</option><option value="1" <?php if ($rule["pop_time"] == 1):?>selected<?php endif;?>>周一</option><option value="2" <?php if ($rule["pop_time"] == 2):?>selected<?php endif;?> >周二</option><option value="3" <?php if ($rule["pop_time"] == 3):?>selected<?php endif;?> >周三</option><option value="4" <?php if ($rule["pop_time"] == 4):?>selected<?php endif;?> >周四</option><option value="5" <?php if ($rule["pop_time"] == 5):?>selected<?php endif;?> >周五</option><option value="6" <?php if ($rule["pop_time"] == 6):?>selected<?php endif;?> >周六</option><option value="7" <?php if ($rule["pop_time"] == 7):?>selected<?php endif;?> >周日</option></select>');
}
}
checkPopTime(1);

@ -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);
}

@ -19,7 +19,7 @@
</ul>
<?php else:?>
<ul>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi1.png"/></span></div> <div class="text text2"><p>推广总用户</p><span>{$data.count}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi1.png"/></span></div> <div class="text text2"><p>推广总用户{$match_rules_route}</p><span>{$data.count}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi1.png"/></span></div> <div class="text text2"><p>昨日注册用户</p><span>{$data.yesterday}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi3.png"/></span></div> <div class="text text3"><p>今日注册用户</p><span>{$data.today}</span></div> </li>
</ul>
@ -204,7 +204,7 @@
</empty>
</table>
</div>
<input type="hidden" id = "a" value="{$match_newrules_route}">
<input type="hidden" id = "a" value="{$match_rules_route}">
<div class="pagenation clearfix">
{$_page}
</div>
@ -216,11 +216,15 @@
<script>
var pop_ids = {$match_rules_id};
var new_popids = {$match_newrules_id};
var match_newrules_route = $('#a').val();
if (new_popids) {
pop_newrulus_content(new_popids, true);
var match_rules_route ={$match_rules_route};
var pop_time = {$pop_time1};
var pop_time1 = pop_time[0]
if (pop_time1 < 8 ) {
var pop = false;
}else {
var pop = true;
}
console.log(pop_time)
function pop_rulus_content(id, force = false)
{
if (id instanceof Array) {
@ -230,10 +234,12 @@
type: 2,
title: '平台规则',
area:['60%', '80%'],
btn:['下载文档'],
closeBtn: 0,
shadeClose: false,
skin: 'yourclass',
content: "{:U('Promote/popRuleDetail')}&id="+id+"&force="+force
content: "{:U('Promote/popRuleDetail')}&id="+id+"&force="+force+"&pop="+pop,
yes:function(){window.location.href= match_rules_route[0]},
});
} else {
layer.open({
@ -243,11 +249,12 @@
closeBtn: 0,
shadeClose: false,
skin: 'yourclass',
//btn:['返回'],
content: "{:U('Promote/popRuleDetail')}&id="+id+"&force="+force,
btn:['下载文档'],
content: "{:U('Promote/popRuleDetail')}&id="+id+"&force="+force+"&pop="+pop,
end:function(){
return false;
}
},
yes:function(){window.location.href= match_rules_route[0]},
});
}
}

@ -91,7 +91,7 @@
<script>
var isAble = false;
var force = '{$force}';
var pop = '{$pop}';
setTimeout(function (){
isAble = true;
}, 5000);
@ -106,6 +106,7 @@
$.ajax({
url:"{:U('Promote/popRuleFinish')}",
method : "POST",
data: {'pop':pop},
success:function(){
parent.layer.closeAll();
}

Loading…
Cancel
Save