<?php

$main = array
(
    1 => '主账号',
    2 => '子账号',
);

$status = array
(
    1 => '手动添加',
    2 => '系统导入',
);



return array
(
    # 表名
    'name' => 'member',
    # 显示给用户看的名称
    'lang' => '期权账户列表',
    'order' => 100,
    'menu' => false,
    'check' => 'key,mobile',
    'start' => array
    (
        'insert' => 'option/lib/manage.checkMember',
        //'update' => 'option/lib/manage.checkMember',
    ),
    'end' => array
    (
        'insert' => 'option/lib/manage.updateMember',
        'update' => 'option/lib/manage.updateMember',
    ),
    'set' => array
    (
        'main' => $main,
    ),
    # 数据结构
    'struct' => array
    (
    
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            //'list'        => true,
        ),

        'main'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '账号类型',
            'default'   => '1',
            'desc'      => '账号类型',
            'match'     => 'is_numeric',
            'option'    => $main,
            //'search'    => 'hidden',
            'update'    => 'radio',
            //'list'      => true,
        ),

        'key'      => array
        (
            'type'      => 'int-11',
            'name'      => '账户索引-通过账户索引来判断同一个人',
            'default'   => '',
            'desc'      => '账户索引',
            'match'     => 'is_string',
            'update'    => 'text',
            'list'      => true,
        ),

        'aid'      => array
        (
            'type'      => 'int-11',
            'name'      => '期权登录账户',
            'default'   => '-1',
            'desc'      => '期权登录账户',
            'match'     => 'is_string',
            'update'    => 'hidden',
        ),

        'name'      => array
        (
            'type'      => 'varchar-100',
            'name'      => '姓名',
            'default'   => '',
            'desc'      => '姓名',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => 'Dever::load("option/lib/member.getInfo", {id})',
            'list'      => true,
        ),

        'mobile'      => array
        (
            'type'      => 'bigint-11',
            'name'      => '手机号',
            'default'   => '',
            'desc'      => '请输入手机号',
            'match'     => Dever::rule('mobile'),
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
        ),

        'idcard'      => array
        (
            'type'      => 'varchar-32',
            'name'      => '身份证号码',
            'default'   => '',
            'desc'      => '身份证号码',
            'match'     => Dever::rule('idcard'),
            'match'     => 'is_string',
            'search'    => 'fulltext',
            'update'    => 'text',
            'list'      => true,
        ),

        'status'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '添加方式',
            'default'   => '1',
            'desc'      => '添加方式',
            'match'     => 'is_numeric',
            'option'    => $status,
            'search'    => 'select',
            'list'      => true
        ),

        'state'     => array
        (
            'type'      => 'tinyint-1',
            'name'      => '状态',
            'default'   => '1',
            'desc'      => '请选择状态',
            'match'     => 'is_numeric',
        ),
        
        'cdate'     => array
        (
            'type'      => 'int-11',
            'name'      => '创建时间',
            'match'     => array('is_numeric', time()),
            'desc'      => '',
            # 只有insert时才生效
            'insert'    => true,
            'search'    => 'date',
            'list'      => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),

    'manage' => array
    (
        'insert' => false,
        'delete' => false,
        'edit' => false,
        'list_button' => array
        (
            'list1' => array('交付记录', '"bill_jiaofu&search_option_main=2&search_option_aid={aid}&search_option_mid={id}&oper_table=member&top_table=account"'),
            'list2' => array('发放记录', '"bill_fafang&search_option_main=2&search_option_aid={aid}&search_option_mid={id}&oper_table=member&top_table=account"'),
            'list3' => array('兑付记录', '"bill_duifu&search_option_main=2&search_option_aid={aid}&search_option_mid={id}&oper_table=member&top_table=account"'),
        ),
    ),

    'request' => array
    (
        'getData' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'main' => 'yes',
                'state' => 1,
            ),
            'order' => array('id' => 'desc'),
            'type' => 'all',
            'col' => '*',
        ),

        # 获取主账号
        'getMain' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'mobile' => 'yes',
                'key' => 'yes',
                'main' => 1,
                'state' => 1,
            ),
            'type' => 'one',
            'col' => '*',
        ),

        # 获取子账号
        'getChild' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'mobile' => 'yes',
                'key' => 'yes',
                'main' => 2,
                'state' => 1,
            ),
            'type' => 'one',
            'col' => '*',
        ),
    ),
);