<?php

$status = Dever::config('base')->status;

# 每页的数据量
$page = 10;

$share = array
(
    1 => '显示',
    2 => '不显示',
);

$template = array
(
    1 => '图文',
    2 => '视频',
);

# 常用的col
$col = '*';

return array
(
    # 表名
    'name' => 'feature',
    # 显示给用户看的名称
    'lang' => '专题管理',
    'order' => 99,

    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'list'      => true,
        ),
        
        'name'      => array
        (
            'type'      => 'varchar-80',
            'name'      => '标题-专题标题,同时也用于分享标题',
            'default'   => '',
            'desc'      => '标题',
            'match'     => 'is_string',
            'update'    => 'text',
            'list'      => true,
            'search'    => 'fulltext',
            //增加预览
            'preview'   => true,
        ),

        'desc'      => array
        (
            'type'      => 'varchar-500',
            'name'      => '摘要-专题摘要,同时也用于分享内容',
            'default'   => '',
            'desc'      => '摘要',
            'match'     => 'is_string',
            'update'    => 'textarea',
        ),

        'cover'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '封面图',
            'default'   => '',
            'desc'      => '封面图',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '1',
            'place'     => '300*300',
        ),

        'content'       => array
        (
            'type'      => 'text-255',
            'name'      => '内容',
            'default'   => '',
            'desc'      => '请输入内容',
            'match'     => 'is_string',
            'update'    => 'editor',
            'key'       => '1',
            'editor'    => array
            (
                'name' => '选择插入模块',
                'button' => array
                (
                    /*
                    array
                    (
                        # 名称
                        'name' => '图片',
                        # 资源库id
                        'key' => 1,
                        # 类型
                        'type' => 'image',
                    ),
                    */
                    array
                    (
                        'name' => '商品',
                        'key' => 'goods/lib/manage.editor',
                    ),
                ),
            ),
        ),

        '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,
        ),
    ),
    
    # 管理功能
    'manage' => array
    (
        //'insert' => false,
        # 列表
        'list_button' => array
        (
            //'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=1'))),
        ),
    ),

    # request 请求接口定义
    'request' => array
    (
        'search' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'ids' => array('yes-id', 'in'),
                'cate_id' => 'yes',
                'name' => array('yes', 'like'),
                'id' => 'yes',
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
            'limit' => '0,10',
            'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
        ),

        
    ),
);