rabin 1 anno fa
parent
commit
2857a40ac7
4 ha cambiato i file con 62 aggiunte e 19 eliminazioni
  1. 6 7
      database/address.php
  2. 5 3
      database/info.php
  3. 31 1
      lib/Address.php
  4. 20 8
      lib/Info.php

+ 6 - 7
database/address.php

@@ -84,7 +84,8 @@ return array
 			'desc' 		=> '类型',
 			'match' 	=> 'is_numeric',
 			'option' 	=> $type,
-			//'update'	=> 'radio',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('type', 2),
 			'list'		=> true,
 			'order'		=> 'desc',
 		),
@@ -98,6 +99,7 @@ return array
 			'match' 	=> 'option',
 			'search'	=> 'fulltext',
 			'update'	=> 'text',
+			'value'		=> Dever::input('contacts'),
 			'list'		=> true,
 		),
 
@@ -110,6 +112,7 @@ return array
 			'match' 	=> 'option',
 			'search'	=> 'fulltext',
 			'update'	=> 'text',
+			'value'		=> Dever::input('phone'),
 			'list'		=> true,
 		),
 
@@ -122,6 +125,7 @@ return array
 			'match' 	=> 'is_string',
 			'search'	=> 'linkage',
 			'update'	=> 'linkage',
+			'value'		=> Dever::input('area'),
 			'option'	=> Dever::url('api.get?level_total=' . $area_total, 'area'),
 			'list'		=> 'Dever::load("area/api.string", "{area}")',
 		),
@@ -133,7 +137,6 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '省份',
 			'match' 	=> 'option',
-			//'update'	=> 'text',
 		),
 
 		'city'		=> array
@@ -143,7 +146,6 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '城市',
 			'match' 	=> 'option',
-			//'update'	=> 'text',
 		),
 
 		'county'		=> array
@@ -153,7 +155,6 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '县区',
 			'match' 	=> 'option',
-			//'update'	=> 'text',
 		),
 
 		'town'		=> array
@@ -163,7 +164,6 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '街道',
 			'match' 	=> 'option',
-			//'update'	=> 'text',
 		),
 
 		'lng'       => array
@@ -192,6 +192,7 @@ return array
 			'desc' 		=> '详细地址',
 			'match' 	=> 'option',
 			'update'	=> 'textarea',
+			'value'		=> Dever::input('address'),
 			'list'		=> true,
 		),
 
@@ -203,8 +204,6 @@ return array
             'desc'      => '标签',
             'match'     => 'is_numeric',
             'option'    => $tag,
-            //'update'    => 'radio',
-            //'list'        => true,
         ),
 
         'state'     => array

+ 5 - 3
database/info.php

@@ -10,14 +10,14 @@ $list_button = array
 if (Dever::project('account')) {
 	$list_button += array
 	(
-		'list99' => array('钱包', '"info_log&project=account&config_key=qianbao&search_option_uid={id}&oper_table=info&oper_project=user"'),
+		'list99' => array('钱包', '"info_log&project=account&config_key=qianbao&search_option_uid={id}&parent=user/info"'),
 	);
 }
 if (Dever::project('score')) {
 	$list_button += array
 	(
-		'list100' => array('积分', '"user&project=score&search_option_uid={id}&oper_table=info&oper_project=user"'),
-		'list101' => array('等级', '"user_level&project=score&search_option_uid={id}&oper_table=info&oper_project=user"'),
+		'list100' => array('积分', '"user&project=score&search_option_uid={id}&parent=user/info"'),
+		'list101' => array('等级', '"user_level&project=score&search_option_uid={id}&parent=user/info"'),
 	);
 }
 
@@ -42,6 +42,8 @@ return array
 	# 显示给用户看的名称
 	'lang' => '用户管理',
 	'order' => 10,
+	# 用户id从100w开始
+	'auto' => 1000000,
 	'set' => array
 	(
 		'system_source' => $system_source,

+ 31 - 1
lib/Address.php

@@ -9,7 +9,7 @@ class Address
     {
         $area = Dever::param('area', $param);
         $type = Dever::param('type', $param);
-        if ($area && is_array($area)) {
+        if ($area && is_array($area) && $area[0] > 0) {
             $update['where_id'] = $id;
             $update['province'] = $area[0];
             $update['city'] = $area[1];
@@ -30,11 +30,26 @@ class Address
             
             $update['type'] = $type;
             Dever::db('user/address')->update($update);
+
+            $call = Dever::config('base')->address;
+            if ($call) {
+                $source_table = Dever::param('source_table', $param);
+                $source_id = Dever::param('source_id', $param);
+                $address = Dever::param('address', $param);
+                $contacts = Dever::param('contacts', $param);
+                $phone = Dever::param('phone', $param);
+
+                $address_string = Dever::load('area/api')->string($area) . ',' . $address . ',' . $contacts . ',' . $phone;
+                Dever::load($call, $source_table, $source_id, '修改地址:' . $address_string);
+            }
         }
     }
 
     public function getInfo($data)
     {
+        if (is_array($data['area'])) {
+            $data['area'] = implode(',', $data['area']);
+        }
         $data['area_string'] = Dever::load('area/api')->string($data['area']);
         $data['province_name'] = $data['city_name'] = $data['county_name'] = $data['town_name'] = '';
         if ($data['town'] && $data['town'] > 0) {
@@ -148,4 +163,19 @@ class Address
         $info = Dever::db($source_table)->one($source_id);
         return $info;
     }
+
+    public function getManageUrl($source_table, $source_id, $type, $address = array())
+    {
+        $info = Dever::db('user/address')->one(array('source_table' => $source_table, 'source_id' => $source_id));
+        $url = Dever::url('project/database/update?project=user&table=address&search_option_source_table=' . $source_table . '&search_option_source_id=' . $source_id, 'manage');
+
+        if ($info) {
+            $url .= '&where_id=' . $info['id'];
+        }
+
+        if ($address) {
+            $url .= '&type=' . $type . '&area=' . $address['area'] . '&address=' . $address['address'] . '&contacts=' . $address['contacts'] . '&phone=' . $address['phone'];
+        }
+        return $url;
+    }
 }

+ 20 - 8
lib/Info.php

@@ -54,18 +54,30 @@ class Info
 
     public function get($uid)
     {
-        $info = Dever::db('user/info')->find($uid);
-        if ($info) {
-            if ($info['area']) {
-                $info['area_string'] = Dever::load('area/api')->string($info['area']);
+        $info = array();
+        if ($uid < 1000000) {
+            $info = Dever::db('manage/admin')->find($uid);
+            if ($info) {
+                $info['name'] = $info['username'];
+                $info['area_string'] = '';
+                $info['avatar'] = '';
             }
+        } else {
+            $info = Dever::db('user/info')->find($uid);
+            if ($info) {
+                if (isset($info['area']) && $info['area']) {
+                    $info['area_string'] = Dever::load('area/api')->string($info['area']);
+                }
 
-            if (!$info['avatar'] && $info['avatar_id'] > 0) {
-                $avatar = Dever::db('user/avatar')->one($info['avatar_id']);
-                $info['avatar'] = $avatar['avatar'];
+                if (!$info['avatar'] && $info['avatar_id'] > 0) {
+                    $avatar = Dever::db('user/avatar')->one($info['avatar_id']);
+                    if ($avatar) {
+                        $info['avatar'] = $avatar['avatar'];
+                    }
+                }
             }
         }
-        
+
         return $info;
     }