layui table thinkphp 结合

HTML代码



<table class="layui-hide" id="specialCall"></table>
<script>
    layui.use('table', function(){
        var table = layui.table;
        var phone = "<?php echo   $data['mobilePhone'] ;?>";
        table.render({
            elem: '#specialCall'
            ,url:"/index/user/specialCall"
            ,where:{phone: phone}
            ,cols: [[
                {field:'id', width:180, title: '编号', sort: true}
                ,{field:'phone', width:200, title: '号码', sort: true}
                ,{field:'phone_info', width:200, title: '通话机构'}
                ,{field:'talk_cnt', width:200, title: '通话次数(次)', sort: true}
                ,{field:'talk_seconds', width:180, title: '通话时长(分钟)'}
                ,{field:'call_cnt', title: '主叫次数(次)', minWidth: 180}
                ,{field:'call_seconds', width:180, title: '主叫时长(分钟)', sort: true}
                ,{field:'called_cnt', width:180, title: '被叫次数(次)', sort: true}
                ,{field:'called_seconds', width:180, title: '被叫时长(分钟)'}
            ]]
            ,page: true

        });
    });
</script>

php 代码


public  function specialCall($phone='')
{
   $calllog = model('RongMobileReport')->where('cellphone',$phone)->value('calllog');
   $calllog = json_decode($calllog,true);
    $res = array();
    $data = array();
    $i = 0;
   foreach($calllog as $key=>$val){
        $phone_info = $val['phone_info'];
        if($phone_info!=''){
            $res[$key]['id'] = $key;
            $res[$key]['phone'] = $val['phone'];
            $res[$key]['phone_info'] = $val['phone_info'];
            $res[$key]['talk_cnt'] = $val['talk_cnt'];
            $res[$key]['talk_seconds'] = $val['talk_seconds'];
            $res[$key]['call_cnt'] = $val['call_cnt'];
            $res[$key]['call_seconds'] = $val['call_seconds'];
            $res[$key]['called_cnt'] = $val['called_cnt'];
            $res[$key]['called_seconds'] = $val['called_seconds'];
            $i=++$i;
        }
   }
   sort($res);
    $data['code'] = 0;
    $data['msg'] = '';
    $data['count'] =$i ;
    $data['data'] = $res;
    return $data;
   }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值