define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'data.register_retain/index',
        add_url: 'data.register_retain/add',
        edit_url: 'data.register_retain/edit',
        delete_url: 'data.register_retain/delete',
        export_url: 'data.register_retain/export',
        modify_url: 'data.register_retain/modify',
    };

    var Controller = {
        index: function () {
            var util = layui.util;
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', width:100, title: '序号',search:false},
                    {field: 'day_time', width:150, title: '日期',search: 'range', timeType: 'date',searchValue: util.toDateString(new Date(new Date().getTime() - 7 * 24 * 3600 * 1000), 'yyyy-MM-dd') + ' - ' + util.toDateString(new Date(), 'yyyy-MM-dd')},
                    {field: 'ver_code', width:100, title: '渠道号'},
                    {field: 'appid', width:100, title: '注册游戏'},
                    {field: 'reg_num', width:100, title: '新增注册',search:false},
                    {field: 'login_num', width:100, title: '登录数',search:false},
                    {field: 'day1', width:100, title: '次日留存',search:false},
                    {field: 'day2', width:100, title: '3日留存',search:false},
                    {field: 'day3', width:100, title: '4日留存',search:false},
                    {field: 'day4', width:100, title: '5日留存',search:false},
                    {field: 'day5', width:100, title: '6日留存',search:false},
                    {field: 'day6', width:100, title: '7日留存',search:false},
                    {field: 'day7', width:100, title: '8日留存',search:false},
                    {field: 'day8', width:100, title: '9日留存',search:false},
                    {field: 'day9', width:100, title: '10日留存',search:false},
                    {field: 'day10', width:100, title: '11日留存',search:false},
                    {field: 'day11', width:100, title: '12日留存',search:false},
                    {field: 'day12', width:100, title: '13日留存',search:false},
                    {field: 'day13', width:100, title: '14日留存',search:false},
                    {field: 'day14', width:100, title: '15日留存',search:false},
                    {field: 'day15', width:100, title: '16日留存',search:false},
                    {field: 'day16', width:100, title: '17日留存',search:false},
                    {field: 'day17', width:100, title: '18日留存',search:false},
                    {field: 'day18', width:100, title: '19日留存',search:false},
                    {field: 'day19', width:100, title: '20日留存',search:false},
                    {field: 'day20', width:100, title: '21日留存',search:false},
                    {field: 'day21', width:100, title: '22日留存',search:false},
                    {field: 'day22', width:100, title: '23日留存',search:false},
                    {field: 'day23', width:100, title: '24日留存',search:false},
                    {field: 'day24', width:100, title: '25日留存',search:false},
                    {field: 'day25', width:100, title: '26日留存',search:false},
                    {field: 'day26', width:100, title: '27日留存',search:false},
                    {field: 'day27', width:100, title: '28日留存',search:false},
                    {field: 'day28', width:100, title: '29日留存',search:false},
                    {field: 'day29', width:100, title: '30日留存',search:false},
                    {field: 'day44', width:100, title: '45日留存',search:false},
                    {field: 'day59', width:100, title: '60日留存',search:false},
                    {field: 'day89', width:100, title: '90日留存',search:false},
                    {field: 'day119', width:100, title: '120日留存',search:false},
                    {field: 'day149', width:100, title: '150日留存',search:false},
                    {field: 'day179', width:100, title: '180日留存',search:false},
                    {field: 'create_date', width:200, title: '更新时间',search:false},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});
