123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- <?php
- $type = Dever::db('attr/info')->config['sell_type'];
- $config = array
- (
- # 表名
- 'name' => 'info_sku',
- # 显示给用户看的名称
- 'lang' => '商品价格设置',
- 'order' => 200,
- 'menu' => false,
- 'check' => 'code',
- # 数据结构 不同的字段放这里
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- //'list' => true,
- ),
- 'info_id' => array
- (
- 'type' => 'int-11',
- 'name' => '商品ID',
- 'default' => '',
- 'desc' => '商品ID',
- 'match' => 'is_numeric',
- 'update' => 'text',
- 'list' => true,
- ),
- 'key' => array
- (
- 'type' => 'varchar-100',
- 'name' => '属性标识',
- 'default' => '-1',
- 'desc' => '属性标识',
- 'match' => 'is_string',
- 'update' => 'text',
- ),
- 'attr' => array
- (
- 'type' => 'text-255',
- 'name' => '属性组合规则',
- 'default' => '',
- 'desc' => '属性组合规则',
- 'match' => 'is_string',
- 'update' => 'textarea',
- 'list' => true,
- ),
- 'type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '属性类型',
- 'default' => '1',
- 'desc' => '属性类型',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $type,
- ),
- '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',
- 'list' => true,
- ),
- 's_price' => array
- (
- 'type' => 'varchar-100',
- 'name' => '市场价',
- 'default' => '',
- 'desc' => '市场价',
- 'match' => 'option',
- 'update' => 'text',
- 'list' => true,
- ),
- 'f_price' => array
- (
- 'type' => 'varchar-100',
- 'name' => '门店采购价',
- 'default' => '',
- 'desc' => '采购价',
- 'match' => 'option',
- 'update' => 'text',
- 'list' => true,
- ),
- '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,
- ),
- 'cunhuo_code' => array
- (
- 'type' => 'varchar-100',
- 'name' => '存货编码',
- 'default' => '',
- 'desc' => '存货编码',
- 'match' => 'is_string',
- //'update' => 'text',
- //'list' => true,
- ),
- 'num' => array
- (
- 'type' => 'int-11',
- 'name' => '库存',
- 'default' => '',
- 'desc' => '库存',
- 'match' => 'is_string',
- 'update' => 'text',
- 'list' => true,
- ),
- 'sell_num' => array
- (
- 'type' => 'int-11',
- 'name' => '销量',
- 'default' => '0',
- 'desc' => '请填写销量',
- 'match' => 'option',
- 'search' => 'order',
- 'list' => 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',
- ),
- '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})',
- ),
- ),
- '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,
- ),
- 'manage' => array
- (
- 'insert' => false,
- 'edit' => false,
- 'delete' => false,
- 'num' => false,
- 'page_list_table' => 'sku',
- # 自定义快捷新增和编辑
- 'button' => array
- (
- //'自定义属性' => array('fast', 1, 'config&where_id=1'),
- ),
- ),
- # request 请求接口定义
- 'request' => array
- (
- # 后台搜索用到 也可以不加,自动生成
- 'search' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'ids' => array('yes-id', 'in'),
- 'info_id' => 'yes',
- 'id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder' => 'desc', 'id' => 'desc'),
- 'limit' => '0,10',
- 'col' => 'key as name, id, id as value, "" as selected, "" as disabled|id',
- ),
- # 列表
- 'getData' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'info_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('id' => 'desc'),
- 'col' => 'id,info_id,`key`,price,s_price,f_price,c_price,type,min,code,unit,weight,cunhuo_code',
- ),
- # 列表
- 'getDataByKeys' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'info_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('id' => 'desc'),
- 'col' => 'id,info_id,`key`,price,s_price,f_price,c_price,min,code,unit,weight,cunhuo_code|key',
- ),
- # 获取单条数据
- 'getOne' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'info_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'one',
- 'col' => 'id,info_id,price,s_price,f_price,c_price,min,code,unit,weight,cunhuo_code',
- ),
- 'getMinOne' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'info_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'one',
- 'order' => array('price' => 'asc', 'id' => 'desc'),
- 'col' => 'id,info_id,price,s_price,min,code,unit,weight,cunhuo_code',
- ),
- 'getMaxOne' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'info_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'one',
- 'order' => array('price' => 'desc', 'id' => 'desc'),
- 'col' => 'id,info_id,price,s_price,min,code,unit,weight,cunhuo_code',
- ),
- # 更新售出量
- 'updateSell' => array
- (
- 'type' => 'update',
- 'where' => array
- (
- 'id' => 'yes',
- ),
- 'set' => array
- (
- 'sell_num' => array('yes', '+='),
- ),
- ),
- 'like' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'code' => array('yes', 'like'),
- 'id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder' => 'desc', 'id' => 'desc'),
- 'col' => '*|id',
- ),
- ),
- );
- return $config;
|