<?php
$channel_id = Dever::input('search')['channel_id'] ?? 1;

return array
(
    'list' => array
    (
        'where' => array('channel_id' => $channel_id),
        # 展示左侧分栏
        'column' => array
        (
            # 分栏数据来源
            'load' => 'place_source/channel',
            # 分栏新增按钮
            'add' => '新增',
            # 分栏编辑按钮，这里直接用图标
            'edit' => true,
            # 分栏删除按钮，这里直接用图标
            //'delete' => true,
            # 关键字段，一般为id或者key
            'key' => 'id',
            # 获取数据
            'data' => 'place_source/manage.getChannel',
            # 默认展开
            'active' => 1,
            # 对应的where条件的key
            'where' => 'channel_id',
        ),

        'field'      => array
        (
            'name',
            'score_id',
            'sort' => array
            (
                'type' => 'input',
                'tips' => '双击修改排序，正序排序',
            ),
            'status' => array
            (
                'type' => 'switch',
                'show'  => '{status}',
                'active_value' => 1,
                'inactive_value' => 2,
            ),
            //'cdate',
        ),
        'tree' => array('parent_id', '0', 'id'),
        'button' => array
        (
            '新增主分类' => array('fastadd', array('parent_id' => '0', 'channel_id' => $channel_id)),
        ),
        'data_button' => array
        (
            '编辑' => array('fastedit', array('field' => 'name,score_id,buy,desc')),
            '新增子分类' => array('fastadd', array('parent_id' => 'id', 'channel_id' => $channel_id), '', 'parent_id=0'),
        ),
        'search'    => array
        (
            'name',
            'status',
        ),
    ),
    'update' => array
    (
        'field'    => array
        (
            'name' => array
            (
                'rules' => true,
            ),
            'parent_id',
            'channel_id',
            'score_id' => array
            (
                'rules' => true,
                'tips' => '当前分类下购买资源所需的积分',
            ),
            'buy' => array
            (
                'tips' => '购买当前分类下资源的折扣，直接填写数字即可<br />资源价格*折扣%=实付价格<br />如：此处填写为80，则实付价格=资源价格*80%<br />如填写本折扣，角色权益里的购买折扣将在此折扣基础上再次计算折扣<br />不填写则无折扣',
                'placeholder' => '资源价格*折扣%=实付价格',
            ),
        ),
    ),
);