<?php

$type = array
(
    1 => '直推佣金',
    2 => '团队分润',
    3 => '间推佣金',
);

return array
(
    # 表名
    'name' => 'order_cash',
    # 显示给用户看的名称
    'lang' => '分润信息',
    'menu' => false,
    # 数据结构
    'struct' => array
    (
    
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'update'    => 'hidden',
            //'list'        => true,
        ),

        'order_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '订单表id',
            'default'   => '',
            'desc'      => '订单表id',
            'match'     => 'is_numeric',
        ),

        'type'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '类型',
            'default'   => '1',
            'desc'      => '类型',
            'match'     => 'is_numeric',
            'update'    => 'radio',
            'option'    => $type,
        ),

        'mid'      => array
        (
            'type'      => 'int-11',
            'name'      => '代理商',
            'default'   => '-1',
            'desc'      => '代理商',
            'match'     => 'is_string',
            'update'    => 'text',
        ),

        'parent_mid'      => array
        (
            'type'      => 'int-11',
            'name'      => '上级代理商',
            'default'   => '-1',
            'desc'      => '代理商',
            'match'     => 'is_string',
            'update'    => 'text',
        ),

        'per'      => array
        (
            'type'      => 'int-11',
            'name'      => '佣金比例-仅做展示用',
            'default'   => '0',
            'desc'      => '佣金比例',
            'match'     => 'option',
            'update'    => 'text',
            'list'      => true,
        ),

        'cash'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '金额',
            'default'   => '0',
            'desc'      => '金额',
            'match'     => 'option',
            'update'    => 'text',
            'list'      => true,
        ),

        'prize_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '奖励的名额',
            'default'   => '-1',
            'desc'      => '奖励的名额',
            'match'     => 'is_numeric',
        ),

        'goods'      => array
        (
            'type'      => 'text-255',
            'name'      => '奖励的权益',
            'default'   => '',
            'desc'      => '奖励的权益',
            'match'     => 'is_string',
        ),

        '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})',
        ),
    ),

    'alter' => array
    (
        10 => array
        (
            array('update', 'cash', 'cash', 'decimal-11,2 0 金额'),
        ),
        'version' => 10,
    ),

    'manage' => array
    (
        
    ),

    'request' => array
    (
        'getData' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'order_id' => 'yes',
                'parent_mid' => 'yes',
                'mid' => 'yes',
                'type' => 'yes',
                'state' => 1,
            ),
            'type' => 'one',
            'col' => '*',
        ),

        'getAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'order_id' => 'yes',
                'parent_mid' => 'yes',
                'mid' => 'yes',
                'type' => 'yes',
                'state' => 1,
            ),
            'type' => 'all',
            'col' => '*',
        ),
    ),
);