dever 5 years ago
parent
commit
8a355526f8
2 changed files with 67 additions and 5 deletions
  1. 49 1
      database/user.php
  2. 18 4
      src/Applet.php

+ 49 - 1
database/user.php

@@ -89,7 +89,7 @@ return array
 			'exist'		=> array
 			(
 				'yes' => '有值',
-				'no' => '没有值',
+				//'no' => '没有值',
 			),
 			'list'		=> true,
 		),
@@ -117,6 +117,7 @@ return array
 			'callback'	=> 'sha1',
 		),
 		
+		//search_exist_avatar=yes
 		'avatar'		=> array
 		(
 			'type' 		=> 'varchar-150',
@@ -127,6 +128,48 @@ return array
 			'update'	=> 'image',
 			'key' 		=> '1',
 			'place'		=> '150',
+			'list'		=> '"{avatar}" ? "<img src=\'{avatar}\' width=\'150\'>": ""',
+		),
+
+		'country'		=> array
+		(
+			'type' 		=> 'varchar-100',
+			'name' 		=> '国家',
+			'default' 	=> '',
+			'desc' 		=> '国家',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+		),
+
+		'province'		=> array
+		(
+			'type' 		=> 'varchar-100',
+			'name' 		=> '省份',
+			'default' 	=> '',
+			'desc' 		=> '省份',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+		),
+
+		'city'		=> array
+		(
+			'type' 		=> 'varchar-100',
+			'name' 		=> '城市',
+			'default' 	=> '',
+			'desc' 		=> '城市',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+		),
+
+		'area'		=> array
+		(
+			'type' 		=> 'varchar-800',
+			'name' 		=> '地区',
+			'default' 	=> '',
+			'desc' 		=> '地区',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'list'		=> true,
 		),
 		
 		'info'		=> array
@@ -207,6 +250,11 @@ return array
 		),
 	),
 
+	'manage' => array
+	(
+		'excel' => true,
+	),
+
 	# 更新表结构
 	/*
 	'alter' => array

+ 18 - 4
src/Applet.php

@@ -22,7 +22,17 @@ class Applet extends Base
      */
     public function bind()
     {
-        $applet = Dever::config('base', 'project')->applet;
+        $token = Dever::project('token');
+        $applet = array();
+        if ($token) {
+            $applet = Dever::db('token/project')->one(Dever::input('appid', 1));
+        }
+
+        if (!$applet) {
+            $applet = Dever::config('base', 'project')->applet;
+        }
+        
+
         $appid = $applet['appid'];
         $secret = $applet['secret'];
         $url = $applet['url'];
@@ -258,11 +268,15 @@ class Applet extends Base
               	$update['set_avatar'] = $pic;
             }
             
-            //$update['set_city'] = $city;
+            $update['set_city'] = $city;
             //$update['set_mobile'] = $mobile;
-            //$update['set_province'] = $province;
-            //$update['set_country'] = $country;
+            $update['set_province'] = $province;
+            $update['set_country'] = $country;
             $update['where_id'] = $uid;
+
+            if ($country && $province && $city) {
+                $update['set_area'] = $country . ',' . $province . ',' . $city;
+            }
             if (isset($update) && $update) {
                 Dever::load('passport/user-update', $update);
             }