status; $price_type = array ( 1 => '普通商品', 2 => '多价商品', //3 => '套餐商品', 4 => '组合商品', ); $sell_type = array ( 1 => '可售卖', 2 => '不可售卖', ); $buy_type = array ( 1 => '可采购', 2 => '不可采购', ); $mode = array ( 1 => '自提', 2 => '外送', 3 => '以上全支持', ); $yes = array ( 1 => '是', 2 => '否', ); $sku_type = array ( 1 => '库存不足时不显示商品', 2 => '库存不足时显示商品', ); $column = function() { $array = array(); $info = Dever::load('goods/column-state'); if($info) { $array += $info; } return $array; }; $tag = function() { $array = array(); $info = Dever::load('goods/tag-state'); if($info) { $array += $info; } return $array; }; $config = array ( # 表名 'name' => 'info', # 显示给用户看的名称 'lang' => '商品列表', 'order' => 200, 'auto' => 10000000, 'start' => array ( 'update_status' => 'goods/lib/manage.statusUpdate', ), 'end' => array ( 'insert' => 'goods/lib/manage.infoUpdate', 'update' => 'goods/lib/manage.infoUpdate', 'update_status' => 'goods/lib/manage.infoUpdate', ), # 同步更新另外一个或多个表的数据,将数据同步到关联表中 'sync' => array ( 'goods/info_category' => array ( # 更新另外一个表的字段 => 本表的字段 'where' => array('info_id', 'id'), # 要更新的数据 'update' => array('category_id' => 'category'), # 同步更新的类型,delete为先删再插入,update为直接更新 'type' => 'delete', ), 'goods/info_column' => array ( # 更新另外一个表的字段 => 本表的字段 'where' => array('info_id', 'id'), # 要更新的数据 'update' => array('column_id' => 'column_id'), # 同步更新的类型,delete为先删再插入,update为直接更新 'type' => 'delete', ), 'goods/info_tag' => array ( # 更新另外一个表的字段 => 本表的字段 'where' => array('info_id', 'id'), # 要更新的数据 'update' => array('tag_id' => 'tag_id'), # 同步更新的类型,delete为先删再插入,update为直接更新 'type' => 'delete', ) ), # 数据结构 不同的字段放这里 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', //'list' => true, ), 'name' => array ( 'type' => 'varchar-800', 'name' => '商品名称', 'default' => '', 'desc' => '商品名称', 'match' => 'is_string', 'update' => 'textarea', 'search' => 'fulltext', //'list' => true, //'edit' => true, ), 'sell_type' => array ( 'type' => 'int-11', 'name' => '售卖类型', 'default' => '1', 'desc' => '售卖类型', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $sell_type, 'control' => 'sell_type', ), 'buy_type' => array ( 'type' => 'int-11', 'name' => '采购类型', 'default' => '1', 'desc' => '采购类型', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $buy_type, ), 'column_id' => array ( 'type' => 'varchar-8000', 'name' => '售卖栏目', 'default' => '', 'desc' => '售卖栏目', 'match' => 'option', 'update' => 'checkbox', 'option' => $column, //'list' => true, ), 'category' => array ( 'type' => 'varchar-500', 'name' => '属性规格分类', 'default' => '', 'desc' => '属性规格分类', 'match' => 'is_string', 'search' => 'linkage', 'update' => 'linkage', 'option' => Dever::url('api.get', 'category'), //'list' => 'Dever::load("category/api.string", "{category}")', ), # 以下几个分类其实在关联表中已经有了,放到这里是为了查询方便,一般只有三级分类,多了就从关联表查询吧 'top_category_id' => array ( 'type' => 'int-11', 'name' => '顶级分类ID-顶级分类,用于分类查询', 'default' => '-1', 'desc' => '顶级分类ID', 'match' => 'is_numeric', ), 'second_category_id' => array ( 'type' => 'int-11', 'name' => '二级分类ID-二级分类,用于分类查询', 'default' => '-1', 'desc' => '二级分类ID', 'match' => 'is_numeric', ), 'category_id' => array ( 'type' => 'int-11', 'name' => '子分类ID-最后一个级别的分类,用于分类查询', 'default' => '-1', 'desc' => '子分类ID', 'match' => 'is_numeric', ), 'tax' => array ( 'type' => 'varchar-80', 'name' => '商品税点-输入数字,自动计算百分比,如10,就是10%税点', 'default' => '', 'desc' => '商品税点', 'match' => 'option', 'update' => 'text', //'list' => true, ), 'sku_type' => array ( 'type' => 'int-11', 'name' => '商品库存', 'default' => '1', 'desc' => '商品库存', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $sku_type, //'list' => true, //'edit' => true, ), 'tag_id' => array ( 'type' => 'varchar-800', 'name' => '商品标签', 'default' => '', 'desc' => '标签', 'match' => 'option', 'update' => 'checkbox', 'option' => $tag, //'list' => true, ), 'area' => array ( 'type' => 'int-11', 'name' => '所在地区', 'default' => '', 'desc' => '所在地区', 'match' => 'is_string', //'search' => 'linkage', //'update' => 'linkage', //'option' => Dever::url('api.get?level_total=1', 'area'), //'list' => 'Dever::load("area/api.string", "{goods_area}")', ), 'mode' => array ( 'type' => 'int-11', 'name' => '取货形式', 'default' => '1', 'desc' => '取货形式', 'match' => 'is_numeric', //'update' => 'radio', 'option' => $mode, ), 'price_type' => array ( 'type' => 'int-11', 'name' => '商品类型-套餐商品由多个普通商品组成,可以单独定义库存,组合商品也由多个普通商品组成的,但库存无法自定义', 'default' => '1', 'desc' => '价格类型', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $price_type, 'control' => 'price_type', ), 'sku_id' => array ( 'type' => 'int-11', 'name' => 'sku_id', 'default' => '-1', 'desc' => 'sku_id', 'match' => 'is_numeric', ), 'code' => array ( 'type' => 'varchar-100', 'name' => '商品条码号', 'default' => '', 'desc' => '商品条码号', 'match' => 'is_string', //'update' => 'text', //'search' => 'fulltext', //'list' => true, ), 'price' => array ( 'type' => 'varchar-100', 'name' => '销售价', 'default' => '', 'desc' => '销售价', 'match' => 'option', //'update' => 'text', 'show' => 'price_type=1', ), 's_price' => array ( 'type' => 'varchar-100', 'name' => '市场价', 'default' => '', 'desc' => '市场价', 'match' => 'option', //'update' => 'text', 'show' => 'price_type=1', ), 'f_price' => array ( 'type' => 'varchar-100', 'name' => '门店采购价', 'default' => '', 'desc' => '采购价', 'match' => 'option', //'update' => 'text', 'show' => 'price_type=1', ), 'c_price' => array ( 'type' => 'varchar-100', 'name' => '成本价', 'default' => '', 'desc' => '成本价', 'match' => 'option', //'update' => 'text', //'list' => true, ), 'min' => array ( 'type' => 'int-11', 'name' => '起购数', 'default' => '1', 'desc' => '起购数', 'match' => 'is_string', //'update' => 'text', //'list' => true, ), 'unit' => array ( 'type' => 'varchar-100', 'name' => '计量单位', 'default' => '', 'desc' => '计量单位', 'match' => 'is_string', //'update' => 'text', //'list' => true, ), 'weight' => array ( 'type' => 'varchar-100', 'name' => '重量', 'default' => '', 'desc' => '重量', 'match' => 'is_string', //'update' => 'text', //'list' => true, ), 'goods' => array ( 'type' => 'text-1000', 'name' => '套餐商品配置-套餐和组合商品只可以选择普通商品', 'default' => '', 'desc' => '套餐商品配置', 'match' => 'is_string', 'show' => 'price_type=3,4', 'update' => array ( array ( 'col' => 'goods_id', 'name' => '选择商品', 'default' => '', 'desc' => '选择商品', 'match' => 'option', 'update' => 'select', 'update_search' => 'goods/lib/manage.search?price_type=1', ), array ( 'col' => 'num', 'name' => '数量', 'default' => '1', 'desc' => '数量', 'match' => 'is_string', 'update' => 'text', ), ), ), 'cover' => array ( 'type' => 'varchar-150', 'name' => '封面图-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪', 'default' => '', 'desc' => '封面图', 'match' => 'is_string', 'update' => 'image', 'key' => '1', 'place' => '300*300', 'list_name' => '商品详情', 'list' => 'Dever::load("goods/lib/manage.info", "{id}")', 'list_header' => array('width' => '60%'), ), 'video' => array ( 'type' => 'varchar-800', 'name' => '视频-视频格式mp4,上传大小不能超过4G', 'default' => '', 'desc' => '视频', 'match' => 'option', 'update' => 'video', 'key' => '3', 'place' => '150', 'upload' => 'yun', 'large' => true, //'cover' => 'pic',//封面图字段名 ), 'pic' => array ( 'type' => 'text-255', 'name' => '多张图片-图片尺寸759*562px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪', 'default' => '', 'desc' => '多张图片', 'match' => 'is_string', 'update' => 'images', 'key' => '1', 'place' => '759*562', ), 'hot' => array ( 'type' => 'int-11', 'name' => '是否热门商品', 'default' => '2', 'desc' => '是否热门商品', 'match' => 'is_numeric', //'update' => 'radio', 'option' => $yes, //'list' => true, //'edit' => true, ), 'top' => array ( 'type' => 'int-11', 'name' => '是否推荐商品', 'default' => '2', 'desc' => '是否推荐商品', 'match' => 'is_numeric', //'update' => 'radio', 'option' => $yes, //'list' => true, //'edit' => true, ), 'youhui' => array ( 'type' => 'int-11', 'name' => '是否每日优惠', 'default' => '2', 'desc' => '是否每日优惠', 'match' => 'is_numeric', //'update' => 'radio', 'option' => $yes, //'list' => true, //'edit' => true, ), 'content' => array ( 'type' => 'text-800', 'name' => '内容介绍', 'default' => '', 'desc' => '内容介绍', 'match' => 'is_string', 'update' => 'editor', 'key' => '1', ), 'status' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '2', 'desc' => '状态', 'match' => 'is_numeric', //'update' => 'radio', 'option' => $status, 'search' => 'select', 'list' => true, 'edit' => true, 'mul' => true, ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序-数值越大越靠前,相当于置顶', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', //'update' => 'text', 'search' => 'order', 'list' => true, 'order' => 'desc', 'edit' => true, ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '数据状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', ), 'udate' => array ( 'type' => 'int-11', 'name' => '更新时间', 'match' => array('is_numeric', time()), 'desc' => '', ), 'cdate' => array ( 'type' => 'int-11', 'name' => '发布时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, 'search' => 'date', //'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), # 索引 'index' => array ( 1 => array ( 'search' => 'category,top_category_id,second_category_id,category_id,mode,area', ), # 版本号 更改版本号会更新当前表的索引 'version' => 1, ), # 管理功能 'manage' => array ( // 载入自定义资源 路径可以配置在config里。这里没有写路径。demo.css 'res' => array ( //'css' => 'demo', ), //'insert' => false, //'delete' => false, 'mul' => true, # 自定义快捷新增和编辑 'button' => array ( //'类别管理' => array('list', 'cate&project=demand&search_option_key=cate&search_option_tablename=类别&oper_parent=info&oper_project=demand'), ), # 表格使用html模式,默认是js渲染模式 'list_table' => 'html', # 列表里的按钮 'list_button' => array ( 'update' => array('编辑', 'info'), 'fast' => array('属性设置', '"info_attr&project=goods&search_option_info_id={id}&search_option_category={category}&oper_parent=info&oper_project=goods&oper_save_jump=info&where_id={id}"', '{price_type} == 2'), 'fast_list' => array('价格设置', '"info_sku&project=goods&goods_id={id}&page_type=1"', '{price_type} > 0'), 'list2' => array('价格模板', '"goods&project=price&search_option_goods_id={id}&oper_table=info&oper_project=goods"', '{price_type} > 0'), 'br1' => array('
'), //'delete' => '删除', ), ), 'alter' => array ( 2 => array ( array('update', 'price', 'price', 'varchar-100 0 销售价'), array('update', 's_price', 's_price', 'varchar-100 0 市场价'), array('update', 'f_price', 'f_price', 'varchar-100 0 采购价'), ), 'version' => 2, ), # request 请求接口定义 'request' => array ( 'getAllByName' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'id' => array('yes', 'in'), 'name' => array('yes', 'like'), 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'col' => '*,name as value,name as label|id', ), # 后台搜索用到 也可以不加,自动生成 'search' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'ids' => array('yes-id', 'in'), 'name' => array('yes', 'like'), 'price_type' => 'yes', 'id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'limit' => '0,10', 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id', ), # 获取一条数据 'getOne' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'one', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'col' => '*', ), # 推荐列表 'getTop' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'hot' => 'yes', 'top' => 'yes', 'youhui' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'limit' => '0,6', 'col' => '*,id as goods_id', ), # 列表 'getAll' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'audit' => 2, 'category' => array('yes', 'like'), 'top_category_id' => 'yes', 'second_category_id' => 'yes', 'category_id' => 'yes', //'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'limit' => '0,10', //'page' => array(10, 'list'), 'col' => '*', ), # 列表 'getData' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'price_type' => array('yes', 'in'), 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), //'limit' => '0,10', //'page' => array(10, 'list'), 'col' => '*', ), # 分页 'getPageAll' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'shop_id' => 'yes', 'brand_id' => 'yes', 'name' => array('yes', 'like'), 'column_id' => array('yes', 'like'), 'category' => array('yes', 'like'), 'top_category_id' => 'yes', 'second_category_id' => 'yes', 'category_id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'page' => array(10, 'list'), 'col' => '*', ), # 更新售出量 'updateSell' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'sell_num' => array('yes', '+='), ), ), 'like' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'name' => array('yes', 'like'), 'id' => 'yes', //'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'col' => '*|id', ), ), ); return $config;