123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643 |
- <?php
- $status = array
- (
- 1 => '上架',
- 2 => '下架',
- );
- $id = Dever::input('where_id');
- $unit = function()
- {
- $array = array();
- $data = Dever::load('product/unit-state');
- if($data)
- {
- $array += $data;
- }
- return $array;
- };
- $type = array
- (
- 1 => '实物商品',
- 2 => '虚拟商品',//虚拟商品可以通过分类设置
- //3 => '功能商品',//对应道具市场
- 11 => '套餐商品',
- 12 => '组合商品',
- );
- $pay_money = array
- (
- 1 => '法定货币',
- 2 => '积分',
- );
- $money = function()
- {
- $array = array();
- $data = Dever::load('account/money-state');
- if($data)
- {
- $array += $data;
- }
- return $array;
- };
- $score = function()
- {
- $array = array();
- $data = Dever::load('score/config-state');
- if($data)
- {
- $array += $data;
- }
- return $array;
- };
- $sell_type = array
- (
- 1 => '可售卖',
- 2 => '不可售卖',
- );
- $buy_type = array
- (
- 1 => '可采购',
- 2 => '不可采购',
- );
- $stock = array
- (
- 1 => '是',
- 2 => '否',
- );
- $config = array
- (
- # 表名
- 'name' => 'info',
- # 显示给用户看的名称
- 'lang' => '商品资料',
- 'order' => 200,
- 'auto' => 10000000,
- 'set' => array
- (
- 'status' => $status,
- ),
- 'start' => array
- (
- 'insert' => 'product/lib/manage.check',
- 'update' => 'product/lib/manage.check',
- ),
- 'end' => array
- (
- 'insert' => 'product/lib/manage.infoUpdate',
- 'update' => 'product/lib/manage.infoUpdate',
- ),
- # 同步更新另外一个或多个表的数据,将数据同步到关联表中
- 'sync' => array
- (
- 'product/info_category' => array
- (
- # 更新另外一个表的字段 => 本表的字段
- 'where' => array('info_id', 'id'),
- # 要更新的数据
- 'update' => array('category_id' => 'category'),
- # 同步更新的类型,delete为先删再插入,update为直接更新
- 'type' => 'delete',
- )
- ),
- # 数据结构 不同的字段放这里
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => '商品编码',
- '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,
- ),
- 'unit' => array
- (
- 'type' => 'int-11',
- 'name' => '商品单位',
- 'default' => '',
- 'desc' => '商品单位',
- 'match' => 'is_numeric',
- 'search' => 'select',
- 'lang' => '请选择',
- 'update' => 'select',
- 'option' => $unit,
- 'option_add' => array('[添加新单位]', 'product/lib/unit.add'),
- 'tab' => 1,
- ),
- 'type' => array
- (
- 'type' => 'int-11',
- 'name' => '商品类型-套餐商品和组合商品都是由多个商品组成,区别是组合商品的库存由组成的商品的最少库存决定,套餐商品可以单独设置库存',
- 'default' => '1',
- 'desc' => '商品类型',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $type,
- 'search' => 'select',
- 'list' => true,
- 'tab' => 1,
- 'control' => 'type',
- ),
- 'goods' => array
- (
- 'type' => 'text-1000',
- 'name' => '商品配置-套餐和组合商品可以选择多个套餐或者组合内的商品',
- 'default' => '',
- 'desc' => '商品配置',
- 'match' => 'is_string',
- 'show' => 'type=11,12',
- 'update' => array
- (
- array
- (
- 'col' => 'goods_id',
- 'name' => '选择商品',
- 'default' => '',
- 'desc' => '选择商品',
- 'match' => 'option',
- 'update' => 'select',
- 'update_search' => 'product/lib/manage.searchProduct?{id}',
- ),
- array
- (
- 'col' => 'num',
- 'name' => '数量',
- 'default' => '1',
- 'desc' => '数量',
- 'match' => 'is_string',
- 'update' => 'text',
- ),
- ),
- 'tab' => 1,
- ),
- 'stock' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '是否有库存',
- 'default' => '1',
- 'desc' => '是否有库存',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $stock,
- 'tab' => 1,
- ),
- 'sell_type' => array
- (
- 'type' => 'int-11',
- 'name' => '售卖类型',
- 'default' => '1',
- 'desc' => '售卖类型',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $sell_type,
- 'control' => 'sell_type',
- 'tab' => 1,
- ),
- 'buy_type' => array
- (
- 'type' => 'int-11',
- 'name' => '采购类型',
- 'default' => '1',
- 'desc' => '采购类型',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $buy_type,
- 'control' => 'buy_type',
- 'tab' => 1,
- ),
- 'pay_money' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '支付货币-默认用该货币购买商品',
- 'default' => '1',
- 'desc' => '支付货币',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $pay_money,
- 'search' => 'select',
- //'list' => true,
- 'tab' => 1,
- 'control' => 'pay_money',
- ),
- 'money_id' => array
- (
- 'type' => 'int-11',
- 'name' => '法定货币',
- 'default' => '',
- 'desc' => '法定货币',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $money,
- 'tab' => 1,
- 'show' => 'pay_money=1',
- ),
- 'score_id' => array
- (
- 'type' => 'int-11',
- 'name' => '积分',
- 'default' => '',
- 'desc' => '积分',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $score,
- 'tab' => 1,
- 'show' => 'pay_money=2',
- ),
- 'commission' => array
- (
- 'type' => 'varchar-20',
- 'name' => '销售商佣金-设置佣金之后,销售商销售了商品,能得到的相应佣金,也可以在销售商里单独设置,填写10%就是销售价的百分之10,直接填写数字就是佣金数额',
- 'default' => '0',
- 'desc' => '销售商佣金',
- 'match' => 'is_string',
- 'update' => 'text',
- 'tab' => 1,
- ),
- 'category' => array
- (
- 'type' => 'varchar-500',
- 'name' => '属性分类',
- 'default' => '',
- 'desc' => '分类',
- 'match' => 'is_string',
- 'search' => 'linkage',
- //'update' => $id ? false : 'linkage',
- 'update' => 'linkage',
- 'option' => Dever::url('lib/category.get?type=1', 'product'),
- //'update' => 'radio',
- //'option' => Dever::db('product/category')->select(),
- 'list' => 'Dever::load("product/lib/category.string", "{category}")',
- 'load' => 'product-info_attr',
- 'tab' => 2,
- ),
- 'product-info_attr'=> array
- (
- 'name' => '属性设置',
- 'default' => '',
- 'desc' => '请先选择属性分类',
- 'match' => 'option',
- # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
- 'sync' => array('id', 'info_id'),
- # 根据category字段的值,获取product/attr.search接口的内容
- 'update' => 'load',
- 'update_load' => array('product/lib/attr.getManageByCate', 'category'),
- 'tab' => 2,
- ),
- 'product-info_spec'=> array
- (
- 'name' => '规格设置-成本价为平台进货成本价格,采购价为销售商采购商品价格,销售价为用户购买价格,划线价为用户购买价的划线价格',
- 'default' => '',
- 'desc' => '规格设置',
- 'match' => 'option',
- 'sync' => array('id', 'info_id'),
- 'update' => 'sku',
- 'tab' => 3,
- ),
- 'spec_type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '规格类型',
- 'default' => '1',
- 'desc' => '规格类型',
- 'match' => 'is_numeric',
- //'update' => 'select',
- 'option' => array(1 => '单规格', 2 => '多规格'),
- ),
- # 以下几个分类其实在关联表中已经有了,放到这里是为了查询方便,一般只有三级分类,多了就从关联表查询吧
- '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',
- ),
- 'pic' => array
- (
- 'type' => 'text-255',
- 'name' => '商品主图-图片尺寸500*500px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
- 'default' => '',
- 'desc' => '多张图片',
- 'match' => 'option',
- 'update' => 'images',
- 'key' => '1',
- 'place' => '500*500',
- ),
- 'video' => array
- (
- 'type' => 'varchar-800',
- 'name' => '商品视频-视频格式mp4,上传大小不能超过4G',
- 'default' => '',
- 'desc' => '商品视频',
- 'match' => 'option',
- 'update' => 'video',
- 'key' => '3',
- 'place' => '150',
- 'upload' => 'yun',
- 'large' => true,
- //'cover' => 'pic',//封面图字段名
- ),
- 'status' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '状态',
- 'match' => 'is_numeric',
- //'update' => 'select',
- 'option' => $status,
- 'search' => 'select',
- 'list' => true,
- 'edit' => true,
- ),
- '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-800',
- 'name' => '商品介绍',
- 'default' => '',
- 'desc' => '商品介绍',
- 'match' => 'is_string',
- 'update' => 'editor',
- 'key' => '1',
- ),
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '数据状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- ),
- 'udate' => array
- (
- 'type' => 'int-11',
- 'name' => '更新时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- 'search' => 'date',
- ),
- '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',
- ),
-
- # 版本号 更改版本号会更新当前表的索引
- 'version' => 1,
- ),
-
- # 管理功能
- 'manage' => array
- (
- # 定义sku对应的表,不填写则默认为info_spec和info_sku
- 'sku' => array
- (
- # 定义表名
- 'spec' => 'info_spec',
- 'sku' => 'info_sku',
- # 定义字段
- 'col' => array
- (
- 'pic' => array('name' => '图片', 'verify' => 'string', 'type' => 'image'),
- 'code' => array('name' => '商品编码', 'verify' => 'string', 'type' => 'input'),
- 'cost_price' => array('name' => '成本价', 'verify' => 'number', 'type' => 'input'),
- 'buy_price' => array('name' => '采购价', 'verify' => 'number', 'type' => 'input'),
- 'price' => array('name' => '销售价', 'verify' => 'number', 'type' => 'input'),
- 'un_price' => array('name' => '划线价', 'verify' => 'number', 'type' => 'input'),
- ),
- # 接口
- 'api' => array
- (
- 'spec' => 'product/lib/spec.get',
- 'sku' => 'product/lib/sku.get',
- # 上传接口
- 'upload' => 'upload/save.start?key=1',
- ),
- ),
- 'tab' => 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'),
- ),
- # 列表里的按钮
- /*
- 'list_button' => array
- (
- 'add' => 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}"'),
- 'list' => array('规格', '"info_sku
- &project=goods
- &search_option_info_id={id}
- &oper_parent=info&oper_project=goods
- &oper_save_jump=info&page_type=1"'),
- ),*/
- ),
- # request 请求接口定义
- 'request' => array
- (
- # 后台搜索用到,也可以不加,自动生成
- 'search' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'ids' => array('yes-id', 'in'),
- 'name' => array('yes', 'like'),
- 'id_no' => array('yes-id', '!='),
- '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,spec_type|id',
- ),
- # 列表
- 'getData' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'category' => array('yes', 'like'),
- 'top_category_id' => array('yes', 'in'),
- 'second_category_id' => 'yes',
- 'category_id' => 'yes',
- 'status' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder' => 'desc', 'id' => 'desc'),
- 'col' => '*',
- ),
- # 列表
- 'getAll' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- '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' => '*',
- ),
- # 分页
- 'getPageAll' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'shop_id' => 'yes',
- 'name' => array('yes', 'like'),
- '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'),
- 'page' => array(10, 'list'),
- 'col' => '*',
- ),
- 'getOne' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'id' => 'yes',
- 'status' => 1,
- 'state' => 1,
- ),
- 'type' => 'one',
- 'col' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,cdate',
- ),
- ),
- );
- return $config;
|