<?php

$status = array(
    1 => '已登场',
    2 => '未登场',
);

return array
(
    # 表名
    'name' => 'creater',
    # 显示给用户看的名称
    'lang' => '造物主管理',
    'order' => 100,

    'end' => array
    (
        'insert' => 'content/lib/manage.updateCreater',
        'update' => 'content/lib/manage.updateCreater',
    ),

    # 数据结构
    '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',
        ),

        'shou'      => array
        (
            'type'      => 'varchar-80',
            'name'      => '首字母',
            'default'   => '',
            'desc'      => '首字母',
            'match'     => 'is_string',
        ),

        'desc'      => array
        (
            'type'      => 'varchar-30',
            'name'      => '简称',
            'default'   => '',
            'desc'      => '简称',
            'match'     => 'is_string',
            //'update'    => 'text',
            //'list'      => true,
            //'search'    => 'fulltext',
        ),

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

        'address'      => array
        (
            'type'      => 'varchar-500',
            'name'      => '地址',
            'default'   => '',
            'desc'      => '地址',
            'match'     => 'option',
            //'update'    => 'textarea',
            //'list'      => true,
        ),

        'site'      => array
        (
            'type'      => 'varchar-500',
            'name'      => '网址',
            'default'   => '',
            'desc'      => '网址',
            'match'     => 'option',
            'update'    => 'textarea',
        ),

        'info'      => array
        (
            'type'      => 'varchar-500',
            'name'      => '介绍',
            'default'   => '',
            'desc'      => '介绍',
            'match'     => 'is_string',
            'update'    => 'textarea',
        ),

        'beizhu'      => array
        (
            'type'      => 'varchar-500',
            'name'      => '备注',
            'default'   => '',
            'desc'      => '备注',
            'match'     => 'option',
            'update'    => 'textarea',
        ),

        'reorder'       => array
        (
            'type'      => 'int-11',
            'name'      => '排序(数值越大越靠前)',
            'default'   => '1',
            'desc'      => '请输入排序',
            'match'     => 'option',
            //'update'  => 'text',
            'search'    => 'order',
            'list'      => true,
            'order'     => 'desc',
            'edit'      => true,
        ),

        'status'        => array
        (
            'type'      => 'int-11',
            'name'      => '登场状态',
            'default'   => '1',
            'desc'      => '登场状态',
            'match'     => 'is_numeric',
            'update'  => 'select',
            'option'    => $status,
            'search'    => 'select',
            'list'      => true,
            '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})',
            'search'    => 'date',
        ),
    ),
    
    # 管理功能
    'manage' => array
    (

    ),

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

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

        'getAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'status' => 'yes',
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('shou' => 'asc', 'reorder' => 'desc', 'id' => 'desc'),
            'col' => '*|shou|',
        ),

        'getAllByName' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'name' => array('yes', 'like'),
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('reorder' => 'desc', 'id' => 'desc'),
            'col' => '*,name as value,name as label|id',
        ),
    ),
);