diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 4eb1015a..46d18637 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -953,6 +953,8 @@ class ServiceController extends Zend_Controller_Action foreach ($matchs[1] as $k=>$v){ if($k < $max) $rev[$k]['url']=$v; } + }else{ + $error = "无搜索结果"; } if(preg_match_all("#(.+?)#i",$body,$matchs,PREG_PATTERN_ORDER)) @@ -962,7 +964,7 @@ class ServiceController extends Zend_Controller_Action } } - $response=array("result"=>$rev,"count"=>$max,"morelink"=>'http://search.cnki.net/search.aspx?q='.$keyword); + $response=array("result"=>$rev,"count"=>$max,"morelink"=>'http://search.cnki.net/search.aspx?q='.$keyword,"error"=>$error); $rev = Zend_Json::encode($response); return $rev; diff --git a/application/default/views/scripts/heihe/view.phtml b/application/default/views/scripts/heihe/view.phtml index 55f20468..3a905e22 100755 --- a/application/default/views/scripts/heihe/view.phtml +++ b/application/default/views/scripts/heihe/view.phtml @@ -91,7 +91,7 @@ else timebegin)) : ?>
  • 数据时间范围:timebegin));if (!empty($md->timeend)) echo " 至 ".date('Y-m-d',strtotime($md->timeend)); ?>
  • - + attachments) : ?>
  • 相关文档: attachments as $k=>$a) : ?> @@ -249,8 +249,8 @@ endforeach; -
    -downhistory) : ?> +
    +downhistory) : ?>

    最近10条服务记录如下:

      '.date("Y-m-d",strtotime($v->ts_created))." ".$v->unit." ".$v->realname.''; } ?> -
    - -暂时没有服务记录,欢迎您下载使用! + + +暂时没有服务记录,欢迎您下载使用!
    @@ -480,14 +480,20 @@ function cnkiSearch(keyword){ success:function(html){ var items = []; var obj = jQuery.parseJSON(html); - $.each(obj.result, function(key, val) { - var html = '

    '+val['title']+'

    ' - +val['url'].replace(/%(.*)/i,"") +'

    ' - +val['content'] - +'

    '; - - items.push('
  • ' + html + '
  • '); - }); + alert(obj.error); + if(obj.error != '') + { + items.push('
  • ' + obj.error + '
  • '); + }else{ + $.each(obj.result, function(key, val) { + var html = '

    '+val['title']+'

    ' + +val['url'].replace(/%(.*)/i,"") +'

    ' + +val['content'] + +'

    '; + + items.push('
  • ' + html + '
  • '); + }); + } items.push('
  • 查看更多搜索结果'); $('#searchlist').html(items.join('')); $('html, body').animate({scrollTop:$('html').height()}, 'slow');