audit; $status = array ( 1 => '上架', 2 => '下架', ); # 常用的col $col = 'id,name,pic_cover,num_add_view+num_view as num_view,content,`desc`'; return array ( # 表名 'name' => 'service', # 显示给用户看的名称 'lang' => '服务咨询', 'order' => 99, # 数据结构 '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', ), 'phone' => array ( 'type' => 'varchar-80', 'name' => '咨询电话', 'default' => '', 'desc' => '咨询电话', 'match' => 'is_string', 'update' => 'text', ), 'desc' => array ( 'type' => 'varchar-500', 'name' => '摘要', 'default' => '', 'desc' => '摘要', 'match' => 'is_string', 'update' => 'textarea', ), 'pic_cover' => array ( 'type' => 'varchar-150', 'name' => '1:1封面图-图片尺寸380*380px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => '封面图', 'match' => 'is_string', 'update' => 'image', 'key' => '1', 'place' => '150', //直接上传到云端 //'upload' => 'qiniu', //上传大数据 //'large' => true, ), 'num_add_view' => array ( 'type' => 'int-11', 'name' => '浏览量基数', 'default' => '0', 'desc' => '浏览量基数', 'match' => 'option', //'update' => 'text', ), 'num_view' => array ( 'type' => 'int-11', 'name' => '浏览量', 'default' => '0', 'desc' => '请填写浏览量', 'match' => 'option', 'search' => 'order', 'list' => '{num_view}+{num_add_view}', ), 'buy_add_view' => array ( 'type' => 'int-11', 'name' => '购买基数', 'default' => '0', 'desc' => '购买基数', 'match' => 'option', //'update' => 'text', ), 'buy_view' => array ( 'type' => 'int-11', 'name' => '购买量', 'default' => '0', 'desc' => '购买量', 'match' => 'option', 'search' => 'order', 'list' => '{buy_view}+{buy_add_view}', ), 'pdate' => array ( 'type' => 'int-11', 'name' => '发布时间', 'match' => array('is_numeric', time()), 'default' => '', 'desc' => '', 'update' => 'date', 'callback' => 'maketime', 'insert' => true, //'list' => 'date("Y-m-d H:i:s", {pdate})', 'auth' => '"{pdate}" > 0', ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序(数值越大越靠前)', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', 'update' => 'text', 'search' => 'order', 'list' => true, 'order' => 'desc', 'edit' => true, ), 'content' => array ( 'type' => 'text-255', 'name' => '内容', 'default' => '', 'desc' => '请输入内容', 'match' => 'is_string', 'update' => 'editor', 'key' => '1', //'media' => '5',//下面的音视频已经做到了 //直接上传到云端 //'upload' => 'qiniu', //上传大数据 //'large' => true, //自定义编辑器右侧按钮 /* 'editor' => array ( 'name' => '选择插入模块', 'button' => array ( array ( # 名称 'name' => '图片', # 资源库id 'key' => 1, # 类型 'type' => 'image', ), array ( 'name' => '音频', 'key' => 5, 'type' => 'media', ), array ( 'name' => '视频', 'key' => 'video/lib/core.vod', ), array ( 'name' => '直播', 'key' => 'video/lib/core.live', ), array ( 'name' => '小程序', 'key' => 'content/lib/applet.update', 'type' => 'update', ), ), ), */ ), 'status' => array ( 'type' => 'int-11', 'name' => '状态', 'default' => '1', 'desc' => '状态', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $status, ), '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, ), ), # 管理功能 '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', 'pdate' => 'desc'), 'limit' => '0,1000', 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id', ), 'getAll' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc','pdate' => 'desc'), 'page' => array(10, 'list'), 'col' => $col, ), 'getList' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc','pdate' => 'desc'), 'limit' => '0,10', 'col' => $col, ), 'getRelation' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'noid' => array('yes-id', '!='), 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc','pdate' => 'desc'), 'limit' => '0,4', 'col' => $col, ), 'getOne' => array ( # 匹配的正则或函数 选填项 'where' => array ( 'id' => 'yes', ), 'type' => 'one', 'col' => $col, ), # 更新浏览量 'addView' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'num_view' => array('1', '+='), ), ), ), );