qq_1020788318 2022-03-11 17:06 采纳率: 100%
浏览 17
已结题

悬赏==问题1、搜索范围是商品 2、实时统计各省份商品数量 3、优化商品页面打开速度、优化商品检索响应速度

需求1:默认/其它情况下,搜索范围是商品

logo.htm

<div class="btn-group">
                        <button type="button" id="searchType" class="btn btn-default dropdown-toggle cus_btn " data-toggle="dropdown">
                            {if $do == 'goodslist'}商品
                            {elseif $do == 'tasklist'}求购
                            {elseif $do == 'sellerlist'}供应商
                            {elseif $do == 'pubtask'}商品
                            {else}
                            {if $task_open&&$shop_open}采购
                            {elseif !$task_open&&$shop_open}商品2
                            {/if}
                            {/if}
                        <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" id="searchOption">
                            {if $task_open}
                            <li {if $do  == 'tasklist'}class="active"{/if}>
                                <a href="javascript:void(0);" rel="tasklist">求购</a>
                            </li>
                            {/if}
                            {if $shop_open}
                            <li {if $do  == 'goodslist'}class="active"{/if}>
                                <a href="javascript:void(0);" rel="goodslist">商品</a>
                            </li>
                            {/if}
                            <li {if $do  == 'sellerlist'}class="active"{/if}>
                                <a href="javascript:void(0);" rel="sellerlist">供应商</a>
                            </li>
                        </ul>
                    </div>

<script type="text/javascript">
        function searchlist(){
               var ky=$("#search").val();
               var searchvalue1=$("#searchOption li:first").hasClass('active');
               var searchvalue2=$("#searchOption li:eq(1)").hasClass('active');
            var searchvalue3=$("#searchOption li:eq(2)").hasClass('active');
            var ky=$("#search").val();
            if(searchvalue1==true){
                   search='1';
               }else if(searchvalue3==true){
                   search='3';
               }else{
                search='2';
            }
            $.post("index.php?do=searchlist&ky="+ky,{search:search},function(data){
                if(data){
                    $("#hotsearch").replaceWith(data);
                    $("#div_search_input").addClass('open');
                }else{
                    $("#hotsearch").hide();
                }

            })
             $("#searchOption>li").click(function(){
                   if($(this).hasClass('active')==true){
                       if($(this).text().contains('求购')){
                           $.post("index.php?do=searchlist&ky="+ky,{search:1},function(data){
                               $("#hotsearch").replaceWith(data);
                        })
                    }else if($(this).text().contains('供应商')){
                        $.post("index.php?do=searchlist&ky="+ky,{search:3},function(data){
                            $("#hotsearch").replaceWith(data);
                        })
                    }else{
                           $.post("index.php?do=searchlist&ky="+ky,{search:2},function(data){
                               $("#hotsearch").replaceWith(data);
                           })
                       }
                }
            });
        }
    </script>

需求2:实时统计各省份商品数量,数量为0的省份不显示

;tpl/default/goodslist.htm
;control/goodslist.php

{if $arrCountP1['$ky']}<a href="{$strUrl}&p=1" {if 1==$p} class="selected" {/if}>北京市($arrCountP1['$ky'])</a>{/if}
{if $arrCountP2['$ky']}<a href="{$strUrl}&p=2" {if 2==$p} class="selected" {/if}>天津市($arrCountP2['$ky'])</a>{/if}
{if $arrCountP3['$ky']}<a href="{$strUrl}&p=3" {if 3==$p} class="selected" {/if}>河北省($arrCountP3['$ky'])</a>{/if}
{if $arrCountP4['$ky']}<a href="{$strUrl}&p=4" {if 4==$p} class="selected" {/if}>山西省($arrCountP4['$ky'])</a>{/if}
{if $arrCountP5['$ky']}<a href="{$strUrl}&p=5" {if 5==$p} class="selected" {/if}>内蒙古($arrCountP5['$ky'])</a>{/if}
{if $arrCountP6['$ky']}<a href="{$strUrl}&p=6" {if 6==$p} class="selected" {/if}>辽宁省($arrCountP6['$ky'])</a>{/if}
{if $arrCountP7['$ky']}<a href="{$strUrl}&p=7" {if 7==$p} class="selected" {/if}>吉林省($arrCountP7['$ky'])</a>{/if}
{if $arrCountP8['$ky']}<a href="{$strUrl}&p=8" {if 8==$p} class="selected" {/if}>黑龙江省($arrCountP8['$ky'])</a>{/if}
{if $arrCountP9['$ky']}<a href="{$strUrl}&p=9" {if 9==$p} class="selected" {/if}>上海市($arrCountP9['$ky'])</a>{/if}
{if $arrCountP10['$ky']}<a href="{$strUrl}&p=10" {if 10==$p} class="selected" {/if}>江苏省($arrCountP10['$ky'])</a>{/if}
{if $arrCountP11['$ky']}<a href="{$strUrl}&p=11" {if 11==$p} class="selected" {/if}>浙江省($arrCountP11['$ky'])</a>{/if}
{if $arrCountP12['$ky']}<a href="{$strUrl}&p=12" {if 12==$p} class="selected" {/if}>安徽省($arrCountP12['$ky'])</a>{/if}
{if $arrCountP13['$ky']}<a href="{$strUrl}&p=13" {if 13==$p} class="selected" {/if}>福建省($arrCountP13['$ky'])</a>{/if}
{if $arrCountP14['$ky']}<a href="{$strUrl}&p=14" {if 14==$p} class="selected" {/if}>江西省($arrCountP14['$ky'])</a>{/if}
{if $arrCountP15['$ky']}<a href="{$strUrl}&p=15" {if 15==$p} class="selected" {/if}>山东省($arrCountP15['$ky'])</a>{/if}
{if $arrCountP16['$ky']}<a href="{$strUrl}&p=16" {if 16==$p} class="selected" {/if}>河南省($arrCountP16['$ky'])</a>{/if}
{if $arrCountP17['$ky']}<a href="{$strUrl}&p=17" {if 17==$p} class="selected" {/if}>湖北省($arrCountP17['$ky'])</a>{/if}
{if $arrCountP18['$ky']}<a href="{$strUrl}&p=18" {if 18==$p} class="selected" {/if}>湖南省($arrCountP18['$ky'])</a>{/if}
{if $arrCountP19['$ky']}<a href="{$strUrl}&p=19" {if 19==$p} class="selected" {/if}>广东省($arrCountP19['$ky'])</a>{/if}
{if $arrCountP20['$ky']}<a href="{$strUrl}&p=20" {if 20==$p} class="selected" {/if}>广西省($arrCountP20['$ky'])</a>{/if}
{if $arrCountP21['$ky']}<a href="{$strUrl}&p=21" {if 21==$p} class="selected" {/if}>海南省($arrCountP21['$ky'])</a>{/if}
{if $arrCountP22['$ky']}<a href="{$strUrl}&p=22" {if 22==$p} class="selected" {/if}>重庆市($arrCountP22['$ky'])</a>{/if}
{if $arrCountP23['$ky']}<a href="{$strUrl}&p=23" {if 23==$p} class="selected" {/if}>四川省($arrCountP23['$ky'])</a>{/if}
{if $arrCountP24['$ky']}<a href="{$strUrl}&p=24" {if 24==$p} class="selected" {/if}>贵州省($arrCountP24['$ky'])</a>{/if}
{if $arrCountP25['$ky']}<a href="{$strUrl}&p=25" {if 25==$p} class="selected" {/if}>云南省($arrCountP25['$ky'])</a>{/if}
{if $arrCountP26['$ky']}<a href="{$strUrl}&p=26" {if 26==$p} class="selected" {/if}>西藏($arrCountP26['$ky'])</a>{/if}
{if $arrCountP27['$ky']}<a href="{$strUrl}&p=27" {if 27==$p} class="selected" {/if}>陕西省($arrCountP27['$ky'])</a>{/if}
{if $arrCountP28['$ky']}<a href="{$strUrl}&p=28" {if 28==$p} class="selected" {/if}>甘肃省($arrCountP28['$ky'])</a>{/if}
{if $arrCountP29['$ky']}<a href="{$strUrl}&p=29" {if 29==$p} class="selected" {/if}>青海省($arrCountP29['$ky'])</a>{/if}
{if $arrCountP30['$ky']}<a href="{$strUrl}&p=30" {if 30==$p} class="selected" {/if}>宁夏省($arrCountP30['$ky'])</a>{/if}
{if $arrCountP31['$ky']}<a href="{$strUrl}&p=31" {if 31==$p} class="selected" {/if}>新疆($arrCountP31['$ky'])</a>{/if}
{if $arrCountP32['$ky']}<a href="{$strUrl}&p=32" {if 32==$p} class="selected" {/if}>台湾省($arrCountP32['$ky'])</a>{/if}
{if $arrCountP33['$ky']}<a href="{$strUrl}&p=33" {if 33==$p} class="selected" {/if}>香港($arrCountP33['$ky'])</a>{/if}
{if $arrCountP34['$ky']}<a href="{$strUrl}&p=34" {if 34==$p} class="selected" {/if}>澳门($arrCountP34['$ky'])</a>{/if}
{if $arrCountP35['$ky']}<a href="{$strUrl}&p=35" {if 35==$p} class="selected" {/if}>海外($arrCountP35['$ky'])</a>{/if}
{if $arrCountP36['$ky']}<a href="{$strUrl}&p=36" {if 36==$p} class="selected" {/if}>其他($arrCountP36['$ky'])</a>{/if}

$arrCountP1= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat like '$ky' and province =1  " );
$arrCountP2= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat like '$ky' and province =2  " );
$arrCountP3= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat like '$ky' and province =3  " );
$arrCountP4= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat like '$ky' and province =4  " );
$arrCountP5= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =5  " );
$arrCountP6= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =6  " );
$arrCountP7= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =7  " );
$arrCountP8= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =8  " );
$arrCountP9= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =9  " );
$arrCountP10= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =10  " );
$arrCountP11= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =11  " );
$arrCountP12= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =12  " );
$arrCountP13= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =13  " );
$arrCountP14= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =14  " );
$arrCountP15= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =15  " );
$arrCountP16= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =16  " );
$arrCountP17= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =17  " );
$arrCountP18= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =18  " );
$arrCountP19= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =19  " );
$arrCountP20= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =20  " );
$arrCountP21= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =21  " );
$arrCountP22= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =22  " );
$arrCountP23= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =23  " );
$arrCountP24= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =24  " );
$arrCountP25= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =25  " );
$arrCountP26= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =26  " );
$arrCountP27= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =27  " );
$arrCountP28= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =28  " );
$arrCountP29= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =29  " );
$arrCountP30= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =30  " );
$arrCountP31= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =31  " );
$arrCountP32= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =32  " );
$arrCountP33= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =33  " );
$arrCountP34= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =34  " );
$arrCountP35= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =35  " );
$arrCountP36= db_factory::get_count ( "select count(*) from " . TABLEPRE . "witkey_service where cat = '$ky' and province =36  " );

需求3:优化商品页面打开速度、优化商品检索响应速度

;control/goodslist.php

;tpl/default/goodslist.htm

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 3月19日
    • 修改了问题 3月11日
    • 创建了问题 3月11日

    悬赏问题

    • ¥15 有人会用py或者r画这种图吗
    • ¥15 MOD04_3K图像预处理
    • ¥15 [VASP]关于超胞大小和k 点网格的收敛性测试
    • ¥15 pip下载paddle2onnx离谱错误
    • ¥60 db2move nlzxams import 导出db2备份数据报错
    • ¥15 关于#python#的问题:全文总结功能咨询
    • ¥15 俄罗斯方块中无法同时消除多个满行
    • ¥15 使用gojs3.0,如何在nodeDataArray设置好text的位置,再go.TextBlock alignment中进行相应的改变
    • ¥15 psfusion图像融合指标很低
    • ¥15 银河麒麟linux系统如何修改/etc/hosts权限为777