Merge branch 'feature/platform_rule' of wmtx/platform into release

推广规则
master
廖金灵 5 years ago committed by Gogs
commit 820885f3dd

@ -918,6 +918,7 @@ class ArticleController extends AdminController {
if ($_POST['type'] == 1 ) {
$_POST['pop_time'] = strtotime($_POST['pop_time']);
}
if ($id) {
$pop_rules_model = M('document_pop_rules');//M('$this->$model_name','tab_');
$res = $pop_rules_model->where(['id'=>$id])->save($_POST);
@ -943,11 +944,49 @@ 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);
}
}
$this->display('pop_rule_edit');
}
public function uploadDoc() {
$id = $_REQUEST['id'];
if(@is_uploaded_file($_FILES['file']['tmp_name'])){
$upfile = $_FILES["file"];
$name = $upfile["name"];
$type = $upfile["type"];
$size = $upfile["size"];
$tmp_name = $upfile["tmp_name"];
$savePath = $_SERVER['DOCUMENT_ROOT'].__ROOT__.'/Uploads/Documents/';
if (is_dir($savePath)) {
move_uploaded_file($tmp_name,$savePath.$name);
}else {
mkdir($savePath, 0777, true);
move_uploaded_file($tmp_name,$savePath.$name);
}
$file_name = $savePath.$name;
$error=$upfile["error"];//上传后系统返回的值
$data['document_route'] = 'Uploads/Documents/'.$name;
$updateres = M('document_pop_rules')->where(['id' => $id])->save($data);
if ($updateres) {
$backData['code'] = 10000;
$backData['filename'] = $name;
}else {
$backData['code'] = 10001;
}
$this->ajaxReturn(json_encode($backData,TRUE));
}
}
}

@ -14,6 +14,24 @@
<label>描述</label>
<textarea name="desc" class="" placeholder="描述" >{$rule.desc}</textarea>
</li>
<li>
<label>规则性质</label>
<span class="form_radio"><label><input type="radio" name="belongs" value="1" <?php if ($rule['belongs'] == 1):?>checked<?php endif;?>> 外团</label>
<label><input type="radio" name="belongs" value="2" <?php if ($rule['belongs'] == 2):?>checked<?php endif;?>> 内团</label></span>
<span class="notice-text"></span>
</li>
<li>
<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;">上传失败,当前文档:{$doc}</span>
</li>
<li>
<label>排序</label>
<input name="sort" type="text" class="txt" placeholder="排序" value="{$rule.sort}" />
@ -65,6 +83,36 @@
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript">
</script>
<script>
function suba(id) {
var file_excel = $('#file_doc')[0].files[0]
var formData = new FormData();
formData.append("file",file_excel);
formData.append("id",id)
$.ajax({
url:"{:U('Article/uploadDoc')}",
dataType:'json',
type:'POST',
async:false,
data:formData,
processData : false, // 使数据不做处理
contentType : false, // 不要设置Content-Type请求头
success:function(res) {
res = JSON.parse(res)
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'
}
}
})
}
</script>
<script type="text/javascript">
highlight_subnav('{:U('Article/pop_rules')}');
function checkPopTime(first)
@ -90,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);

@ -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' => '下架成功']);
}

@ -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,6 +204,7 @@
</empty>
</table>
</div>
<input type="hidden" id = "a" value="{$match_rules_route}">
<div class="pagenation clearfix">
{$_page}
</div>
@ -215,11 +216,32 @@
<script>
var pop_ids = {$match_rules_id};
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) {
console.log(id)
var index = 0;
layer.open({
type: 2,
title: '平台规则',
area:['60%', '80%'],
btn:['下载文档'],
closeBtn: 0,
shadeClose: false,
skin: 'yourclass',
content: "{:U('Promote/popRuleDetail')}&id="+id+"&force="+force+"&pop="+pop,
yes:function(){window.location.href= match_rules_route[0]},
});
} else {
layer.open({
type: 2,
title: '平台规则',
@ -227,7 +249,30 @@
closeBtn: 0,
shadeClose: false,
skin: 'yourclass',
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]},
});
}
}
function pop_newrulus_content(id, force = false)
{
if (id instanceof Array) {
console.log(id)
var index = 0;
layer.open({
type: 2,
closeBtn: 0,
title: '平台规则',
area:['60%', '80%'],
shadeClose: false,
skin: 'yourclass',
btn:['下载文档'],
content: "{:U('Promote/popNewRuleDetail')}&id="+id+"&force="+force,
yes:function(){window.location.href= match_newrules_route},
});
} else {
layer.open({
@ -237,8 +282,8 @@
closeBtn: 0,
shadeClose: false,
skin: 'yourclass',
//btn:['返回'],
content: "{:U('Promote/popRuleDetail')}&id="+id+"&force="+force,
btn:['下载文档'],
content: "{:U('Promote/popNewRuleDetail')}&id="+id+"&force="+force,
end:function(){
return false;
}

@ -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>

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

@ -0,0 +1 @@
Subproject commit 4c40f58e6c0c9afe8a505f404b4df11a98f15653
Loading…
Cancel
Save