/** * 检查用户是否登陆过 */ public function checkUserLogin($openId) { try { // if(DW_ENV_DEBUG){ //测试环境没有unionid $userOauth = $this->userModel->getByOpenId($openId); // }else{ // $userInfo = $this->wechat->getUserInfo($openId); // $userOauth = $this->userModel->getUserOauthByUnionIdAndVender($userInfo['unionid'],UserOauthEntity::VENDER_WECHAT); // } if (!$userOauth) { //提示用户 去绑定帐号 $rst = $this->wechat->textReply('您好,继续其他操作请先绑定账号:' . 'http://' . $_SERVER['SERVER_NAME'] . '/user/bind'); return false; } else { //如果用户存在,则直接去登陆一下 } } catch (\Exception $e) { $this->wechat->log($e->getMessage()); } return true; }