| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 | 
							- <?php
 
- $config = function()
 
- {
 
- 	return Dever::db('account/config')->state();
 
- };
 
- $project = function()
 
- {
 
- 	return Dever::load('account/config_project-state');
 
- };
 
- $user = '用户ID';
 
- $search = 'hidden';
 
- $config_key = Dever::input('config_key');
 
- if ($config_key) {
 
- 	$info = Dever::db('account/config')->find(array('key' => $config_key));
 
- 	if ($info) {
 
- 		Dever::setInput('set_config_id', $info['id']);
 
- 	}
 
- }
 
- $uid = Dever::input('search_option_uid');
 
- $config_id = Dever::input('set_config_id');
 
- if ($config_id) {
 
- 	$search_config = Dever::load('account/lib/manage')->getSearch($config_id);
 
- 	if ($search_config) {
 
- 		$search = $search_config;
 
- 		$user = '用户信息';
 
- 	}
 
- }
 
- $account_log = 'info_log&project=account&search_option_info_id={id}&search_option_uid={uid}&set_config_id={config_id}&';
 
- $pay = 'pay&project=account&search_option_info_id={id}&search_option_uid={uid}set_config_id={config_id}&';
 
- $parent = Dever::input('parent');
 
- $link = '';
 
- if ($parent) {
 
- 	$link = 'parent=' . $parent . '.account/info';
 
- } else {
 
- 	$link = 'parent=account/info';
 
- }
 
- return array
 
- (
 
- 	# 表名
 
- 	'name' => 'info',
 
- 	# 显示给用户看的名称
 
- 	'lang' => '用户账户列表',
 
- 	'order' => 100,
 
- 	'menu' => false,
 
- 	# 数据结构
 
- 	'struct' => array
 
- 	(
 
- 		'id' 		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> 'ID',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '',
 
- 			'match' 	=> 'is_numeric',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'uid'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> $user,
 
- 			'default' 	=> '0',
 
- 			'desc' 		=> '用户信息',
 
- 			'match' 	=> 'is_numeric',
 
-             'search'	=> $search,
 
-             'value'     => $uid,
 
-             'list_name'	=> '用户信息',
 
- 			'list'		=> 'Dever::load("account/lib/project.getUsername", {uid}, {config_id})',
 
- 		),
 
- 		'config_id'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '账户名称',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '账户名称',
 
- 			'match' 	=> 'is_numeric',
 
- 			'update'	=> 'select',
 
- 			'option'	=> $config,
 
- 			//'search'	=> 'select',
 
- 			'list'		=> true,
 
- 		),
 
- 		'project_id'        => array
 
-         (
 
-             'type'      => 'int-11',
 
-             'name'      => '所属项目',
 
-             'default'   => '1',
 
-             'desc'      => '所属项目',
 
-             'match'     => 'is_numeric',
 
-             'update'    => 'radio',
 
-             'option'    => $project,
 
-             'list'		=> true,
 
-         ),
 
- 		'cash'		=> array
 
- 		(
 
- 			'type'      => 'decimal-11,2',
 
- 			'name' 		=> '可用金额',
 
- 			'default' 	=> '0',
 
- 			'desc' 		=> '可用金额',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'text',
 
- 			'list'		=> true,
 
- 		),
 
- 		'z_cash'		=> array
 
- 		(
 
- 			'type'      => 'decimal-11,2',
 
- 			'name' 		=> '总增加金额',
 
- 			'default' 	=> '0',
 
- 			'desc' 		=> '总增加金额',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'text',
 
- 			'list'		=> true,
 
- 		),
 
- 		't_cash'		=> array
 
- 		(
 
- 			'type'      => 'decimal-11,2',
 
- 			'name' 		=> '总减少金额',
 
- 			'default' 	=> '0',
 
- 			'desc' 		=> '总减少金额',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'text',
 
- 			'list'		=> 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,
 
- 		),
 
- 	),
 
- 	# 索引
 
- 	'index' => array
 
- 	(
 
- 		1 => array
 
- 		(
 
- 			'search' => 'uid,config_id,project_id',
 
- 		),
 
- 		
 
- 		# 版本号 更改版本号会更新当前表的索引
 
- 		'version' => 1,
 
- 	),
 
- 	'manage' => array
 
- 	(
 
- 		'link' => $link,
 
- 		'delete' => false,
 
- 		'edit' => false,
 
- 		'insert' => false,
 
- 		'excel' => true,
 
- 		# 列表
 
- 		'list_button' => array
 
- 		(
 
- 			'fast_add' => array('账户操作', 'push&project=account&set_config_id={config_id}&search_option_uid={uid}'),
 
- 			'list' => array('账户流水', $account_log),
 
- 			'list1' => array('充值记录', $pay),
 
- 		),
 
- 	),
 
- 	# request 请求接口定义
 
- 	'request' => array
 
- 	(
 
- 		# 更新
 
- 		'inc' => array
 
- 		(
 
- 			'type' => 'update',
 
- 			'where' => array
 
- 			(
 
- 				'id' => 'yes',
 
- 			),
 
- 			'set' => array
 
- 			(
 
- 				'cash' => array('yes', '+='),
 
- 				'col' => array('yes-z_cash', '+='),
 
- 			),
 
- 		),
 
- 		# 更新
 
- 		'dec' => array
 
- 		(
 
- 			'type' => 'update',
 
- 			'where' => array
 
- 			(
 
- 				'id' => 'yes',
 
- 			),
 
- 			'set' => array
 
- 			(
 
- 				'cash' => array('yes', '+='),
 
- 				'col' => array('yes-t_cash', '+='),
 
- 			),
 
- 		),
 
- 	)
 
- );
 
 
  |