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