1]; $getNavigation = model('Navigation')->getSelect($navigationField, $navigationWhere); $this->assign('navigation', $getNavigation); // 导航Id. $navigationId = [ 'home', 'service', 'count', 'about-us', 'contact', 'pricing', ]; $this->assign('navigationId', $navigationId); // 获取未显示在导航的标题. $navigationWhere = ['navigation_type' => 2]; $getNavigation = model('Navigation')->getSelect($navigationField, $navigationWhere); $this->assign('navigationTitle', $getNavigation); // 主获取页主介绍. $getIndexIntroduceSlt = ['product_ctitle']; $getIndexIntroduceWhr['product_type'] = 1; $getIndexIntroduce = model('Product')->getSelect($getIndexIntroduceSlt, $getIndexIntroduceWhr); $getIndexIntroduceArr = explode("@#", $getIndexIntroduce[0]['product_ctitle']); $this->assign('indexIntroduceArr', $getIndexIntroduceArr); // 获取服务. $getServiceSlt = [ 'product_ctitle', 'product_title', ]; $getServiceWhr['product_type'] = 2; $getService = model('Product')->getSelect($getServiceSlt, $getServiceWhr); $this->assign('service', $getService); // 获取解决方案. $getSolutionSlt = ['product_title']; $getSolutionWhr['product_type'] = 4; $getSolution = model('Product')->getSelect($getSolutionSlt, $getSolutionWhr); $this->assign('solution', $getSolution); // 获取案例展示. $getCaseSlt = [ 'product_title', 'product_ctitle', ]; $getCaseWhr['product_type'] = 3; $getCase = model('Product')->getSelect($getCaseSlt, $getCaseWhr); $this->assign('case', $getCase); // 合作流程. $getCooperationProcessSlt = ['product_title']; $getCooperationProcessWhr['product_type'] = 7; $getCooperationProcess = model('Product')->getSelect($getCooperationProcessSlt, $getCooperationProcessWhr); $this->assign('cooperationProcess', $getCooperationProcess); // 获取foot. $getFootSlt = [ 'value', 'remark', ]; $getFootWhr = [ ['code' => 'site_phone'], ['code' => 'site_email'], ['code' => 'fax'], ]; $getFoot = model('Config')->getSelect($getFootSlt, $getFootWhr); $this->assign('foot', $getFoot); return $this->fetch(); }//endindex() /** * 用户留言 * * @access public * @return array JsonString */ public function userNeeds() { if (request()->isPost() === true) { $name = input('post.name'); $email = input('post.email'); $phone = input('post.phone'); $content = input('post.content'); $data = array( 'message_customer' => $name, 'message_email' => $email, 'message_phone' => $phone, 'message_content' => $content, ); // 验证数据 BEGIN. $rule = [ ['message_customer', 'require', '称呼不能为空'], ['message_email', 'email', '邮箱格式不符合要求'], ['message_phone', 'require', '电话不能为空'], ['message_content', 'require', '需求不能为空'], ]; $validate = new Validate($rule); $validate_result = $validate->check($data); // 验证失败. if ($validate_result === false) { $result = [ 'code' => 601, 'msg' => $validate->getError(), 'success' => false, 'data' => [], ]; return json_encode($result); }//end if $data['message_addtime'] = time(); $getAddId = model('Message')->addMessage($data); if (empty($getAddId) === false) { $result = [ 'code' => 200, 'msg' => '操作成功', 'success' => true, 'data' => [], ]; return json_encode($result); } else { $result = [ 'code' => 601, 'msg' => '操作失败', 'success' => false, 'data' => [], ]; return json_encode($result); } }//end if }//end userNeeds() /** * 修改密码 */ public function modifypw() { if (request()->isPost()) { $new_pw = trim(input('post.new_pw')); $new_pw2 = trim(input('post.new_pw2')); $old_pw = trim(input('post.old_pw')); if ($new_pw !== $new_pw2) { $this->error(lang('index_modifypw_repeat_error')); } $admininfo = $this->getAdminInfo(); //查询管理员信息 $service_model = model('service'); $admininfo = $service_model->getserviceInfo(array('service_id' => $admininfo['service_id'])); if (!is_array($admininfo) || count($admininfo) <= 0) { $this->error(lang('index_modifypw_admin_error')); } //旧密码是否正确 if ($admininfo['service_password'] != md5($old_pw)) { $this->error(lang('index_modifypw_oldpw_error')); } $new_pw = md5($new_pw); $result = $service_model->editService(array('service_id' => $admininfo['service_id']), array('service_password' => $new_pw)); if ($result) { session(null); dsLayerOpenSuccess(lang('index_modifypw_succ')); } else { $this->error(lang('index_modifypw_fail')); } } else { $this->setAdminCurItem('modifypw'); return $this->fetch(); } } /** * 首页 * @return mixed */ // public function welCome() // { // $setup_date = config('setup_date'); // $statistics['os'] = PHP_OS; // $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE']; // $statistics['php_version'] = PHP_VERSION; // $statistics['sql_version'] = $this->_mysql_version(); // $statistics['setup_date'] = substr($setup_date, 0, 10); // $statistics['domain'] = $_SERVER['HTTP_HOST']; // $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']); // $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib // $statistics['safe_mode'] = (boolean)ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off // $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone"; // $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO'; // $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown'; // $statistics['max_ex_time'] = @ini_get("max_execution_time") . 's'; //脚本最大执行时间 // $statistics['set_time_limit'] = function_exists("set_time_limit") ? true : false; // $statistics['memory_limit'] = ini_get('memory_limit'); // $statistics['version'] = file_get_contents(APP_PATH . 'version.php'); // if (function_exists("gd_info")) { // $gd = gd_info(); // $statistics['gdinfo'] = $gd['GD Version']; // } else { // $statistics['gdinfo'] = lang('Unknown'); // } // $this->assign('statistics', $statistics); // return $this->fetch('welcome'); // } private function _mysql_version() { $version = db()->query("select version() as ver"); return $version[0]['ver']; } /** * 修改当前语言 */ public function setLanguageCookie() { $language = input('param.language'); if ($language == config('default_lang')) { $this->error(\lang('ds_language_repetition'), url('Index/index')); exit(); } setcookie("ds_admin_lang", $language, 0, '/'); $this->success(\lang('ds_language_switching'), url('Index/index')); exit(); } /** * 删除缓存 */ function clear() { $this->delCacheFile('temp'); $this->delCacheFile('cache'); Cache::clear(); ds_json_encode(10000, lang('eliminate_succ')); exit(); } /** * 删除缓存目录下的文件或子目录文件 * * @param string $dir 目录名或文件名 * @return boolean */ function delCacheFile($dir) { //防止删除cache以外的文件 if (strpos($dir, '..') !== false) return false; $path = RUNTIME_PATH . '/' . $dir; if (is_dir($path)) { $file_list = array(); read_file_list($path, $file_list); if (!empty($file_list)) { foreach ($file_list as $v) { if (basename($v) != 'index.html') @unlink($v); } } } else { if (basename($path) != 'index.html') @unlink($path); } return true; } }