<?php
$info_id = Dever::input('set')['info_id'] ?? 0;
if (!$info_id) {
    $info_id = Dever::input('field')['info_id'] ?? 0;
}
$config = array
(
    'list' => array
    (
        'where' => array('info_id' => $info_id),
        'field'      => array
        (
            'name',
            'cate_id' => array
            (
                'show' => 'Dever::call("place_source/manage.getContentCateName", "{cate_id}")',
            ),
            'type',
            'sku_id' => array
            (
                'name' => '规格',
                'show' => 'Dever::call("place_source/manage.getSkuName", "{sku_id}")',
            ),
            'num',
            'sort' => array
            (
                'type' => 'input',
                'tips' => '双击修改，正序排序',
            ),
            'status' => array
            (
                'type' => 'switch',
                'show'  => '{status}',
                'active_value' => 1,
                'inactive_value' => 2,
            ),
            'cdate',
        ),
        'button' => array
        (
            '新增' => array('add', array('info_id' => $info_id)),
            '分类' => array('route', array
            (
                'path' => 'source_manage/content_cate',
                'param' => array
                (
                    'set' => array('info_id' => $info_id, 'menu' => 'source_manage/info', 'parent' => 'source_manage/content'),
                ),
            )),
        ),
        'data_button' => array
        (
            '编辑' => array('edit', array('info_id' => $info_id)),
        ),
        'search'    => array
        (
            'name' => 'like',
            'type',
            'status',
        ),
    ),
    'update' => array
    (
        'control' => array
        (
            'content_1' => array
            (
                'type' => 1,
            ),

            'content_2' => array
            (
                'type' => 2,
            ),

            'content_3' => array
            (
                'type' => 3,
            ),

            'content_4' => array
            (
                'type' => 4,
            ),

            'content_5' => array
            (
                'type' => 5,
            ),

            'content_6' => array
            (
                'type' => 6,
            ),
        ),

        'field'    => array
        (
            'info_id',
            'cate_id' => array
            (
                'rules' => true,
                'type' => 'select',
                'option'     => 'Dever::call("place_source/manage.getContentCate", '.$info_id.')',
            ),
            'sku_id' => array
            (
                'rules' => true,
                'type' => 'select',
                'option'     => 'Dever::call("place_source/manage.getSku", '.$info_id.')',
                'tips' => '选择规格后，用户购买当前规格才能读取该内容',
            ),
            'num' => array
            (
                'rules' => true,
                'tips' => '输入数字，将消耗用户拥有的次数，免费不消耗次数',
            ),
            'name' => array
            (
                'rules' => true,
            ),
            'type' => array
            (
                'rules' => true,
                'name' => '类型',
                'type' => 'radio',
            ),
            'content_1' => array
            (
                'name' => '图文内容',
                'field' => 'value',
                'type' => 'editor',
                'editorMenu' => array
                (
                    'uploadImage' => 1,
                    'uploadVideo' => 3,
                ),
                'default' => '{value}',
            ),
            'content_2' => array
            (
                'name' => '图片',
                'field' => 'value',
                'type' => 'upload',
                'upload' => '1',
                'multiple' => true,
                'style' => 'pic',
                'default' => '{value}',
            ),

            'content_3' => array
            (
                'name' => '视频',
                'field' => 'value',
                'type' => 'upload',
                'upload' => '3',
                'multiple' => true,
                'style' => 'list',
                'default' => '{value}',
            ),

            'content_4' => array
            (
                'name' => '音频',
                'field' => 'value',
                'type' => 'upload',
                'upload' => '2',
                'multiple' => true,
                'style' => 'list',
                'default' => '{value}',
            ),

            'content_5' => array
            (
                'name' => '文件',
                'field' => 'value',
                'type' => 'upload',
                'upload' => '8',
                'multiple' => true,
                'style' => 'list',
                'default' => '{value}',
            ),

            'content_6' => array
            (
                'name' => '链接',
                'field' => 'value',
                'type' => 'textarea',
                'autosize' => array('minRows' => 4),
                'default' => '{value}',
                'desc' => '将跳转至所填写的链接',
            ),
        ),
    ),
);

return $config;