| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 | <?php$time = time();$status = array(    1 => '已发布',    2 => '未发布',);$top = array(    1 => '不推荐',    2 => '首页推荐',);$type = array(    1 => '资讯',    2 => '专题',    3 => '视频',    4 => '活动',);$type_value = Dever::input('search_option_type', 1);$name = $type[$type_value];return array(    # 表名    'name' => 'news',    # 显示给用户看的名称    'lang' => $name . '管理',    'order' => 98,    'end' => array    (        //'insert' => 'tag/api.update',        //'update' => 'tag/api.update',    ),    # 数据结构    'struct' => array    (        'id'        => array        (            'type'      => 'int-11',            'name'      => 'ID',            'default'   => '',            'desc'      => '',            'match'     => 'is_numeric',            'list'      => true,        ),        'type'        => array        (            'type'      => 'int-11',            'name'      => '类型',            'default'   => '1',            'desc'      => '类型',            'match'     => 'is_numeric',            'update'    => 'hidden',            'value'    => $type_value,            'search'    => 'hidden',        ),                'name'      => array        (            'type'      => 'varchar-80',            'name'      => '主标题-最大长度50个字符',            'default'   => '',            'desc'      => '主标题',            'match'     => 'is_string',            'update'    => 'text',            'list'      => true,            'search'    => 'fulltext',        ),        'desc'      => array        (            'type'      => 'varchar-50',            'name'      => '副标题-最大长度50个字符',            'default'   => '',            'desc'      => '副标题',            'match'     => 'is_string',            'update'    => 'text',            'list'      => true,            'search'    => 'fulltext',        ),        'info'      => array        (            'type'      => 'varchar-500',            'name'      => '简介-最大长度100个字符',            'default'   => '',            'desc'      => '简介',            'match'     => 'is_string',            'update'    => 'textarea',        ),        'author'      => array        (            'type'      => 'varchar-50',            'name'      => '作者-最大长度20个字符',            'default'   => '',            'desc'      => '作者',            'match'     => 'is_string',            'update'    => 'text',            'list'      => true,            'search'    => 'fulltext',        ),        'pic'       => array        (            'type'      => 'varchar-150',            'name'      => '封面图-图片尺寸1200*500px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',            'default'   => '',            'desc'      => '封面图',            'match'     => 'is_string',            'update'    => 'image',            'key'       => '1',            'place'     => '1200*500',        ),        'small_pic'       => array        (            'type'      => 'varchar-150',            'name'      => '封面小图-图片尺寸270*363px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',            'default'   => '',            'desc'      => '封面图',            'match'     => $type_value == 4 ? 'is_string' : 'option',            'update'    => $type_value == 4 ? 'image' : 'hidden',            'key'       => '1',            'place'     => '270*363',        ),        'video'     => array        (            'type'      => 'varchar-800',            'name'      => '上传视频-视频格式mp4,上传大小不能超过4G,如果上传了视频,上述封面图将作为视频封面',            'default'   => '',            'desc'      => '上传推荐视频',            'match'     => 'option',            'update'    => 'upload',            'key'       => '3',            'place'     => '150',            'upload'    => 'yun',            'large'     => true,        ),        'tag_name'       => array        (            'type'      => 'varchar-100',            'name'      => '标签标题',            'default'   => '',            'desc'      => '标签标题',            'match'     => 'option',            'update'    => 'text',        ),        'tag'       => array        (            'type'      => 'varchar-1000',            'name'      => '标签-多个用半角逗号,隔开',            'default'   => '',            'desc'      => '标签',            'match'     => 'option',            'update'    => 'text',            //如果要输入带有自动提示的,就打开这个,update=>'text'即可            //'autocomplete' => array('tag/manage.getByName', 'id', 'tag/info-one#name'),            //'list'        => true,            //显示            //'show'  => 'cate=tag/manage.getByCate?cate=',        ),        'share_title'       => array        (            'type'      => 'varchar-100',            'name'      => '分享标题',            'default'   => '',            'desc'      => '分享标题',            'match'     => 'option',            'update'    => 'text',        ),        'share_pic'     => array        (            'type'      => 'varchar-150',            'name'      => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',            'default'   => '',            'desc'      => '分享图片',            'match'     => 'option',            'update'    => 'image',            'key'       => '1',            'place'     => '150',            //'upload'  => 'qiniu',            //'large'   => true,        ),        'share_content'     => array        (            'type'      => 'varchar-200',            'name'      => '分享内容',            'default'   => '',            'desc'      => '分享内容',            'match'     => 'option',            'update'    => 'textarea',        ),        'content'       => array        (            'type'      => 'text-255',            'name'      => '内容',            'default'   => '',            'desc'      => '请输入内容',            'match'     => 'is_string',            'update'    => 'editor',            'key'       => '1',        ),        'beizhu'      => array        (            'type'      => 'varchar-500',            'name'      => '备注',            'default'   => '',            'desc'      => '备注',            'match'     => 'option',            'update'    => 'textarea',        ),        'pdate'     => array        (            'type'      => 'int-11',            'name'      => '发布时间-选择未来时间将不会显示',            'match'     => 'option',            'default'   => '',            'desc'      => '',            'update'    => 'date',            'callback'  => 'maketime',            //'list'        => 'date("Y-m-d H:i:s", {pdate})',        ),        'reorder'       => array        (            'type'      => 'int-11',            'name'      => '排序(数值越大越靠前)',            'default'   => '1',            'desc'      => '请输入排序',            'match'     => 'option',            //'update'  => 'text',            'search'    => 'order',            'list'      => true,            'order'     => 'desc',            'edit'      => true,        ),        'top'        => array        (            'type'      => 'int-11',            'name'      => '是否推荐到首页',            'default'   => '1',            'desc'      => '是否推荐到首页',            'match'     => 'is_numeric',            'update'  => 'select',            'option'    => $top,            'search'    => 'select',            'list'      => true,            '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,            //'search'    => 'time',        ),    ),        # 管理功能    'manage' => array    (    ),    # request 请求接口定义    'request' => array    (        'search' => array        (            # 匹配的正则或函数 选填项            'option' => array            (                'ids' => array('yes-id', 'in'),                'name' => array('yes', 'like'),                'id' => 'yes',                'type' => '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',        ),        'getHome' => array        (            # 匹配的正则或函数 选填项            'option' => array            (                'ids' => array('yes-id', 'in'),                'name' => array('yes', 'like'),                'pdate' => array($time, '<='),                'id' => 'yes',                'type' => 'yes',                'status' => 1,                'state' => 1,            ),            'type' => 'all',            'order' => array('top' => 'desc', 'reorder' => 'desc', 'cdate' => 'desc'),            'limit' => '0,10',            'col' => '*',        ),        'getOne' => array        (            # 匹配的正则或函数 选填项            'option' => array            (                'ids' => array('yes-id', 'in'),                'name' => array('yes', 'like'),                'pdate' => array($time, '<='),                'id' => 'yes',                'type' => 'yes',                'status' => 1,                'state' => 1,            ),            'type' => 'one',            'col' => '*',        ),        'getAll' => array        (            # 匹配的正则或函数 选填项            'option' => array            (                'type' => 'yes',                'name' => array('yes', 'like', 'and('),                'tag' => array('yes', 'like', 'or)'),                'pdate' => array($time, '<='),                'status' => 1,                'state' => 1,            ),            'type' => 'all',            'order' => array('reorder' => 'desc', 'id' => 'desc'),            'page' => array(10, 'list'),            'col' => '*',        ),    ),);
 |