<?php

return array
(
    # 表名
    'name' => 'level',
    # 显示给用户看的名称
    'lang' => '代理商等级',
    # 后台菜单排序
    'order' => 3,
    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            //'list'      => true,
            'order'     => 'desc',
        ),
        
        'name'      => array
        (
            'type'      => 'varchar-200',
            'name'      => '名称',
            'default'   => '',
            'desc'      => '名称',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
        ),

        'level'      => array
        (
            'type'      => 'int-11',
            'name'      => '等级数字',
            'default'   => '1',
            'desc'      => '等级数字',
            'match'     => 'is_numeric',
            'update'    => 'text',
            //'list'      => true,
            'order'     => 'asc',
        ),

        'num'      => array
        (
            'type'      => 'int-11',
            'name'      => '直推人数-该等级可以分佣的直推人数',
            'default'   => '3',
            'desc'      => '直推人数',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'list'      => true,
        ),

        'target'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '目标额-成为该等级的团队业绩总数,以万为单位',
            'default'   => '0',
            'desc'      => '目标额',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'list'      => true,
        ),

        'value'      => array
        (
            'type'      => 'int-11',
            'name'      => '补贴额-补贴团队政策,这里以百分比为单位,如输入10,就是每次推广分润10%',
            'default'   => '0',
            'desc'      => '补贴额',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'list'      => true,
        ),

        'target_value'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '奖励额-总业绩的百分比奖励,这里以百分比为单位,如输入10,就是总业绩10%奖励',
            'default'   => '0',
            'desc'      => '奖励额',
            'match'     => 'is_numeric',
            //'update'    => 'text',
            //'list'      => true,
        ),
        'market_desc'      => array
        (
            'type'      => 'text-255',
            'name'      => '提现协议',
            'default'   => '',
            'desc'      => '提现协议',
            'match'     => 'option',
            'update'    => 'editor',
            'key'       => '1',
        ),
        '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,
            'list'      => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),

    'alter' => array
    (
        5 => array
        (
            array('update', 'target', 'target', 'decimal-11,2 0 目标额'),
            array('update', 'target_value', 'target_value', 'decimal-11,2 0 奖励额'),
        ),
        'version' => 5,
    ),

    'default' => array
	(
		'col' => 'id,name,level,target,value,state,cdate',
		'value' => array
		(
			'1,"合伙人", 1, "30", "3", 1,' . DEVER_TIME,

			'2,"初级合伙人", 2, "60", "6", 1,' . DEVER_TIME,

			'3,"中级合伙人", 3, "100", "9", 1,' . DEVER_TIME,

			'4,"高级合伙人", 4, "300", "12", 1,' . DEVER_TIME,

			'5,"事业合伙人", 5, "500", "15", 1,' . DEVER_TIME,
		),
	),

    'manage' => array
    (
    	//'insert' => false,
        'delete' => false,
        //'edit' => false,
        'list_button' => array
        (
        	//'fast' => array('编辑', '"level&where_id={id}&oper_save_jump=level&oper_table=level&oper_parent=level"'),
        )
    ),

    'request' => array
    (
        'getOne' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'type' => array('yes', 'in'),
                'target' => array('yes', '<='),
                'state' => 1,
            ),
            'type' => 'one',
            'order' => array('level' => 'desc', 'id' => 'desc'),
            'col' => '*',
        ),
    ),
);