优化补链记录为ajax

master
chenzhi 5 years ago
parent f8cbe8d9ef
commit 5359e67860

@ -31,7 +31,11 @@ class MendController extends ThinkController {
$map['register_type'] = array('in','(0,1,2,3,4,5,6,7)');
parent::lists("user",$p,$map);
}
/**
* 补链记录
* @param integer $p 分页
* @return void
*/
public function recordList($p=1)
{
$page = intval($p);
@ -41,7 +45,6 @@ class MendController extends ThinkController {
} else {
$row = 10;
}
if(isset($_REQUEST['account'])){
if ($_REQUEST['account']=='全部') {
unset($_REQUEST['account']);
@ -51,13 +54,27 @@ class MendController extends ThinkController {
}
$data = M("Mend","tab_")
->field("id,user_account,promote_account,promote_account_to,op_account,order_time,create_time,remark")
->where($map)
->order("create_time desc")
->page($page, $row)
->select();
$count = M("Mend","tab_")->where($map)->count();
//格式化信息
foreach ($data as $key => $value) {
$data[$key]['create_time'] = date("Y-m-d H:i:s",$value['create_time']);
$data[$key]['order_time'] = date("Y-m-d",$value['order_time']);
}
if(IS_POST){
$page = set_pagination($_REQUEST['row_count'],$row);
$this->ajaxReturn(array(
"list_data"=>$data,
"page"=>$page
));
die();
}
$this->assign('show_status',1);
$count = M("Mend","tab_")->where($map)->count();
$this->assign('row_count',$count);
$this->assign('list_data', $data);
$page = set_pagination($count,$row);

@ -181,7 +181,7 @@
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Mend/lists')}');
highlight_subnav("{:U('Mend/lists')}");
if('{$Think.get.account}'!=''){
$('#select2-user_id-container').text('{$Think.get.account}');
}

@ -4,8 +4,14 @@
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.js-pop,.remarkView{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
<div class="fr">
<a href="{:U('lists')}">推广补链</a>
@ -27,9 +33,8 @@
<div class="input-list">
<input type="text" name="account" placeholder="玩家账号" value="{:I('account')}">
</div>
<input type="hidden" name="type" value="{$_GET['type']}">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Mend/lists','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Mend/recordList','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
@ -37,60 +42,6 @@
<!-- 数据列表 -->
<div class="data_list">
<empty name="show_status">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<!-- <th>用户id</th> -->
<th>玩家账号</th>
<th>注册时间</th>
<th>最后登录时间</th>
<th>注册来源</th>
<th>注册IP源</th>
<th>上次登录</th>
<th>所属推广员</th>
<th style="width:5%;min-width:50px">操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="list_data">
<td colspan="9" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="list_data" id="data">
<tr>
<td>{$data.account}</td>
<td>{$data.register_time|date='Y-m-d H:i:s',###}</td>
<td>{$data.login_time|date='Y-m-d H:i:s',###}</td>
<td>{:get_registertype($data['register_type'])}</td>
<td>{$data.register_ip}</td>
<td>{$data.login_time|date='Y-m-d H:i:s',###}</td>
<td>
<if condition="get_parent_promoteto($data['promote_id']) neq '' ">
{$data['promote_account']}{:get_parent_promoteto($data['promote_id'])}
<else/>
{:get_promote_name($data['promote_id'])}
</if></td>
<td>
<if condition="getIsTask($data['id']) eq 0 ">
<a style="width:100%;text-align:center" href="{:U('Mend/edit?id='.$data['id'])}">补链</a>
<else/>
<a style="width:100%;text-align:center;color: #f00;" href="{:U('Mend/shiftInfo?id='.getIsTask($data['id']))}">补链中</a>
</if>
</td>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
<else/>
<div class="">
<table>
<!-- 表头 -->
@ -102,7 +53,7 @@
<th>玩家账号</th>
<th>补链前渠道</th>
<th>补链后渠道</th>
<th style="width: 450px;">备注</th>
<th style="width:400px;">备注</th>
<th>切分时间</th>
<th>补链时间</th>
<th>操作人员</th>
@ -110,7 +61,7 @@
</thead>
<!-- 列表 -->
<tbody>
<tbody id="tablebox">
<empty name ="list_data">
<td colspan="7" class="text-center">aOh! 暂时还没有内容!</td>
<else />
@ -118,13 +69,13 @@
<tr>
<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data['user_account']}</td>
<td>{:get_promote_name($data['promote_id'])}</td>
<td>{:get_promote_name($data['promote_id_to'])}</td>
<td class="js-pop" >
<a href="javascript:" title="点击查看" class="remarkView" info="{$data['remark']}">{:get_title($data['remark'])}</a>
<td>{$data['promote_account']}</td>
<td>{$data['promote_account_to']}</td>
<td class="js-pop" style="max-width: 400px;padding: 0 20px;">
<a href="javascript:" title="点击查看" class="remarkView" info="{$data['remark']}">{$data['remark']}</a>
</td>
<td>{$data.order_time|date='Y-m-d H:i:s',###}</td>
<td>{$data.create_time|date='Y-m-d H:i:s',###}</td>
<td>{$data.order_time}</td>
<td>{$data.create_time}</td>
<td>{$data.op_account}</td>
</tr>
</volist>
@ -132,15 +83,13 @@
</tbody>
</table>
</div>
</empty>
</div>
<div class="page">
<if condition="$Think.get.type eq 2">
<a class="sch-btn" href="{:U('Export/mend_record_list',array_merge(['xlsname'=>'推广员管理_推广补链_补链记录'],I('get.')))}">导出</a>
<else />
<a class="sch-btn" href="{:U('Export/mend_list',array_merge(['xlsname'=>'推广员管理_推广补链_推广补链'],I('get.')))}">导出</a>
</if>
{$_page|default=''}
<a class="sch-btn" href="{:U('Export/mend_record_list',array_merge(['xlsname'=>'推广员管理_推广补链_补链记录'],I('get.')))}">导出</a>
<div id="pagebox">
{$_page|default=''}
</div>
</div>
@ -156,6 +105,22 @@
</block>
<block name="script">
<script type="text/html" id="tabletpl">
{@each list_data as item,index}
<tr>
<td><input class="ids" type="checkbox" value="${item['id']}" name="ids[]"></td>
<td>${item['user_account']}</td>
<td>${item['promote_account']}</td>
<td>${item['promote_account_to']}</td>
<td class="js-pop" style="max-width: 400px;padding: 0 20px;">
<a href="javascript:" title="点击查看" class="remarkView" info="${item['remark']}">${item['remark']}</a>
</td>
<td>${item.order_time}</td>
<td>${item.create_time}</td>
<td>${item.op_account}</td>
</tr>
{@/each}
</script>
<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">
@ -165,6 +130,7 @@
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js" type="text/javascript"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script type="text/javascript">
$(".select_gallery").select2();
$(".input-list-user").click(function(){
@ -177,7 +143,7 @@
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Mend/lists')}');
highlight_subnav("{:U('Mend/lists')}");
if('{$Think.get.account}'!=''){
$('#select2-user_id-container').text('{$Think.get.account}');
}
@ -245,10 +211,38 @@ $(function(){
})
});
pageAjax();
})
function pageAjax(){
$(".remarkView,.num,.prev,.next,.first,.end").off("click");
$(".remarkView").click(function() {
layer.alert($(this).attr("info"));
})
})
$(".num,.prev,.next,.first,.end").on("click",function(e){
e.preventDefault();
layer.load(2);
var url = $(this).attr("href");
$.ajax({
url:url,
data:{
row_count:{$row_count},
row:'{:I("row",10)}'
},
type:"post",
dataType:"json",
success:function(data){
layer.closeAll('loading');
$("#pagebox").html(data.page);
var tpl =$("#tabletpl").html();
var html = juicer(tpl, data);
$("#tablebox").html(html);
pageAjax();
}
})
})
}
</script>
</block>

@ -375,8 +375,29 @@ function get_custom_category_title($id=0,$title=0) {
*/
function set_pagination($count, $row,$request='') {
$aside = '<script>function pagechange(that){url = location.href.replace(".html","").replace(/(&|\/)row(=|\/)\d*/gi,"").replace(/\/p\/\d*/gi,"");if(url.indexOf("?")>0){url += "&row="+that.value;}else{url += "?row="+that.value;} window.location.href = url;}</script><select id="pagechange" name="row" onchange="pagechange(this)"><option value="10">每页10条</option><option value="25">每页25条</option><option value="50">每页50条</option><option value="100">每页100条</option></select>';
$count=$count?$count:0;
$aside = '<script>function pagechange(that){url = location.href.replace(".html","").replace(/(&|\/)row(=|\/)\d*/gi,"").replace(/\/p\/\d*/gi,"");if(url.indexOf("?")>0){url += "&row="+that.value;}else{url += "?row="+that.value;} window.location.href = url;}</script><select id="pagechange" name="row" onchange="pagechange(this)">';
if($row == 10){
$aside .= '<option value="10" selected>每页10条</option>';
}else{
$aside .= '<option value="10">每页10条</option>';
}
if($row == 25){
$aside .= '<option value="25" selected>每页25条</option>';
}else{
$aside .= '<option value="25">每页25条</option>';
}
if($row == 50){
$aside .= '<option value="50" selected>每页50条</option>';
}else{
$aside .= '<option value="50">每页50条</option>';
}
if($row == 100){
$aside .= '<option value="100" selected>每页100条</option></select>';
}else{
$aside .= '<option value="100">每页100条</option></select>';
}
$count=$count?$count:0;
$row=$row?$row:10;
if ($count > $row) {
$page = new \Think\Page($count, $row,$request);

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save