<?php
# 获取小刊分类权限
$auth = Dever::tops();
$cate = function() use ($auth)
{
    $array = array();
    if ($auth) {
        $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
    } else {
        $info = Dever::db('journal/cate')->state();
    }
    if($info)
    {
        $array += $info;
    }
    return $array;
};
return array
(
    # 表名
    'name' => 'member',
    # 显示给用户看的名称
    'lang' => '会员管理',
    # 后台菜单排序
    'order' => 20,
    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'list'      => true,
            'order'     => 'desc',
        ),

        'uid'       => array
        (
            'type'      => 'int-11',
            'name'      => '购买者用户名',
            'default'   => '',
            'desc'      => '购买者用户名',
            'match'     => 'is_numeric',
            'search'    => array
            (
                'api' => 'passport/user-all',
                'col' => 'username',
                'result' => 'id',
            ),
            'update'    => 'text',
        ),
        
        'mobile'        => array
        (
            'type'      => 'varchar-300',
            'name'      => '手机号',
            'default'   => '',
            'desc'      => '手机号',
            'match'     => 'option',
            //'show'        => 'status=5'
            'search'    => 'fulltext',
            'list'		=> true,
            'update'    => 'text',
        ),
        
        'start'       => array
        (
            'type'      => 'int-11',
            'default'   => '',
            'name'      => '开始时间',
            'match'     => 'is_numeric',
            'desc'      => '开始时间',
            'update'    => 'date',
            'list'      => 'date("Y-m-d H:i:s", {start})',
            'callback'  => 'maketime',
        ),

        'end'       => array
        (
            'type'      => 'int-11',
            'default'   => '',
            'name'      => '结束时间',
            'match'     => 'is_numeric',
            'desc'      => '结束时间',
            'update'    => 'date',
            'list'      => 'date("Y-m-d H:i:s", {end})',
            'callback'  => 'maketime',
        ),

        'cate_id'       => array
        (
            'type'      => 'int-11',
            'name'      => '小刊分类',
            'default'   => '1',
            'desc'      => '小刊分类',
            'match'     => 'is_numeric',
            'update'    => 'select',
            'option'    => $cate,
            //'search'    => 'select',
            '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'      => '',
            # 只有insert时才生效
            //'insert'    => true,
            'list'      => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),

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

    # 增加这个,为了给当前的list增加一个option
    'top_option' => array
    (
        'value' => $auth,
        'col' => 'cate_id',
    ),

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

    'request' => array
    (
        
    ),
);