public static function bindAction($controller, $con, $appid, $openid, $params) { $re = array("returncode" => "0000"); try { $bindinfo = $params->get("auth"); $bindinfo = explode(",", $bindinfo); $bind_uid = $bindinfo[0]; $authkey = count($bindinfo) == 1 ? "" : DES::encrypt($bindinfo[1]); $app = new \Justsy\BaseBundle\Management\App($controller->container); $appdata = $app->getappinfo(array("appid" => $appid)); //获取应用信息 //自动身份认证 $cookie_key = self::$bind_type . "_" . $openid; $loginUrl = $appdata["authorization_url"]; if (!empty($loginUrl)) { $authResult = Utils::do_get_request_cookie($loginUrl . "&" . http_build_query(array("uid" => $bind_uid, "upwd" => md5(DES::decrypt($authkey)))), null, null, $cookie_key); $authResult = json_decode($authResult, true); if (!isset($authResult["islogin"]) || $authResult["islogin"] != "1") { return $controller->render("JustsyBaseBundle:AppCenter:h5bundle.html.twig", array('appid' => $appid, 'openid' => $openid, 'errormsg' => '绑定的帐号或密码不正确', 'ssomodule' => self::$bind_type . "Controller")); } } $app->setappbind(array("appid" => $appid, "openid" => $openid, "bind_type" => self::$bind_type, "bind_uid" => $bind_uid, "authkey" => $authkey)); } catch (\Exception $e) { $response = new Response($e->getMessage()); $response->headers->set('Content-Type', 'text/html'); return $response; } return self::responseJson(json_encode($re)); }