private function updateUserInfo($ecid, $openId) { $token = $this->getAppToken($ecid); $weObj = new \Org\Weixin\Wechat(); if ($weObj->checkAuth($token['weixin_AppId'], $token['weixin_AppSecret'])) { $option = $weObj->getUserInfo($openId); $saveArr['nickname'] = $option['nickname']; $saveArr['sex'] = $option['sex']; $saveArr['language'] = $option['language']; $saveArr['city'] = $option['city']; $saveArr['province'] = $option['province']; $saveArr['country'] = $option['country']; $saveArr['headimgurl'] = $option['headimgurl']; M("Company_" . $ecid . "_user_info")->where("openId = '" . $openId . "'")->save($saveArr); } return $saveArr['nickname']; }
public function updateUserInfo() { $token = $this->getAppToken(session($this->_userCfg['ECID'])); $weObj = new \Org\Weixin\Wechat(); if ($weObj->checkAuth($token['weixin_AppId'], $token['weixin_AppSecret'])) { $option = $weObj->getUserInfo(I('post.openId')); $saveArr['nickname'] = $option['nickname']; $saveArr['sex'] = $option['sex']; $saveArr['language'] = $option['language']; $saveArr['city'] = $option['city']; $saveArr['province'] = $option['province']; $saveArr['country'] = $option['country']; $saveArr['headimgurl'] = $option['headimgurl']; M("Company_" . session($this->_userCfg['ECID']) . "_user_info")->where("openId = '" . I('post.openId') . "'")->save($saveArr); } }