rabin vor 6 Jahren
Ursprung
Commit
5b7998630e
4 geänderte Dateien mit 288 neuen und 10 gelöschten Zeilen
  1. 138 0
      database/profession.php
  2. 69 9
      database/user.php
  3. 50 0
      lib/Manage.php
  4. 31 1
      src/Reg.php

+ 138 - 0
database/profession.php

@@ -0,0 +1,138 @@
+<?php
+
+$system = function()
+{
+	$array = array();
+	$info = Dever::db('passport/system')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+return array
+(
+	# 表名
+	'name' => 'profession',
+	# 显示给用户看的名称
+	'lang' => '职业设置',
+	# 后台菜单排序
+	'order' => 1,
+	'end' => array
+	(
+		'insert' => array
+		(
+			'manage/top.sync',
+		),
+		'update' => array
+		(
+			'manage/top.sync',
+		),
+	),
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			'list'		=> true,
+			'order'		=> 'desc',
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '职业名称',
+			'default' 	=> '',
+			'desc' 		=> '职业名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+
+		'system_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '所属项目',
+			'default' 	=> '1',
+			'desc' 		=> '所属项目',
+			'match' 	=> 'is_numeric',
+			'option' 	=> $system,
+			//'update'	=> 'select',
+			//'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,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'manage' => array
+	(
+		'insert' => false,
+		'edit' => false,
+
+		# 自定义快捷新增和编辑
+		'button' => array
+		(
+			'新增' => array('fast'),
+		),
+		# 快捷更新
+		'list_button' => array
+		(
+			'edit' => array('编辑'),
+		),
+	),
+
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc','id' => 'desc'),
+			'col' => '*',
+		),
+	),
+);

+ 69 - 9
database/user.php

@@ -24,6 +24,17 @@ $system = function()
 	return $array;
 };
 
+$profession = function()
+{
+	$array = array();
+	$info = Dever::db('passport/profession')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
 $sex = array
 (
 	1 => '男',
@@ -69,6 +80,8 @@ return array
 (
 	'email' => $email,
 	'mobile' => $mobile,
+	'source_type' => $source_type,
+	'sex' => $sex,
 	# 表名
 	'name' => 'user',
 	# 显示给用户看的名称
@@ -143,6 +156,29 @@ return array
 			//'list'		=> true,
 		),
 
+		'profession'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '职业',
+			'default' 	=> '1',
+			'desc' 		=> '职业',
+			'match' 	=> 'is_numeric',
+			'option' 	=> $profession,
+			//'update'	=> 'select',
+			//'list'		=> true,
+		),
+
+		'wechat'		=> array
+		(
+			'type' 		=> 'varchar-100',
+			'name' 		=> '微信号',
+			'default' 	=> '',
+			'desc' 		=> '微信号',
+			'match' 	=> 'is_string',
+			//'update'	=> 'select',
+			//'list'		=> true,
+		),
+
 		'source_type'		=> array
 		(
 			'type' 		=> 'varchar-100',
@@ -153,7 +189,7 @@ return array
 			'update'	=> 'select',
 			'option'	=> $source_type,
 			'search'	=> 'select',
-			'list'		=> true,
+			//'list'		=> true,
 		),
 
 		'email'		=> array
@@ -190,7 +226,9 @@ return array
 			'update'	=> 'image',
 			'key' 		=> '1',
 			'place'		=> '150',
-			'list'		=> '"{avatar}" ? "<img src=\'{avatar}\' width=\'150\'>": ""',
+			'list_name'	=> '详细信息',
+			//'list'		=> '"{avatar}" ? "<img src=\'{avatar}\' width=\'150\'>": ""',
+			'list'		=> 'Dever::load("passport/lib/manage.show", {id})',
 		),
 
 		'country'		=> array
@@ -200,7 +238,7 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '国家',
 			'match' 	=> 'option',
-			'update'	=> 'text',
+			//'update'	=> 'text',
 		),
 
 		'province'		=> array
@@ -210,7 +248,7 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '省份',
 			'match' 	=> 'option',
-			'update'	=> 'text',
+			//'update'	=> 'text',
 		),
 
 		'city'		=> array
@@ -220,7 +258,7 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '城市',
 			'match' 	=> 'option',
-			'update'	=> 'text',
+			//'update'	=> 'text',
 		),
 
 		'area'		=> array
@@ -230,8 +268,30 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '地区',
 			'match' 	=> 'option',
-			'update'	=> 'text',
-			'list'		=> true,
+			//'update'	=> 'text',
+			//'list'		=> true,
+		),
+
+		'area_id'		=> array
+		(
+			'type' 		=> 'varchar-800',
+			'name' 		=> '地区',
+			'default' 	=> '',
+			'desc' 		=> '地区',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			//'list'		=> true,
+		),
+
+		'address'		=> array
+		(
+			'type' 		=> 'varchar-1000',
+			'name' 		=> '详细地址',
+			'default' 	=> '',
+			'desc' 		=> '详细地址',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			//'list'		=> true,
 		),
 		
 		'info'		=> array
@@ -286,10 +346,10 @@ return array
 			'default' 	=> '1',
 			'desc' 		=> '是否临时用户',
 			'match' 	=> 'is_numeric',
-			'search'	=> 'select',
+			//'search'	=> 'select',
 			'option' 	=> $temp,
 			//'update'	=> 'select',
-			'list'		=> true,
+			//'list'		=> true,
 		),
 
 		'login_date'		=> array

+ 50 - 0
lib/Manage.php

@@ -23,4 +23,54 @@ class Manage
         }
         return $info;
     }
+
+    public function show($id)
+    {
+        $db = Dever::db('passport/user');
+        $user = $db->one($id);
+
+        $config = $db->config;
+
+        if ($user['avatar']) {
+            $table['头像'] = '<img src="'.$user['avatar'].'" width="150" />';
+        }
+
+        if ($user['area']) {
+            $table['地区'] = $user['area'];
+        }
+
+        if ($user['address']) {
+            $table['详细地址'] = $user['address'];
+        }
+
+        if ($user['source_type']) {
+            $table['来源'] = $config['source_type'][$user['source_type']];
+        }
+
+        if ($user['profession']) {
+            $profession = Dever::db('passport/profession')->one($user['profession']);
+            $table['职业'] = $profession['name'];
+        }
+
+        if ($user['sex']) {
+            $table['性别'] = $config['sex'][$user['sex']];
+        }
+
+        if ($user['wechat']) {
+            $table['微信号'] = $user['wechat'];
+        }
+
+        if ($user['email']) {
+            $table['邮箱'] = $user['email'];
+        }
+
+        if (Dever::project('invite')) {
+            $invite = Dever::db('invite/code')->one(array('uid' => $user['id']));
+            if ($invite) {
+                $table['邀请码'] = $invite['code'];
+            }
+        }
+
+        return Dever::table($table);
+    }
 }

+ 31 - 1
src/Reg.php

@@ -229,7 +229,37 @@ class Reg extends Base
             $param['add_' . $account] = $param['option_' . $account];
             $param['add_username'] = Dever::input('username');
             $param['add_password'] = Dever::input('password');
-            $param['add_sex'] = Dever::input('sex');
+            $sex = Dever::input('sex');
+            $wechat = Dever::input('wechat');
+            $profession = Dever::input('profession');
+            $truename = Dever::input('truename');
+            $area_id = Dever::input('area_id');
+            $area = Dever::input('area');
+
+            if ($sex) {
+                $param['add_sex'] = Dever::input('sex');
+            }
+
+            if ($wechat) {
+                $param['add_wechat'] = Dever::input('wechat');
+            }
+
+            if ($profession) {
+                $param['add_profession'] = Dever::input('profession');
+            }
+
+            if ($truename) {
+                $param['add_truename'] = Dever::input('truename');
+            }
+
+            if ($area) {
+                $param['add_area'] = Dever::input('area');
+            }
+
+            if ($area_id) {
+                $param['add_area_id'] = Dever::input('area_id');
+            }
+            
             $cpassword = Dever::input('cpassword');
 
             if (!$param['add_username']) {