123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793 |
- <?php
- $status = Dever::config('base')->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('<br />'),
- //'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;
|