public function vartotojai() { $page = new AdminPage(); $panel = new Users(); $panel1 = new UserManage(); $page->addToContainer(1, $panel->getHtml()); $page->addToContainer(2, $panel1->getHtml()); $page->pagePrint(); }
/** * Description: 获取用户信息 通过 - snsapi_base。即不弹出授权认证 * @param $code getCode()获得,采用跳转方式,需要自行$_GET先获得 * @param Array */ public static function getUserInfoBySnsapiBase($code, $uri) { //获取OpenId $openId = self::getAccessTokenAndOpenId($code); //如果code无效,则重新获取code if (isset($openId['errcode']) && ($openId['errcode'] = 40029)) { WeChatOAuth::getCode($uri); } if (empty($openId['openid'])) { die('获取微信授权失败,请回到微信界面重新进入!无效openid'); } $openId = $openId['openid']; //根据OpenId获取用户信息 return UserManage::getUserInfo($openId); }
/** * @descrpition 扫描二维码关注(未关注时) * @param $request * @return array */ public static function eventQrsceneSubscribe(&$request) { /* *用户扫描带参数二维码进行自动分组 *此处添加此代码是大多数需求是在扫描完带参数二维码之后对用户自动分组 */ $sceneid = str_replace("qrscene_", "", $request['eventkey']); //移动用户到相应分组中去,此处的$sceneid依赖于之前创建时带的参数 if (!empty($sceneid)) { UserManage::editUserGroup($request['fromusername'], $sceneid); $result = UserManage::getGroupByOpenId($request['fromusername']); //方便开发人员调试时查看参数正确性 $content = '欢迎您关注我们的微信,将为您竭诚服务。二维码Id:' . $result['groupid']; } else { $content = '欢迎您关注我们的微信,将为您竭诚服务。'; } return ResponsePassive::text($request['fromusername'], $request['tousername'], $content); }
/** * @descrpition 扫描二维码关注(未关注时) * @param $request * @return array */ public static function eventQrsceneSubscribe(&$request) { $content = '欢迎您关注我们的微信,将为您竭诚服务,功能开发测试中,访问 <a href="http://www.zhuangxiuji.com.cn/cms/">微官网</a>'; //关注的时候用户信息存入数据库 if (!UserManage::isUserExists($request['fromusername'])) { UserManage::addUser($request['fromusername']); } else { $userinfo = UserManage::getUserInfo($request['fromusername']); UserManage::updateUserData($userinfo); } return ResponsePassive::text($request['fromusername'], $request['tousername'], $content); }