| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -16,24 +16,30 @@ use EasyWeChat\Kernel\Exceptions\DecryptException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Hyperf\Guzzle\CoroutineHandler; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Hyperf\Utils\ApplicationContext; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					class UserInfoService implements UserInfoServiceInterface | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					class UserInfoService  | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 更新 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param $userId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param $iv | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param $encryptedData | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param $data | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return array | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @throws DecryptException | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public function do($userId, $iv, $encryptedData) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public function do($data) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $userId = $data['userId']; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $iv = $data['iv']; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $encryptedData = $data['encryptedData']; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $user = $ssdb->exec('hgetall', SsdbKeys::USER_INFO.$userId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(empty($user)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return ['找不到缓存的用户信息']; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 微信登录
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $config = config('applet'); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $app = Factory::miniProgram($config); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -43,8 +49,8 @@ class UserInfoService implements UserInfoServiceInterface | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $data = [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'nick_name' => $decryptedData['nickName'], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'avatar' => $decryptedData['avatarUrl'], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'openid' => $decryptedData['openId'], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'unionid' => $decryptedData['unionId'], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 'openid' => $decryptedData['openId'],
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 'unionid' => $decryptedData['unionId'],
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'country' => $decryptedData['country'], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'province' => $decryptedData['province'], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'city' => $decryptedData['city'], | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -83,10 +89,15 @@ class UserInfoService implements UserInfoServiceInterface | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public function detail($userId) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return User::query() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $result =  User::query() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ->select(['id', 'nick_name', 'avatar', 'openid', 'unionid', 'total_score', 'real_name']) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ->where(['status' => 1, 'id' => $userId]) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ->first()->toArray(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ->first(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(!$result) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return []; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return $result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public function getStoreByUID($userId) | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |