<div class="col-xs-24" style="padding-left:100px;min-height:1000px;">
  <p> <br />
  </p>
  <h1> <span style="font-family:Microsoft YaHei;">广告管理系统使用说明文档</span> </h1>
  <div class="col-xs-24 nopadding">
    <p>
    <p class="col-xs-24 btn-lg"></p>
    <a href="http://www.diychinatours.com/diy-xian/single-city-tour/xa-1.htm" target="_blank">
        DEMO：页面右侧栏底部是广告
    </a>
    <p class="col-xs-24 btn-lg"></p>
    </p>
  </div>
  <h3>一. 广告填写注意事项</h3>
  <p>1.择选广告关联的信息页面的时候，如果是手工页面，也就是不在信息平台里面的，请填写该页面的url链接；</p>
  <p>2.如果是信息平台里面的信息页面，可以选择填页面的url链接，也可以填它在信息平台里的信息内容ID，就是信息标题旁边那个ID；</p>
  <p>3.信息平台里面的信息有url的话，建议优先填url，没有url的信息再填信息ID;</p>
  <p> <img src="/css/images/adpng.png"> </p>
  <h3>二. 读取广告到网前的规则(可以按照各站的策略自行决定，此处只是举个例子)</h3>
  <p>1.查看当前页面是否在广告系统里关联了广告；</p>
  <p>2.如果有关联广告，则直接读取该广告到网前；</p>
  <p>3.如果没有关联广告，并且当前页面信息存在于信息平台，则查看它的父节点是否关联了广告，优先读取最接近的父级节点的广告；</p>
  <h3>二. 读取广告到网前及点击效果跟踪</h3>
  <div class="well col-xs-16" style="line-height:12px;">
    <style type="text/css">
        p{margin-bottom: 5px;}
    </style>
    <h4> 网前JS调用广告 </h4>
    <p> &lt;script type=&quot;text/javascript&quot;&gt; </p>
    <p> function get_advertise()&nbsp; </p>
    <p> { </p>
    <p> &nbsp; &nbsp; var url=&quot;&lt;?php echo site_url(&#39;index.php/diy_tour/ajax/get_advertise&#39;); ?&gt;&quot;; </p>
    <p> &nbsp; &nbsp; var pageurl=location.href; </p>
    <p> &nbsp; &nbsp; $.post(url,{&quot;pageurl&quot;:pageurl},function(json_data) { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;if (!json_data) return false; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;var json_data = $.parseJSON(json_data); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;for (var key in json_data) { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;var ad_place=json_data[key].ad_place; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;var ad_content=&#39;&lt;div class=&quot;advertise_elem&quot; data-ad_id=&quot;&#39;+json_data[key][ad_place].adp_id+&#39;&quot;&gt;&#39;+json_data[key][ad_place].ad_content+&#39;&lt;/div&gt;&#39;; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;//在对应的地方填充广告 </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;if (ad_place==&#39;right_nav_bottom&#39;){ </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;&nbsp; &nbsp; $(&quot;.circuit_price&quot;).after(ad_content); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;}else if (ad_place==&#39;centent_bottom&#39;){ </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;&nbsp; &nbsp; $(&quot;#included&quot;).after(ad_content); &nbsp; &nbsp; &nbsp; &nbsp; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;} </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; } </p>
    <p> &nbsp; &nbsp;  &nbsp;}); &nbsp; &nbsp; </p>
    <p> } </p>
    <p> //保存广告点击数据 </p>
    <p> $(&quot;body&quot;).on(&#39;click&#39;,&#39;.advertise_elem a&#39;,function(event){ </p>
    <p> &nbsp; &nbsp; event.preventDefault(); </p>
    <p> &nbsp; &nbsp; var link=$(this).attr(&#39;href&#39;); </p>
    <p> &nbsp; &nbsp; var adp_id=$(this).parents(&#39;.advertise_elem&#39;).attr(&#39;data-ad_id&#39;), </p>
    <p> &nbsp; &nbsp; url=&quot;&lt;?php echo site_url(&#39;index.php/diy_tour/ajax/set_advertise_rate&#39;); ?&gt;&quot;; </p>
    <p> &nbsp; &nbsp; $.post(url,{&quot;adp_id&quot;:adp_id},function(result) { </p>
    <p> &nbsp; &nbsp; &nbsp; location.href=link; </p>
    <p> &nbsp; &nbsp; }); </p>
    <p> }); </p>
    <p> <br/>
    </p>
    <p> &lt;/script&gt; </p>
  </div>
  <div class="well col-xs-16" style="line-height:12px;">
    <h4>响应js请求的控制器代码</h4>
    <p> public function get_advertise() </p>
    <p> &nbsp; &nbsp; { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;load-&gt;model(&#39;Information_model&#39;); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $pageurl=$this-&gt;input-&gt;post(&#39;pageurl&#39;); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $place=$this-&gt;input-&gt;post(&#39;place&#39;)?$this-&gt;input-&gt;post(&#39;place&#39;):false; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; //获取当前页面关联的广告 </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $pageurl=str_replace(&#39;http://&#39;.$this-&gt;config-&gt;item(&#39;Site_Domain&#39;),&#39;&#39;,$pageurl); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; //$pageurl=str_replace(&#39;http://202.103.68.34:9091&#39;,&#39;&#39;,$pageurl); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $advertise=$this-&gt;Information_model-&gt;get_advertise_by_url($pageurl,$place); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $ad_list=$ad_lists=array(); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; foreach ($advertise as $key =&gt; $value) { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach ($value as $k =&gt; $v) { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ad_list[$key][$k]=$v; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ad_lists[]=array(&quot;ad_place&quot;=&gt;$key,$key=&gt;$ad_list[$key]); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; } </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; echo json_encode($ad_lists); </p>
    <p> &nbsp; &nbsp; } </p>
    <p> <br/>
    </p>
    <h4>更新广告点击数据</h4>
    <p> public function set_advertise_rate() </p>
    <p> &nbsp; &nbsp; { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;load-&gt;model(&#39;Information_model&#39;); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $adp_id=$this-&gt;input-&gt;post(&#39;adp_id&#39;); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; if ($this-&gt;Information_model-&gt;set_advertise_rate($adp_id)) { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo 1; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; } </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; else{ </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo 0; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; } </p>
    <p> &nbsp; &nbsp; } </p>
  </div>
  <div class="well col-xs-16" style="line-height:12px;">
    <h4> 模型层读取当前页面相关广告的代码 </h4>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp;/**</span><br/>
    </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp;&nbsp;</span><span style="white-space: nowrap;">* $pageurl:需要展示广告的页面url</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; * $place: 广告位</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; * $loadview:0 返回广告列表，1 直接输出广告内容</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; */</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; public function get_advertise_by_url($pageurl,$place=false)</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; //获取当前页面关联的广告</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $data=array();</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $site_code=$this-&gt;config-&gt;item(&#39;Site_Code&#39;);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $ad_list=$this-&gt;get_advertise($site_code,$pageurl,$place);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; //尝试根据当前页面的信息ID来提取广告</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; if (empty($ad_list)){</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $info_detail=$this-&gt;get_detail($pageurl);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (empty($info_detail)) return array();</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ad_list=$this-&gt;get_advertise($site_code,$pageurl,$place,$info_detail-&gt;ic_id);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; //当前页面没有关联广告的话，取父级节点的广告代替</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; if (empty($ad_list))&nbsp;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //获取父级信息节点关联的适用于当前页面的广告</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $parent_ads=$this-&gt;get_parent_ads($info_detail-&gt;is_path,$site_code,time(),$place);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (empty($parent_ads)) {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //url匹配不到数据的话，尝试用父节点的ic_id来匹配</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $parent_ads=$this-&gt;get_parent_ads($info_detail-&gt;is_path,$site_code,time(),$place,true);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (empty($parent_ads)) return array();</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $temp=array();</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach ($parent_ads as $p) {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $temp[$p-&gt;is_id][]=$p;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //优先获取直接父节点关联的广告,以此类推</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $is_id_array=explode(&#39;,&#39;, $info_detail-&gt;is_path);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; krsort($is_id_array);</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach ($is_id_array as $isid)&nbsp;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($isid!=&#39;&#39; &amp;&amp; isset($temp[$isid]))&nbsp;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ad_list=$temp[$isid];</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; //返回当前页面所有广告位的广告，按广告索引</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $advertise=array();</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; if (!empty($ad_list)){</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach ($ad_list as $ad) {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $advertise[$ad-&gt;ad_place]=$ad;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; return $advertise;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; }</span> </p>
    <p> <br/>
    </p>
    <p> <span style="white-space: nowrap;">//获取指定页面指定位置的广告</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; public function get_advertise($site_code,$adp_ic_url,$ad_place=false,$ic_id=false)</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $adp_ic_url=$ic_id?$ic_id:$adp_ic_url;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $mapsql=$ad_place==false?&#39;&#39;:&quot; AND ad_place=&#39;$ad_place&#39; &quot;;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $sql = &quot;SELECT &nbsp; adp_id,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adp_ic_url,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adp_forself,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_id,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_is_id,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_title,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_content,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_expire,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_place,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_sitecode,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_status,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_createtime</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM &nbsp; &nbsp; infoAdvertise LEFT JOIN infoAdvertisePage ON ad_id=adp_ad_id</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE &nbsp; ad_status=1 AND adp_ic_url=&#39;$adp_ic_url&#39; AND ad_sitecode=? AND ad_expire&gt;? $mapsql&quot;;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $query = $this-&gt;HT-&gt;query($sql,array($site_code,time()));</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $result = $query-&gt;result();</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; return $result;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; }</span> </p>
    <p> <span style="white-space: nowrap;"><br/>
      </span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; //获取父级信息节点关联的可以用于子节点的广告</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; public function get_parent_ads($path,$site_code,$ad_expire,$ad_place=false,$icid_flag=false)</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; {</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $compare_string=$icid_flag?&#39;ic_id&#39;:&#39;ic_url&#39;;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $path=$path.&quot;0&quot;;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $mapsql=$ad_place==false?&#39;&#39;:&quot; AND ad_place=&#39;$ad_place&#39; &quot;;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $sql=&quot; &nbsp; &nbsp;SELECT ad_id,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_is_id,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_title,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_content,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_expire,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_place,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_sitecode,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_status,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ad_createtime,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is_id,</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adp_id</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM infoAdvertise&nbsp;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LEFT JOIN infoAdvertisePage ON ad_id=adp_ad_id</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LEFT JOIN infoContents &nbsp;ON adp_ic_url=convert(nvarchar, $compare_string)</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LEFT JOIN infoStructures ON ic_id=is_ic_id AND is_id in ($path)</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WHERE ad_sitecode=? and is_sitecode=? and ad_status=1 AND adp_forself=1 AND ad_expire&gt;? $mapsql&quot;;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $query = $this-&gt;HT-&gt;query($sql,array($site_code,$site_code,$ad_expire));</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; $result = $query-&gt;result();</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; return $result;</span> </p>
    <p> <span style="white-space: nowrap;">&nbsp; &nbsp; }</span> </p>
    <h4> 更新广告点击数 </h4>
    <p> public function set_advertise_rate($adp_id) </p>
    <p> &nbsp; &nbsp; { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; if (empty($adp_id)) { </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; } </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $sql = &quot;UPDATE &nbsp;infoAdvertisePage </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SET &nbsp;adp_click=adp_click+1 </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WHERE &nbsp;adp_id=?&quot;; </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; $result = $this-&gt;HT-&gt;query($sql, array($adp_id)); </p>
    <p> &nbsp; &nbsp; &nbsp; &nbsp; return $result; </p>
    <p> &nbsp; &nbsp; } </p>
    <p> <br/>
    </p>
  </div>
</div>
