<?php
$status = array
(
    1 => '待核销',
    2 => '已核销',
    3 => '已作废',
);
$act_status = array
(
    1 => '未开始',
    2 => '报名中',
    3 => '报名结束',
    4 => '活动开始',
    5 => '活动结束',
);
return array
(
    # 表名
    'name' => 'creat_code',
    # 显示给用户看的名称
    'lang' => '生成核销码',
    'menu' => false,
    # 后台菜单排序
    'order' => 2,
    'start' => array
    (
        'insert' => 'active/lib/order.insertCode',
    ),
    'end' => array
    (
        'update' => 'active/lib/order.createCode',
        'insert' => 'active/lib/order.createCode',
    ),
    // 'menu' => false,
    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'list'      => true,
            'order'     => 'desc',
        ),

        'active_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '活动名称',
            'default'   => '-1',
            'desc'      => '活动名称',
            'match'     => 'is_string',
            'update'    => 'hidden',
            'value'     => Dever::input('search_option_active_id'),
             'search'    => array
            (
                'api' => 'active/info-getSearch',
                'col' => 'col',
                'result' => 'id',
                'search' => 'active_id',
            ),
            'list'      => "Dever::load('active/lib/manage.active#active_name',{active_id})",
        ),

        'join_uid'      => array
        (
            'type'      => 'int-11',
            'name'      => '参加人名称/手机号',
            'default'   => '-1',
            'desc'      => '用户名称',
            'match'     => 'is_string',
            // 'option'    => $user,
            // 'update'    => 'text',
            'search'    => array
            (
                'api' => 'active/user-getSearch',
                'col' => 'col',
                'result' => 'id',
                'search' => 'mid',
            ),
            'list_name' => '参加人信息',
            'list'      => "Dever::load('active/lib/manage.user',{join_uid})",
        ),

        'write_code'      => array
        (
            'type'      => 'varchar-200',
            'name'      => '核销码',
            'default'   => '',
            'desc'      => '核销码',
            'match'     => 'is_string',
            // 'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
        ),

        'pic'       => array
        (
            'type'      => 'text-255',
            'name'      => '二维码',
            'default'   => '',
            'desc'      => '二维码',
            'match'     => 'option',
            // 'update'    => 'image',
            'key'       => '1',
            // 'place'     => '759*562',
        ),

        'content'       => array
        (
            'type'      => 'text-255',
            'name'      => '填写手机号-多个换行隔开，如手机号重复将不会录入到库中',
            'default'   => '',
            'desc'      => '填写手机号',
            'match'     => 'is_string',
            'update'    => 'textarea',
            'value'     => '',
            // 'show'      => 'type=2',
        ),

        '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,
            'search'    => 'day',
            'list'      => 'date("Y-m-d H:i:s", {cdate})',
            'list_order' => 5,
        ),
    ),

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

    'request' => array
    (
        'getOne' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'join_uid' => 'yes',
                'active_id' =>'yes',
                'status' => array('yes','in'),
                'state' => 1,
            ),
            'type' => 'one',
            // 'order' => array('cdate' => 'desc'),
            'col' => '*',
        ),
        'getAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'join_uid' => array('yes','>='),
                // 'active_id' =>'yes',
                // 'status' => array('yes','in'),
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('cdate' => 'desc'),
            'col' => '*',
        ),
    ),
);
