...
|
...
|
@@ -89,7 +89,33 @@ class OpenServerController extends HomeBaseController |
|
|
真正让家长省心,孩子无忧。感谢关注。';
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 'scan':
|
|
|
//获取用户openid
|
|
|
$openid=$message->FromUserName;
|
|
|
cache('openid',$openid);
|
|
|
$param=substr($message->EventKey,8);
|
|
|
$data = explode("-",$param);
|
|
|
$my_user_id = $data[0];
|
|
|
$status = $data[1];
|
|
|
$third_party_user = Db::name('third_party_user')->where('openid',$openid)->find();
|
|
|
if(!$third_party_user){
|
|
|
//获取用户信息
|
|
|
$options=config('wechat_config');
|
|
|
$app = new Application($options);
|
|
|
$accessToken = $app->access_token; // EasyWeChat\Core\AccessToken 实例
|
|
|
$token = $accessToken->getToken(false);
|
|
|
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=$token&openid=$openid&lang=zh_CN";
|
|
|
$user_data = json_decode($this->http_get($url),true);
|
|
|
$user_id = $this->new_user($user_data,$openid,$options['app_id']);
|
|
|
}else{
|
|
|
$user_id = $third_party_user['user_id'];
|
|
|
}
|
|
|
$new_data = [
|
|
|
'my_user_id' => $my_user_id,
|
|
|
'status_id' => $status,
|
|
|
];
|
|
|
$this->bind($user_id,$new_data);
|
|
|
break;
|
|
|
default:
|
|
|
// return '收到event消息';
|
|
|
break;
|
...
|
...
|
|