提交 5142e8c6 编写于 作者: huangxuan258's avatar huangxuan258

优化专家列表,防止数据太大卡顿

上级 88c4632f
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('P_VERSION') OR define('P_VERSION', 'mf');
defined('URL_SPLIT_STR') OR define('URL_SPLIT_STR', '/');
defined('XUNSEARCH_QUESTIONFILENAME') OR define('XUNSEARCH_QUESTIONFILE', 'question');
defined('XUNSEARCH_ARTICLEFILENAME') OR define('XUNSEARCH_ARTICLEFILENAME', 'topic');
define('ASK2_CHARSET', 'UTF-8');
define('ASK2_VERSION', '4.1');
define('ASK2_RELEASE', '20191230');
\ No newline at end of file
defined('XUNSEARCH_QUESTIONFILE') OR define('XUNSEARCH_QUESTIONFILE', 'question');
defined('XUNSEARCH_ARTICLEFILENAME') OR define('XUNSEARCH_ARTICLEFILENAME', 'topic');
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('P_VERSION') OR define('P_VERSION', 'mf');
defined('URL_SPLIT_STR') OR define('URL_SPLIT_STR', '/');
defined('XUNSEARCH_QUESTIONFILENAME') OR define('XUNSEARCH_QUESTIONFILE', 'question');
defined('XUNSEARCH_ARTICLEFILENAME') OR define('XUNSEARCH_ARTICLEFILENAME', 'topic');
define('ASK2_CHARSET', 'UTF-8');
define('ASK2_VERSION', '4.1');
define('ASK2_RELEASE', '20191230');
\ No newline at end of file
defined('XUNSEARCH_QUESTIONFILE') OR define('XUNSEARCH_QUESTIONFILE', 'question');
defined('XUNSEARCH_ARTICLEFILENAME') OR define('XUNSEARCH_ARTICLEFILENAME', 'topic');
\ No newline at end of file
......@@ -61,7 +61,7 @@ class Expert extends CI_Controller {
$rownum = $cid == 'all' ? returnarraynum ( $this->db->query ( getwheresql ( 'user', " expert=1 " . $orderwhere , $this->db->dbprefix ) )->row_array () ) : returnarraynum ( $this->db->query ( getwheresql ( 'user', " expert=1 " . $orderwhere . "and uid IN (SELECT uid FROM " . $this->db->dbprefix . "user_category WHERE cid=$cid)" , $this->db->dbprefix ) )->row_array () );
$expertlist = $this->expert_model->get_list ( 1, $startindex, $pagesize, $cid, $status );
$departstr = page ( $rownum, $pagesize, $page, "expert/default/$cid/$status" );
$questionlist = $this->expert_model->get_solves ( 0, 15 );
include template ( 'expert' );
}
......
......@@ -319,6 +319,19 @@ function getcaturl($catid, $url, $userdir = true) {
function url($var, $url = '') {
global $setting;
$_fix = '';
//文章id转加密
// if (strstr ( $var, 'topic/getone' )) {
// $_urlparms=explode('/', $var);
// if(is_array($_urlparms)){
// $_aid=intval($_urlparms[2]);
// if($_aid){
// $var="topic/getone/".endecodeID($_urlparms[2]);
// }
// //runlog('url', $var."--".$_urlparms[2]."--".endecodeID($_urlparms[2])."--".endecodeID("52AA7C63A15026736486F2",'decode'));
// }
// }
if (strstr ( $var, 'seo/index' ) || strstr ( $var, 'ask/index' ) || strstr ( $var, 'category/view' ) || strstr ( $var, 'topic/catlist' )) { // 去掉文章栏目和问题栏目的url尾巴
} else {
......@@ -336,7 +349,7 @@ function url($var, $url = '') {
}
$location = urlmap ( $location, 2 );
if (strstr ( trim ( config_item ( 'mobile_domain' ) ), $_SERVER ['SERVER_NAME'] )) {
if (strstr ( trim ( config_item ( 'mobile_domain' ) ),$_SERVER ['HTTP_HOST'] )) {
if (config_item ( 'mobile_domain' )) {
return config_item ( 'mobile_domain' ) . $location;
......@@ -358,6 +371,7 @@ if (! function_exists ( 'updateinfo' )) {
*/
function updateinfo($user) {
global $setting;
defined('P_VERSION') OR define('P_VERSION', 'null');
$CI = & get_instance ();
$sitename = $setting ['site_name'];
$siturl = $_SERVER ['HTTP_HOST'];
......@@ -365,7 +379,7 @@ if (! function_exists ( 'updateinfo' )) {
'sitename' => $sitename,
'siteurl' => $siturl,
'email' => $user ['email'],
'version' => ASK2_VERSION,
'version' => P_VERSION.ASK2_VERSION,
'release' => ASK2_RELEASE,
'phpos' => PHP_OS,
'phpversion' => phpversion (),
......@@ -375,7 +389,7 @@ if (! function_exists ( 'updateinfo' )) {
'phone' => urlencode ( $user ['phone'] )
);
$data = http_build_query ( $pars );
return 'https://www.ask2.cn/updatesite.php?' . $data;
return 'https://wenda.whatsns.com/updatesite.php?' . $data;
}
}
/*
......@@ -519,7 +533,7 @@ function clearhtml($miaosu, $len = '200') {
}
function generate_key() {
$random = random ( 20 );
$info = md5 ( $_SERVER ['SERVER_SOFTWARE'] . $_SERVER ['SERVER_NAME'] . $_SERVER ['SERVER_ADDR'] . $_SERVER ['SERVER_PORT'] . $_SERVER ['HTTP_USER_AGENT'] . time () );
$info = md5 ( $_SERVER ['SERVER_SOFTWARE'] . $_SERVER ['HTTP_HOST'] . $_SERVER ['SERVER_ADDR'] . $_SERVER ['SERVER_PORT'] . $_SERVER ['HTTP_USER_AGENT'] . time () );
$return = '';
for($i = 0; $i < 64; $i ++) {
$p = intval ( $i / 2 );
......@@ -799,8 +813,8 @@ if (! function_exists ( 'template' )) {
if ($tpldir == '')
$tpl_dir = $setting ['tpl_dir'];
}
// if (! empty ( config_item ( 'mobile_domain' ) ) && $_SERVER ['SERVER_NAME']) {
if (strstr ( trim ( config_item ( 'mobile_domain' ) ), $_SERVER ['SERVER_NAME'] )) {
// if (! empty ( config_item ( 'mobile_domain' ) ) && $_SERVER ['HTTP_HOST']) {
if (strstr ( trim ( config_item ( 'mobile_domain' ) ),$_SERVER ['HTTP_HOST'] )) {
$tpldir = $setting ['tpl_wapdir'];
}
// }
......@@ -808,6 +822,11 @@ if (! function_exists ( 'template' )) {
if (strstr ( $setting ['tpl_dir'], 'responsive_' )) {
$tpldir = $setting ['tpl_dir'];
}
if ($_SESSION ['themename'] && ! is_mobile ()) {
$tpldir = $_SESSION ['themename'];
}
$querystring = isset ( $_SERVER ['REQUEST_URI'] ) ? $_SERVER ['REQUEST_URI'] : '';
$querystring = str_replace ( '.html', '', $querystring );
$querystring = str_replace ( '/?', '', $querystring );
......@@ -1009,6 +1028,34 @@ function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
return $keyc . str_replace ( '=', '', base64_encode ( $result ) );
}
}
/**
* 加密解密id,
* @param unknown $string
* @param string $action encode|decode
* @return string
*/
function endecodeID($string, $action = 'encode') {
$startLen = 13;
$endLen = 8;
$coderes = '';
#TOD 暂设定uid字符长度最大到9
if ($action=='encode') {
$uidlen = strlen($string);
$salt = 'whatsns';
$codestr = $string.$salt;
$encodestr = hash('md4', $codestr);
$coderes = $uidlen.substr($encodestr, 5,$startLen-$uidlen).$string.substr($encodestr, -12,$endLen);
}elseif($action=='decode'){
$string=strtoupper($string);
$strlen = strlen($string);
$uidlen = $string[0];
$coderes = substr($string, $startLen-$uidlen+1,$uidlen);
}
return $coderes;
}
function encode($string = '', $skey = 'mishen') {
$strArr = str_split ( base64_encode ( $string ) );
$strCount = count ( $strArr );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册