|
@@ -119,7 +119,17 @@ class Login extends Api
|
|
|
$avatar=input('avatarUrl');
|
|
|
$nickname=input('nickname');
|
|
|
$user=Db::table('q_user')->where('id',$user_id)->find();
|
|
|
- $decryptedData = $app->encryptor->decryptData($user['session_key'], input('iv'), input('encryptedData'));
|
|
|
+ //$decryptedData = $app->encryptor->decryptData($user['session_key'], input('iv'), input('encryptedData'));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $pc = new WXBizDataCrypt($config['app_id'], $user['session_key']);
|
|
|
+
|
|
|
+ $pc->decryptData(input('encryptedData'), input('iv'), $data );
|
|
|
+
|
|
|
+ $array=json_decode($data, true);
|
|
|
+
|
|
|
+ dump($array);die();
|
|
|
|
|
|
$res=Db::table('q_user')->where('id',$user_id)->update(['headimg'=>$avatar,'nickname'=>$nickname,'phone'=>$decryptedData['phoneNumber']]);
|
|
|
if(empty($res)){
|
|
@@ -143,7 +153,7 @@ class Login extends Api
|
|
|
}
|
|
|
$data=$app->auth->session($code);
|
|
|
|
|
|
- // dump($data);die();
|
|
|
+
|
|
|
$user=Db::table('q_user')->where('openid',$data['openid'])->find();
|
|
|
if(empty($user)){
|
|
|
$id=Db::table('q_user')->insertGetId(['openid'=>$data['openid'],'session_key'=>$data['session_key']]);
|