<?php
$type = array
(
    1 => '普通表单',
    2 => '支付表单',
);
$time = time()+(3600*24*7);
return array
(
    # 表名
    'name' => 'form_id',
    # 显示给用户看的名称
    'lang' => '模板form_id收集表',
    'menu' => false,
    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'list'      => true,
        ),

        'type'      => array
        (
            'type'      => 'tinyint-1',
            'name'      => '类型',
            'default'   => '1',
            'desc'      => '类型',
            'match'     => 'option',
            'search'    => 'select',
            'option'    => $type,
            'list'      => true,
        ),

        'cate_id'       => array
        (
            'type'      => 'int-11',
            'name'      => '小刊分类',
            'default'   => '1',
            'desc'      => '小刊分类',
            'match'     => 'is_numeric',
            //'search'    => 'select',
            'list'      => true,
        ),
        
        'num'       => array
        (
            'type'      => 'int-11',
            'name'      => '使用次数',
            'default'   => '0',
            'desc'      => '使用次数',
            'match'     => 'is_numeric',
            'list'      => true,
        ),

        'uid'       => array
        (
            'type'      => 'int-11',
            'name'      => '用户id',
            'default'   => '',
            'desc'      => '用户id',
            'match'     => 'is_numeric',
            'list'      => true,
        ),
        
        'form_id'       => array
        (
            'type'      => 'varchar-700',
            'name'      => 'form_id',
            'default'   => '',
            'desc'      => 'form_id',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => 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'      => '',
            'default'   => '',
            'list'      => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),

    'top' => Dever::config('base', 'applet')->top,

    'manage' => array
    (
        //'delete' => false,
        'insert' => false,
        'edit' => false,
    ),

    'request' => array
    (
        'getAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'num' => array('yes', '<'),
                'type' => 'yes',
                'uid' => 'yes',
                'cate_id' => 'yes',
                'cdate' => array($time, '<='),
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('cdate' => 'desc'),
            'limit' => '0,100',
            'col' => '*',
        ),

        'getAllGroupByUid' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'type' => 'yes',
                'cate_id' => 'yes',
                'cdate' => array($time, '<='),
                'state' => 1,
            ),
            'type' => 'all',
            'group' => 'uid',
            'order' => array('cdate' => 'desc'),
            'col' => '*',
        ),
    ),
);