audit; $status = Dever::config('base')->status; $brand = function() { $array = array(); $info = Dever::db('goods/brand')->state(); if($info) { $array += $info; } return $array; }; $shop = function() { $array = array(); $info = Dever::db('goods/shop')->state(); if($info) { $array += $info; } return $array; }; $shape = array ( 1 => '实体物品', 2 => '虚拟物品', 3 => '功能道具', ); $platform = array ( 1 => '自营', 2 => '淘宝', 3 => '京东', 4 => '拼多多', 11 => '其他', ); $price_type = array ( 1 => '单一价格', 2 => '多种价格(需进行sku设置)', ); $mode = array ( -1 => '无', 1 => '快递', 2 => '自提', 3 => '快递+自提', ); $reward_type = array ( 1 => '数值', 2 => '百分比', ); $config = array ( # 表名 'name' => 'info', # 显示给用户看的名称 'lang' => '商品列表', 'order' => 200, 'auto' => 10000000, 'config_platform' => $platform, 'config_mode' => $mode, 'config_shape' => $shape, 'end' => array ( 'insert' => 'goods/lib/manage.infoUpdate', 'update' => 'goods/lib/manage.infoUpdate', ), # 同步更新另外一个或多个表的数据,将数据同步到关联表中 'sync' => array ( 'goods/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, ), 'platform' => array ( 'type' => 'int-11', 'name' => '平台', 'default' => '1', 'desc' => '平台', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $platform, 'control' => 'platform', ), 'shape' => array ( 'type' => 'int-11', 'name' => '形态', 'default' => '1', 'desc' => '形态', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $shape, ), 'mode' => array ( 'type' => 'int-11', 'name' => '配送方式', 'default' => '-1', 'desc' => '配送方式', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $mode, ), 'link' => array ( 'type' => 'varchar-800', 'name' => '链接', 'default' => '', 'desc' => '链接', 'match' => 'is_string', 'update' => 'textarea', 'search' => 'fulltext', //'list' => true, //'edit' => true, 'show' => 'platform=2,3,4,11', ), 'code' => array ( 'type' => 'varchar-800', 'name' => '购物码-可以复制的码,淘宝和拼多多有', 'default' => '', 'desc' => '购物码', 'match' => 'is_string', 'update' => 'textarea', 'search' => 'fulltext', //'list' => true, //'edit' => true, 'show' => 'platform=2,4', ), 'price_type' => array ( 'type' => 'int-11', 'name' => '价格类型', 'default' => '1', 'desc' => '价格类型', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $price_type, 'control' => 'price_type', ), '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', ), 'num' => array ( 'type' => 'int-11', 'name' => '库存', 'default' => '', 'desc' => '库存', 'match' => 'option', 'update' => 'text', ), 'reward_type' => array ( 'type' => 'tinyint-1', 'name' => '佣金类型', 'default' => '1', 'desc' => '佣金类型', 'match' => 'option', 'update' => 'radio', 'option' => $reward_type, ), 'reward_value' => array ( 'type' => 'varchar-100', 'name' => '佣金-如果此处填写值,则通用的佣金配置将失效', 'default' => '', 'desc' => '佣金', 'match' => 'option', 'update' => 'text', ), 'goods_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}")', ), 'brand_id' => array ( 'type' => 'int-11', 'name' => '品牌', 'default' => '', 'desc' => '品牌', 'match' => 'is_numeric', 'update' => 'select', 'option' => $brand, 'show' => 'type=1', ), 'shop_id' => array ( 'type' => 'int-11', 'name' => '店铺', 'default' => '', 'desc' => '店铺', 'match' => 'is_numeric', 'update' => 'select', 'option' => $shop, ), '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', ), 'pic_cover' => array ( 'type' => 'varchar-150', 'name' => '封面图-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪', 'default' => '', 'desc' => '封面图', 'match' => 'option', 'update' => 'image', 'key' => '1', 'place' => '300*300', 'list_name' => '资源详情', 'list' => 'Dever::load("goods/lib/manage.info", "{id}")', ), 'pic' => array ( 'type' => 'text-255', 'name' => '多张图片-图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪', 'default' => '', 'desc' => '多张图片', 'match' => 'option', 'update' => 'images', 'key' => '1', 'place' => '750*422', ), 'sell_num' => array ( 'type' => 'int-11', 'name' => '总销量', 'default' => '0', 'desc' => '请填写销量', 'match' => 'option', 'search' => 'order', 'list' => '{sell_num}+{sell_add_num}', ), 'sell_add_num' => array ( 'type' => 'int-11', 'name' => '销量基数', 'default' => '0', 'desc' => '销量基数', 'match' => 'option', //'update' => 'text', ), 'audit' => array ( 'type' => 'tinyint-1', 'name' => '审核', 'default' => '1', 'desc' => '审核', 'match' => 'is_numeric', //'update' => 'select', 'option' => $audit, 'search' => 'select', 'list' => true, 'edit' => true, ), '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, ), 'udate' => array ( 'type' => 'int-11', 'name' => '更新时间', 'match' => array('is_numeric', time()), 'desc' => '', ), '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', ), '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' => 'shop_id,brand_id,category,top_category_id,second_category_id,category_id', ), # 版本号 更改版本号会更新当前表的索引 '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'), ), # 列表里的按钮 '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}"', '{price_type} == 2'), 'list' => array('sku设置', '"info_sku &project=goods &search_option_info_id={id} &oper_parent=info&oper_project=goods &oper_save_jump=info&page_type=1"', '{price_type} == 2'), 'br1' => array('
'), 'delete' => '删除', ), ), # request 请求接口定义 'request' => array ( # 后台搜索用到 'search' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'ids' => array('yes-id', 'in'), 'name' => array('yes', 'like'), 'id' => 'yes', 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'limit' => '0,1000', 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|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' => '*', ), # 分页 'getPageAll' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'shop_id' => 'yes', 'brand_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' => '*', ), # 更新售出量 'updateSell' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'sell_num' => array('yes', '+='), ), ), 'getOne' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'id' => 'yes', ), 'type' => 'one', 'col' => 'id,name,category,brand_id,shop_id,pic_cover,pic,sell_num+sell_add_num as sell_num,content,platform,price_type,price,s_price,num-sell_num as num,link,code,mode,goods_area,shape,reward_value,reward_type', ), ), ); return $config;