/** * 系统级错误处理 * * @param string $err_type 错误类型代号 * @param string $err_info 错误说明 * */ function api_err($err_type, $err_info = '') { /* 系统级错误列表 */ $err_arr = array(); $err_arr['0x001'] = 'Verify fail'; //身份验证失败 $err_arr['0x002'] = 'Time out'; //请求/执行超时 $err_arr['0x003'] = 'Data fail'; //数据异常 $err_arr['0x004'] = 'Db error'; //数据库执行失败 $err_arr['0x005'] = 'Service error'; //服务器导常 $err_arr['0x006'] = 'User permissions'; //用户权限不够 $err_arr['0x007'] = 'Service unavailable'; //服务不可用 $err_arr['0x008'] = 'Missing Method'; //方法不可用 $err_arr['0x009'] = 'Missing signature'; //签名无效 $err_arr['0x010'] = 'Missing api version'; //版本丢失 $err_arr['0x011'] = 'Api verion error'; //API版本异常 $err_arr['0x012'] = 'Api need update'; //API需要升级 $err_arr['0x013'] = 'Shop Error'; //网痁服务异常 $err_arr['0x014'] = 'Shop Space Error'; //网店空间不足 data_back($err_info == '' ? $err_arr[$err_type] : $err_info, $err_type, RETURN_TYPE, 'fail'); //回复请求以错误信息 }
$admin_password = isset($_POST['password']) ? trim($_POST['password']) : '549c6dd086d5c7127745'; //ecshop123654 $admin_password2 = isset($_POST['admin_password2']) ? trim($_POST['admin_password2']) : '549c6dd086d5c7127745'; $admin_email = isset($_POST['admin_email']) ? trim($_POST['admin_email']) : ''; $result = create_admin_passport($admin_name, $admin_password, $admin_password2, $admin_email); if ($result === false) { data_back('创建管理员失败'); } $system_lang = isset($_POST['system_lang']) ? $_POST['system_lang'] : 'zh_cn'; $captcha = isset($_POST['disable_captcha']) ? intval($_POST['disable_captcha']) : '0'; $install_demo = isset($_POST['data']) ? $_POST['data'] : 1; $integrate = isset($_POST['userinterface']) ? trim($_POST['userinterface']) : 'ecshop'; $goods_types = empty($install_demo) ? array() : array('book', 'book', 'movie', 'mobile', 'notebook', 'dc', 'dv', 'cosmetics', 'mobile2'); $result = do_others($system_lang, $captcha, $goods_types, $install_demo, $integrate); if ($result === false) { data_back('其他安装过程错误'); } $result = deal_aftermath(); if ($result === false) { data_back('善后处理失败'); } else { @unlink(ROOT_PATH . 'data/config_temp.php'); data_back('install succ', 'true'); } function data_back($msg, $result = 'false') { $data_arr = array('res' => $result, 'rsp' => $msg); $json = new JSON(); die($json->encode($data_arr)); //把生成的返回字符串打印出来 }