public function pre_auth_uses() { if (!base_enterprise::ent_id() || !base_enterprise::ent_ac() || !base_enterprise::ent_email()) { //判断数据是否是中心过来的 return false; } else { base_enterprise::set_version(); base_enterprise::set_token(); if (!base_enterprise::is_valid('json', base_enterprise::ent_id())) { return false; } } return true; }
function active() { if ($_GET['ent_id'] && $_GET['ent_ac'] && $_GET['ent_sign'] && $_GET['ent_email']) { //判断数据是否是中心过来的 if (md5($_GET['ent_id'] . $_GET['ent_ac'] . 'ShopEXUser') == $_GET['ent_sign']) { //检测企业帐号是否正确 base_enterprise::set_version(); base_enterprise::set_token(); if (!base_enterprise::is_valid('json', $_GET['ent_id'])) { header("Content-type: text/html; charset=utf-8"); $active_url = kernel::router()->app->base_url(1) . '/index.php?app=entermembercenter&ctl=register'; header('Location:' . $active_url); exit; } else { $arr_enterprise = array('ent_id' => $_GET['ent_id'], 'ent_ac' => $_GET['ent_ac'], 'ent_email' => $_GET['ent_email']); base_enterprise::set_enterprise_info($arr_enterprise); if (!base_certificate::certi_id() || !base_certificate::token()) { $flag = base_certificate::register(); } if (!$flag) { header("Content-type: text/html; charset=utf-8"); $active_url = kernel::router()->app->base_url(1) . '/index.php?app=entermembercenter&ctl=register'; header('Location:' . $active_url); exit; } if (!base_shopnode::node_id() && base_certificate::certi_id() && base_certificate::token()) { $obj_buildin = kernel::single('base_shell_buildin'); $obj_buildin->command_active_node_id('ceti_node_id'); } } } } else { header("Content-type: text/html; charset=utf-8"); $active_url = kernel::router()->app->base_url(1) . '/index.php?app=entermembercenter&ctl=register'; header('Location:' . $active_url); exit; } $url = kernel::router()->gen_url(array(), 1); $url = base64_encode($url); $login_html = 'index.php?ctl=passport&act=index&url=' . $url; header("Content-type: text/html; charset=utf-8"); header('Location:' . $login_html); exit; }
public function success() { /** 获取证书,企业号的验证 **/ $active_url = kernel::base_url(1) . '/index.php/entermembercenter/default/active'; if ($_GET['ent_id'] && $_GET['ent_ac'] && $_GET['ent_sign'] && $_GET['ent_email']) { //判断数据是否是中心过来的 if (md5($_GET['ent_id'] . $_GET['ent_ac'] . 'ShopEXUser') == $_GET['ent_sign']) { //检测企业帐号是否正确 base_enterprise::set_version(); base_enterprise::set_token(); if (!base_enterprise::is_valid('json', $_GET['ent_id'])) { header("Content-type: text/html; charset=utf-8"); header('Location:' . $active_url); exit; } else { $arr_enterprise = array('ent_id' => $_GET['ent_id'], 'ent_ac' => $_GET['ent_ac'], 'ent_email' => $_GET['ent_email']); base_enterprise::set_enterprise_info($arr_enterprise); if (!base_enterprise::ent_id() || !base_enterprise::ent_email() || !base_enterprise::ent_ac()) { header("Content-type: text/html; charset=utf-8"); header('Location:' . $active_url); exit; } base_certificate::register(); if (base_certificate::certi_id() && base_certificate::token()) { $this->get_active_node_id(); } } } else { // 出现异常的情况 header("Content-type: text/html; charset=utf-8"); header('Location:' . $active_url); exit; } } else { header("Content-type: text/html; charset=utf-8"); header('Location:' . $active_url); exit; } $success_url = kernel::base_url(1) . '/index.php/setup/default/success'; header("Content-type: text/html; charset=utf-8"); header('Location:' . $success_url); exit; }
function command_active_cetificate($app_id = 'activeceti') { /** 安装完成后获取证书 **/ $args = func_get_args(); $options = $this->get_options(); $config = base_setup_config::deploy_info(); if ($options['options']) { parse_str($options['options'], $this->shell->input); } $install_options = array(); $tmp_arr_options = array(); foreach ((array) $config['active_ceti']['active_ceti_info'] as $key => $active_data) { $install_options[$key] = $active_data; } if (is_array($install_options) && count($install_options) > 0 && !$this->shell->input[$app_id]) { $this->shell->input_option($install_options, $app_id); } if ($this->shell->input[$app_id]) { kernel::log('Active cetificate...'); $api_data = array('certi_app' => 'ent.reg', 'email' => $this->shell->input[$app_id]['email'], 'password' => $this->shell->input[$app_id]['password'], 'tel' => $this->shell->input[$app_id]['tel'], 'province' => $this->shell->input[$app_id]['province'], 'version' => '1.0', 'format' => 'json'); ksort($api_data); foreach ($api_data as $key => $value) { $str .= $value; } base_enterprise::set_token(); $api_data['certi_ac'] = md5($str . base_enterprise::$token); $http = kernel::single('base_httpclient'); $http->set_timeout(6); $result = $http->post(SHOP_USER_ENTERPRISE_API, $api_data); $tmp_res = json_decode($result, 1); if ($tmp_res['res'] == 'succ') { $arr_enterprise = array('ent_id' => $tmp_res['msg']['entid'], 'ent_ac' => $tmp_res['msg']['password'], 'ent_email' => $tmp_res['msg']['email']); base_enterprise::set_enterprise_info($arr_enterprise); // 申请证书 if (base_enterprise::ent_id() && base_enterprise::ent_ac() && base_enterprise::ent_email()) { base_certificate::register(); // 申请应用的节点 $this->command_active_node_id('ceti_node_id'); } kernel::log('Application active cetificate... ok.'); } else { kernel::log('Application active cetificate... failed.'); } } }