import WidthEllipsis from "@/components/widthEllipsis"
import { Statistic } from "antd"
import React from "react"
import LookRoleDetails from "./lookRoleDetails"

function columns12() {

    let newArr: { label: string, data: any[] }[] = [
        {
            label: '玩家列表',
            data: [
                {
                    title: '玩家ID', dataIndex: 'userId', label: '玩家列表', align: 'center', default: 1, width: 66,
                    render: (a: string, b: any) => {
                        if (b?.zj) {
                            return b?.zj
                        }
                        return b?.userId
                    }
                },
                { title: '玩家账号', dataIndex: 'username', label: '玩家列表', align: 'center', width: 120, default: 2, render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />) },
                { title: '玩家昵称', dataIndex: 'nickname', label: '玩家列表', align: 'center', width: 120, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '玩家注册IP', dataIndex: 'regIp', label: '玩家列表', align: 'center', width: 100, default: 3, render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />) },
                { title: '玩家注册时间', dataIndex: 'regTime', label: '玩家列表', align: 'center', width: 140, default: 4, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '注册渠道', dataIndex: 'agentName', label: '玩家列表', align: 'center', width: 120, default: 5, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: 'CP名称', dataIndex: 'cpName', label: '玩家列表', align: 'center', width: 70, default: 6, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '归因投放人员', dataIndex: 'pitcherName', label: '玩家列表', align: 'center', width: 60, default: 7, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '归因推广账号', dataIndex: 'accountId', label: '玩家列表', align: 'center', width: 75, default: 8, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '游戏名称', dataIndex: 'gameName', label: '玩家列表', align: 'center', width: 80, default: 9, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '游戏应用类型', dataIndex: 'gameCategoryName', label: '玩家列表', align: 'center', width: 80, default: 10, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '原始游戏区服', dataIndex: 'sourceServerName', label: '玩家列表', align: 'center', width: 80, default: 11, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '游戏区服', dataIndex: 'serverName', label: '玩家列表', align: 'center', width: 75, default: 12, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '游戏角色', dataIndex: 'roleName', label: '玩家列表', align: 'center', width: 90, default: 13, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '游戏角色ID', dataIndex: 'roleId', label: '玩家列表', align: 'center', width: 130, default: 14, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '角色等级', dataIndex: 'roleLevel', label: '玩家列表', align: 'center', width: 70, default: 15, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '战力', dataIndex: 'rolePower', label: '玩家列表', align: 'center', width: 85, default: 16, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '角色VIP', dataIndex: 'roleVipLevel', label: '玩家列表', align: 'center', width: 60, default: 17, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '操作系统', dataIndex: 'os', label: '玩家列表', align: 'center', width: 65, default: 18, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '国家', dataIndex: 'country', label: '玩家列表', align: 'center', width: 70, default: 19, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '充值金额', dataIndex: 'rechargeMoney', label: '玩家列表', align: 'center', width: 99, default: 20, render: (a: string, b: any) => (<Statistic value={a || 0} />) },
                { title: '充值次数', dataIndex: 'rechargeCount', label: '玩家列表', align: 'center', width: 60, default: 21, render: (a: string, b: any) => (<Statistic value={a || 0} />) },
                { title: '游戏角色创建时间', dataIndex: 'createTime', label: '玩家列表', align: 'center', width: 140, default: 22, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '最近登录时间', dataIndex: 'lastLoginTime', label: '玩家列表', align: 'center', width: 140, default: 23, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '游戏角色更新时间', dataIndex: 'updateTime', label: '玩家列表', align: 'center', width: 140, default: 24, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                { title: '最近充值时间', dataIndex: 'lastRechargeTime', label: '玩家列表', align: 'center', width: 140, default: 25, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                {
                    title: '注册充值时间差',
                    dataIndex: 'regPayTimeDiff',
                    align: 'center',
                    label: '玩家列表',
                    width: 140,
                    default: 26,
                    render: (a: string, b: any) => {
                        function secondsToDhms(seconds: any) {
                            const days = Math.floor(seconds / (3600 * 24));
                            const hours = Math.floor((seconds % (3600 * 24)) / 3600);
                            const minutes = Math.floor((seconds % 3600) / 60);
                            const remainingSeconds = seconds % 60;
                            return `${days ? days + "天" : ''}${hours ? hours + "小时" : ''}${minutes ? minutes + "分" : ''}${remainingSeconds ? remainingSeconds + "秒" : ''}`
                        }
                        return a ? <WidthEllipsis value={secondsToDhms(a)} /> : '--'
                    }
                }
            ]
        },
        {
            label: '操作',
            data: [
                {
                    title: '操作',
                    dataIndex: 'cz',
                    align: 'center',
                    width: 60,
                    label: '操作',
                    default: 27,
                    render: (_: any, b: any) => {
                        if (b?.zj) {
                            return '--'
                        }
                        return <LookRoleDetails userId={b.userId} />
                    }
                }
            ]
        }
    ]

    return newArr
}

export default columns12