<?php
$cate = function()
{
    $array = array();
    $info = Dever::db('product/cate')->state();
    if($info)
    {
        $array += $info;
    }
    return $array;
};
return array
(
    # 表名
    'name' => 'info',
    # 显示给用户看的名称
    'lang' => '产品管理',
    # 后台菜单排序
    'order' => 1,
    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'list'      => true,
            'order'     => 'desc',
        ),
        
        'name'      => array
        (
            'type'      => 'varchar-80',
            'name'      => '名称',
            'default'   => '',
            'desc'      => '名称',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
        ),

        'cate_id'       => array
        (
            'type'      => 'int-11',
            'name'      => '所属分类',
            'default'   => '1',
            'desc'      => '所属分类',
            'match'     => 'is_numeric',
            'update'    => 'select',
            'option'    => $cate,
            'search'    => 'select',
        ),

        'price'      => array
        (
            'type'      => 'varchar-180',
            'name'      => '价格',
            'default'   => '',
            'desc'      => '价格',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
        ),

        'pic'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '图片-图片尺寸750*750px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
            'default'   => '',
            'desc'      => '图片',
            'match'     => 'option',
            'update'  => 'image',
            'key'       => '1',
            'place'     => '150',
        ),

        'content'       => array
        (
            'type'      => 'text-255',
            'name'      => '内容描述',
            'default'   => '',
            'desc'      => '内容描述',
            'match'     => 'is_string',
            'update'    => 'editor',
        ),

        'buy_link'      => array
        (
            'type'      => 'varchar-800',
            'name'      => '购买链接-可以为空,为空则不跳转',
            'default'   => '',
            'desc'      => '购买链接',
            'match'     => 'option',
            'update'    => 'text',
            'search'    => 'fulltext',
        ),
        
        'reorder'       => array
        (
            'type'      => 'int-11',
            'name'      => '排序(数值越大越靠前)',
            'default'   => '1',
            'desc'      => '请输入排序',
            'match'     => 'option',
            'update'    => 'text',
            'search'    => 'order',
            'list'      => true,
            'order'     => 'desc',
            'edit'      => 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,
            'list'      => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),

    'manage' => array
    (
        
    ),

    'request' => array
    (
        'getAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'ids' => array('yes-id', 'in'),
                'name' => array('yes', 'like'),
                'id' => 'yes',
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('reorder' => 'desc', 'id' => 'desc'),
            'limit' => '0,1000',
            'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
        ),

        'getAllByIds' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'ids' => array('yes-id', 'in'),
                'id' => 'yes',
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('reorder' => 'desc', 'id' => 'desc'),
            'col' => '*',
        ),

        'search' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'ids' => array('yes-id', 'in'),
                'name' => array('yes', 'like'),
                'id' => 'yes',
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('reorder' => 'desc', 'id' => 'desc'),
            'limit' => '0,1000',
            'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
        ),
    ),
);