'上架', 2 => '下架', ); $id = Dever::input('where_id'); $type = array ( 1 => '实物商品', 2 => '虚拟商品',//虚拟商品可以通过分类设置 //3 => '功能商品',//对应道具市场 11 => '套餐商品', 12 => '组合商品', ); $pay_type = array ( 1 => '货币支付', //2 => '积分支付', ); $commission_type = array ( 1 => '货币账户', 2 => '积分账户', ); $account = function() { return Dever::load('account/config-state'); }; $score = function() { return Dever::load('score/config-state'); }; $unit = function($type = false) { return Dever::load('scm/unit-state'); $data = Dever::load('scm/unit-select'); if ($type == true) { $array = array ( 0 => array('id' => -1, 'name' => '-'), ); return array_merge($array, $data); } else { return $data; } }; $rate = function($type = false) { return Dever::load('scm/rate-state'); }; $sell_type = array ( 1 => '可售卖', 2 => '不可售卖', ); $buy_type = array ( 1 => '可采购', 2 => '不可采购', ); $stock = array ( 1 => '是', 2 => '否', ); $source_type = array ( 1 => '经销商', 2 => '配送商', 3 => '供应商', ); $config = array ( # 表名 'name' => 'info', # 显示给用户看的名称 'lang' => '商品资料管理', 'order' => 1000, 'auto' => 10000000, 'set' => array ( 'status' => $status, ), 'start' => array ( 'insert' => 'scm_product/lib/manage.check', 'update' => 'scm_product/lib/manage.check', ), 'end' => array ( 'insert' => 'scm_product/lib/manage.updateInfo', 'update' => 'scm_product/lib/manage.updateInfo', ), # 同步更新另外一个或多个表的数据,将数据同步到关联表中 'sync' => array ( 'scm_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' => '商品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, ), 'source_type' => array ( 'type' => 'int-11', 'name' => '商品来源', 'default' => '3', 'desc' => '商品来源', 'match' => 'is_numeric', 'update' => 'radio', 'control_url' => 'scm_product/lib/manage.selectSource', 'option' => $source_type, 'search' => 'select', 'list' => true, 'tab' => 1, ), 'source_id' => array ( 'type' => 'int-11', 'name' => '选择来源', 'default' => '', 'desc' => '选择来源', 'match' => 'option', 'update' => 'select', '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', ), 'scm_product-info_goods'=> array ( 'name' => '商品配置-套餐和组合商品可以选择多个套餐或者组合内的商品', 'default' => '', 'desc' => '商品配置', 'match' => 'option', # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段 'sync' => array('id', 'info_id'), 'update' => array(1), # 1纵向展示 2横向展示 'update_type' => 2, //'list_name' => '商品信息', //'list' => 'Dever::load("scm_servicer/lib/manage.getGoods", {id})', 'tab' => 1, 'show' => 'type=11,12', ), '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_type' => array ( 'type' => 'tinyint-1', 'name' => '支付方式-使用哪种方式购买该商品', 'default' => '1', 'desc' => '支付类型', 'match' => 'is_numeric', //'update' => 'radio', 'option' => $pay_type, //'search' => 'select', //'list' => true, 'tab' => 1, //'control' => 'pay_type', ), 'rate_id' => array ( 'type' => 'int-11', 'name' => '基本税率', 'default' => '', 'desc' => '基本税率', 'match' => 'is_numeric', 'update' => 'select', 'option' => $rate, 'tab' => 1, ), 'unit_id' => array ( 'type' => 'int-11', 'name' => '基本单位-一般为商品的最小单位,如个、袋、克等', 'default' => '', 'desc' => '基本单位', 'match' => 'is_numeric', 'update' => 'select', 'option' => $unit, 'tab' => 1, ), 'scm_product-info_unit'=> array ( 'name' => '单位转换设置', 'default' => '', 'desc' => '单位转换设置', 'match' => 'option', # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段 'sync' => array('id', 'info_id'), 'update' => array(1), # 1纵向展示 2横向展示 'update_type' => 2, 'tab' => 1, ), 'commission' => array ( 'type' => 'varchar-20', 'name' => '销售佣金-设置佣金之后,经销商或者其下级分销商销售了商品,经销商能得到的总佣金,也可以在经销商里单独设置,填写10%就是销售价的百分之10,直接填写数字就是佣金数额,填0就是无佣金,填负数会扣减佣金账户', 'default' => '0', 'desc' => '销售佣金', 'match' => 'is_string', 'update' => 'text', 'tab' => 4, ), 'commission_type' => array ( 'type' => 'tinyint-1', 'name' => '佣金账户类型-设置获取佣金的账户类型', 'default' => '1', 'desc' => '佣金类型', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $commission_type, 'search' => 'select', //'list' => true, 'tab' => 4, 'control' => 'commission_type', ), 'commission_account_id' => array ( 'type' => 'int-11', 'name' => '货币账户', 'default' => '', 'desc' => '货币账户', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $account, 'tab' => 4, 'show' => 'commission_type=1', ), 'commission_score_id' => array ( 'type' => 'int-11', 'name' => '积分账户', 'default' => '', 'desc' => '积分账户', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $score, 'tab' => 4, 'show' => 'commission_type=2', ), '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', 'scm_product'), //'update' => 'radio', //'option' => Dever::db('scm_product/category')->select(), 'list' => 'Dever::load("scm_product/lib/category.string", "{category}")', 'load' => 'scm_product-info_attr', 'tab' => 2, ), 'scm_product-info_attr'=> array ( 'name' => '属性设置', 'default' => '', 'desc' => '请先选择属性分类', 'match' => 'option', # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段 'sync' => array('id', 'info_id'), # 根据category字段的值,获取scm_product/attr.search接口的内容 'update' => 'load', 'update_load' => array('scm_product/lib/attr.getManageByCate', 'category'), 'tab' => 2, ), 'scm_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 ( //'desc' => '111', # 定义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'), 'price' => array('name' => '销售价', 'verify' => 'number', 'type' => 'input'), 'un_price' => array('name' => '划线价', 'verify' => 'number', 'type' => 'input'), 'cost_price' => array('name' => '成本价', 'verify' => 'number', 'type' => 'input'), 'buy_price' => array('name' => '采购价', 'verify' => 'number', 'type' => 'input'), //'unit' => array('name' => '单位', 'verify' => 'number', 'type' => 'select', 'option' => Dever::json_encode($unit(true)), 'unit'), ), # 接口 'api' => array ( 'spec' => 'scm_product/lib/spec.get', 'sku' => 'scm_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'), 'cate' => array('yes-top_category_id', 'in'), '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;