💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 商品列表 商品列表 #### 1、商家中心商品列表 文件路径:shop/controllers/Seller/GoodsCtl.php; ##### 后台数据: ``` <pre class="calibre14">``` $Yf_Page <span class="token">=</span> <span class="token2">new</span> <span class="token3">Yf_Page</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> $row <span class="token">=</span> $Yf_Page<span class="token">-</span><span class="token">></span>listRows<span class="token1">;</span> $offset <span class="token">=</span> <span class="token3">request_int</span><span class="token1">(</span><span class="token4">'firstRow'</span><span class="token1">,</span> <span class="token6">0</span><span class="token1">)</span><span class="token1">;</span> $page <span class="token">=</span> <span class="token3">ceil_r</span><span class="token1">(</span>$offset <span class="token">/</span> $row<span class="token1">)</span><span class="token1">;</span> $goods <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getRecommonRow</span><span class="token1">(</span>$goods_rows<span class="token1">)</span><span class="token1">;</span> ``` ``` 出售中的商品(online()): ``` <pre class="calibre14">``` $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span> <span class="token">=</span><span class="token">></span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">,</span><span class="token4">'common_state'</span> <span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">,</span> <span class="token4">'common_verify'</span> <span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_VERIFY_ALLOW<span class="token1">)</span><span class="token1">;</span> $goods_rows <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getCommonNormal</span><span class="token1">(</span>$cront_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_id'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'DESC'</span><span class="token1">)</span><span class="token1">,</span> $page<span class="token1">,</span> $row<span class="token1">)</span><span class="token1">;</span> ``` ``` 已下架的商品(offline()) : 参数:op=1; ``` <pre class="calibre14">``` $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span> <span class="token">=</span><span class="token">></span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">)</span><span class="token1">;</span> $goods_rows <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getCommonOffline</span><span class="token1">(</span>$cront_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_id'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'DESC'</span><span class="token1">)</span><span class="token1">,</span> $page<span class="token1">,</span> $row<span class="token1">)</span><span class="token1">;</span> ``` ``` 外部导入待上架商品(OutsideImport()): ``` <pre class="calibre14">``` $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span> <span class="token">=</span><span class="token">></span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">)</span><span class="token1">;</span> $goods_rows <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getCommonOutsideImport</span><span class="token1">(</span>$cront_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_id'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'DESC'</span><span class="token1">)</span><span class="token1">,</span> $page<span class="token1">,</span> $row<span class="token1">)</span><span class="token1">;</span> ``` ``` 待审核商品(verify()): 参数:op=3; ``` <pre class="calibre14">``` $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span> <span class="token">=</span><span class="token">></span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">)</span><span class="token1">;</span> $goods_rows <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getCommonVerifyWaiting</span><span class="token1">(</span>$cront_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_id'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'DESC'</span><span class="token1">)</span><span class="token1">,</span> $page<span class="token1">,</span> $row<span class="token1">)</span><span class="token1">;</span> ``` ``` 未通过审核商品(verifyDeny()): ``` <pre class="calibre14">``` $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span> <span class="token">=</span><span class="token">></span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">)</span><span class="token1">;</span> $goods_rows <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getCommonVerifyDeny</span><span class="token1">(</span>$cront_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_id'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'DESC'</span><span class="token1">)</span><span class="token1">,</span> $page<span class="token1">,</span> $row<span class="token1">)</span><span class="token1">;</span> ``` ``` 待发布的商品(waitReleaseGoods()): ``` <pre class="calibre14">``` $conditions <span class="token">=</span> <span class="token1">[</span><span class="token4">'common_verify'</span><span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_VERIFY_ALLOW<span class="token1">,</span> <span class="token5">//common_verify=> 1 审核通过</span> <span class="token4">'common_state'</span><span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_TIMING<span class="token1">,</span> <span class="token5">//common_state=> 2 定时发布</span> <span class="token4">'shop_id'</span><span class="token">=</span><span class="token">></span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId <span class="token5">//所属店铺</span> <span class="token1">]</span><span class="token1">;</span> $common_goods_rows <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>goodsCommonModel<span class="token">-</span><span class="token">></span><span class="token3">listByWhere</span><span class="token1">(</span>$conditions<span class="token1">,</span> <span class="token1">[</span><span class="token4">'common_id'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'DESC'</span><span class="token1">]</span><span class="token1">,</span> $page<span class="token1">,</span> $row<span class="token1">)</span><span class="token1">;</span> $goods <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>goodsCommonModel<span class="token">-</span><span class="token">></span><span class="token3">getRecommonRow</span><span class="token1">(</span>$common_goods_rows<span class="token1">)</span><span class="token1">;</span> ``` ``` 违规的商品(lockup()): ``` <pre class="calibre14">``` $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span> <span class="token">=</span><span class="token">></span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">)</span><span class="token1">;</span> $goods_rows <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getCommonIllegal</span><span class="token1">(</span>$cront_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_id'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'DESC'</span><span class="token1">)</span><span class="token1">,</span> $page<span class="token1">,</span> $row<span class="token1">)</span><span class="token1">;</span> ``` ``` ##### 前台显示: ``` <pre class="calibre14">``` <span class="token"><</span><span class="token">?</span>php foreach <span class="token1">(</span>$goods as $item<span class="token1">)</span><span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>tr id<span class="token">=</span><span class="token4">"tr_common_id_<?= $item['common_id']; ?>"</span><span class="token">></span> <span class="token"><</span>td class<span class="token">=</span><span class="token4">"tl th"</span> colspan<span class="token">=</span><span class="token4">"99"</span><span class="token">></span> <span class="token"><</span>label class<span class="token">=</span><span class="token4">"checkbox"</span><span class="token">></span><span class="token"><</span>input <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token3">isset</span><span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'disabled_up'</span><span class="token1">]</span><span class="token1">)</span><span class="token">&&</span>$item<span class="token1">[</span><span class="token4">'disabled_up'</span><span class="token1">]</span><span class="token1">)</span> echo <span class="token4">'disabled'</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span> class<span class="token">=</span><span class="token4">"checkitem"</span> type<span class="token">=</span><span class="token4">"checkbox"</span> name<span class="token">=</span><span class="token4">"chk[]"</span> value<span class="token">=</span><span class="token4">"<?= $item['common_id'] ?>"</span> is_virtual<span class="token">=</span><span class="token4">"<?= $item['common_is_virtual'] ?>"</span> common_virtual_date<span class="token">=</span><span class="token4">"<?= $item['common_virtual_date'] ?>"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>label<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'平台货号'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token1">:</span><span class="token"><</span><span class="token">?</span><span class="token">=</span> $item<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token3">isset</span><span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'disabled_up'</span><span class="token1">]</span><span class="token1">)</span><span class="token">&&</span>$item<span class="token1">[</span><span class="token4">'disabled_up'</span><span class="token1">]</span><span class="token1">)</span> echo <span class="token4">'<span style="color:red;">('</span><span class="token1">.</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'供应商下架商品'</span><span class="token1">)</span><span class="token1">.</span><span class="token4">')</span>'</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span><span class="token">/</span>tr<span class="token">></span> <span class="token"><</span>tr<span class="token">></span> <span class="token"><</span>td class<span class="token">=</span><span class="token4">"tl"</span><span class="token">></span> <span class="token"><</span>dl class<span class="token">=</span><span class="token4">"fn-clear fn_dl"</span><span class="token">></span> <span class="token"><</span>dt<span class="token">></span> <span class="token"><</span>i date<span class="token">-</span>type<span class="token">=</span><span class="token4">"ajax_goods_list"</span> data<span class="token">-</span>id<span class="token">=</span><span class="token4">"237"</span> class<span class="token">=</span><span class="token4">"iconfont icon-jia disb"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span> <span class="token"><</span>p style<span class="token">=</span><span class="token4">"display:inline"</span> target<span class="token">=</span><span class="token4">"_blank"</span><span class="token">></span><span class="token"><</span>img width<span class="token">=</span><span class="token4">"60"</span> src<span class="token">=</span><span class="token4">"<?= $item['common_image'] ?>"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>p<span class="token">></span> <span class="token"><</span><span class="token">/</span>dt<span class="token">></span> <span class="token"><</span>dd<span class="token">></span> <span class="token"><</span>h3<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'common_parent_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"dis_flag"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'分销'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>p target<span class="token">=</span><span class="token4">"_blank"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> $item<span class="token1">[</span><span class="token4">'common_name'</span><span class="token1">]</span> <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>p<span class="token">></span> <span class="token"><</span><span class="token">/</span>h3<span class="token">></span> <span class="token"><</span>p<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> $item<span class="token1">[</span><span class="token4">'cat_name'</span><span class="token1">]</span> <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>p<span class="token">></span> <span class="token"><</span>p<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> <span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'common_code'</span><span class="token1">]</span> <span class="token">?</span> <span class="token3">sprintf</span><span class="token1">(</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'商家货号'</span><span class="token1">)</span><span class="token1">.</span><span class="token4">':%s'</span><span class="token1">,</span> $item<span class="token1">[</span><span class="token4">'common_code'</span><span class="token1">]</span><span class="token1">)</span> <span class="token1">:</span> <span class="token4">''</span><span class="token1">)</span> <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>p<span class="token">></span> <span class="token"><</span><span class="token">/</span>dd<span class="token">></span> <span class="token"><</span><span class="token">/</span>dl<span class="token">></span> <span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> <span class="token3">format_money</span><span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'common_price'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'common_stock'</span><span class="token1">]</span> <span class="token"><</span> $item<span class="token1">[</span><span class="token4">'common_alarm'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">{</span><span class="token">?</span><span class="token">></span> class<span class="token">=</span><span class="token4">"colred"</span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token">?</span><span class="token">></span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> $item<span class="token1">[</span><span class="token4">'common_stock'</span><span class="token1">]</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'件'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span><span class="token"><</span><span class="token">?</span>php $item<span class="token1">[</span><span class="token4">'common_sell_time'</span><span class="token1">]</span><span class="token">!==</span><span class="token4">'0000-00-00 00:00:00'</span> <span class="token">?</span> <span class="token3">print</span><span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'common_sell_time'</span><span class="token1">]</span><span class="token1">)</span> <span class="token1">:</span> <span class="token3">print</span><span class="token1">(</span>$item<span class="token1">[</span><span class="token4">'common_add_time'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span>td<span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"edit"</span><span class="token">></span><span class="token"><</span>a href<span class="token">=</span><span class="token4">"<?php echo Yf_Registry::get('url'); ?>?ctl=Seller_Goods&met=online&typ=e&common_id=<?= $item['common_id'] ?>&action=edit_goods"</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-zhifutijiao"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'编辑'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"del"</span><span class="token">></span><span class="token"><</span>a data<span class="token">-</span>param<span class="token">=</span><span class="token4">"{'id':'<?= $item['common_id'] ?>','ctl':'Seller_Goods','met':'deleteGoodsCommon'}"</span> href<span class="token">=</span><span class="token4">"javascript:void(0)"</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-lajitong"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'删除'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span><span class="token">/</span>tr<span class="token">></span> <span class="token"><</span>tr class<span class="token">=</span><span class="token4">"tr-goods-list"</span> style<span class="token">=</span><span class="token4">"display: none;"</span><span class="token">></span> <span class="token"><</span>td colspan<span class="token">=</span><span class="token4">"5"</span> class<span class="token">=</span><span class="token4">"tl"</span><span class="token">></span> <span class="token"><</span>ul class<span class="token">=</span><span class="token4">"fn-clear"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span> <span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$goods_detail_rows<span class="token1">[</span>$item<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span><span class="token1">:</span> foreach <span class="token1">(</span>$goods_detail_rows<span class="token1">[</span>$item<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span><span class="token1">]</span> as $g_k <span class="token">=</span><span class="token">></span> $g_v<span class="token1">)</span><span class="token1">:</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>li<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"goods-image"</span><span class="token">></span> <span class="token"><</span>a herf<span class="token">=</span><span class="token4">""</span> target<span class="token">=</span><span class="token4">"_blank"</span><span class="token">></span><span class="token"><</span>img width<span class="token">=</span><span class="token4">"100"</span> src<span class="token">=</span><span class="token4">"<?= $g_v['goods_image']; ?>"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span> <span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$g_v<span class="token1">[</span><span class="token4">'spec'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> foreach <span class="token1">(</span>$g_v<span class="token1">[</span><span class="token4">'spec'</span><span class="token1">]</span> as $ks <span class="token">=</span><span class="token">></span> $vs<span class="token1">)</span><span class="token1">:</span><span class="token">?</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"goods_spec"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> $ks<span class="token1">;</span> <span class="token">?</span><span class="token">></span>:<span class="token"><</span>span<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> $vs <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span><span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">?</span>php endforeach<span class="token1">;</span> <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"goods-price"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'价格'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span>:<span class="token"><</span>span<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> <span class="token3">format_money</span><span class="token1">(</span>$g_v<span class="token1">[</span><span class="token4">'goods_price'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span><span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"goods-stock"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'库存'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span>:<span class="token"><</span>span<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span> $g_v<span class="token1">[</span><span class="token4">'goods_stock'</span><span class="token1">]</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'件'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span><span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>a href<span class="token">=</span><span class="token4">"index.php?ctl=<?=$ctl?>&met=goods&gid=<?= $g_v['goods_id'] ?>"</span> target<span class="token">=</span><span class="token4">"_blank"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'查看商品详情'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span> <span class="token"><</span><span class="token">/</span>li<span class="token">></span> <span class="token"><</span><span class="token">?</span>php endforeach<span class="token1">;</span> endif<span class="token1">;</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>ul<span class="token">></span> <span class="token"><</span><span class="token">/</span>td<span class="token">></span> <span class="token"><</span><span class="token">/</span>tr<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> ``` ``` 商品搜索: ``` <pre class="calibre14">``` $<span class="token1">(</span><span class="token4">".search"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">on</span><span class="token1">(</span><span class="token4">"click"</span><span class="token1">,</span> <span class="token4">"a.button"</span><span class="token1">,</span> <span class="token2">function</span> <span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span> $<span class="token1">(</span><span class="token4">"#search_form"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> ``` ``` 商品下架: ``` <pre class="calibre14">``` $<span class="token1">.</span><span class="token3">post</span><span class="token1">(</span>SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Seller_Goods&met=editGoodsCommon&typ=json&act=down'</span><span class="token1">,</span> <span class="token1">{</span>chk<span class="token1">:</span> chk_value<span class="token1">}</span><span class="token1">,</span> <span class="token2">function</span> <span class="token1">(</span>data<span class="token1">)</span> <span class="token1">{</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> $flag <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">editCommon</span><span class="token1">(</span>$goods_common_id<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_state'</span> <span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_OFFLINE<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//如果是供货商下架,同时下架其分销商的该商品</span> <span class="token2">if</span><span class="token1">(</span>$shop_base<span class="token1">[</span><span class="token4">'shop_type'</span><span class="token1">]</span> <span class="token">==</span> <span class="token6">2</span><span class="token1">)</span><span class="token1">{</span> $MessageModel <span class="token">=</span> <span class="token2">new</span> <span class="token3">MessageModel</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> $all_dist_common <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">'common_parent_id'</span> <span class="token">=</span><span class="token">></span> $goods_common_id<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$all_dist_common<span class="token1">)</span><span class="token1">)</span><span class="token1">{</span> foreach <span class="token1">(</span>$all_dist_common as $k <span class="token">=</span><span class="token">></span> $v<span class="token1">)</span> <span class="token1">{</span> $dist_shop_base <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel <span class="token">-</span><span class="token">></span><span class="token3">getOne</span><span class="token1">(</span>$v<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> $dist_common_row<span class="token1">[</span><span class="token4">'common_state'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">0</span><span class="token1">;</span><span class="token5">//下架</span> <span class="token5">//给每个商品下架的店铺发通知</span> $common_state_remark <span class="token">=</span> <span class="token4">'供货商修改了商品-'</span><span class="token1">.</span>$v<span class="token1">[</span><span class="token4">"common_name"</span><span class="token1">]</span><span class="token1">.</span><span class="token4">'!'</span><span class="token1">;</span> $MessageModel<span class="token">-</span><span class="token">></span><span class="token3">sendMessage</span><span class="token1">(</span><span class="token4">'Commodity violation is under the shelf'</span><span class="token1">,</span>$dist_shop_base<span class="token1">[</span><span class="token4">'user_id'</span><span class="token1">]</span><span class="token1">,</span> $dist_shop_base<span class="token1">[</span><span class="token4">'user_name'</span><span class="token1">]</span><span class="token1">,</span> $order_id <span class="token">=</span> NULL<span class="token1">,</span> $shop_name <span class="token">=</span> NULL<span class="token1">,</span> <span class="token6">1</span><span class="token1">,</span> <span class="token6">1</span><span class="token1">,</span> $end_time <span class="token">=</span> Null<span class="token1">,</span>$v<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span><span class="token1">,</span>$goods_id<span class="token">=</span>NULL<span class="token1">,</span>$common_state_remark<span class="token1">)</span><span class="token1">;</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">editCommon</span><span class="token1">(</span>$v<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span><span class="token1">,</span>$dist_common_row<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span> <span class="token1">}</span> ``` ``` 商品上架: ``` <pre class="calibre14">``` $<span class="token1">.</span><span class="token3">post</span><span class="token1">(</span>SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Seller_Goods&met=editGoodsCommon&typ=json&act=up&me='</span><span class="token">+</span>me<span class="token1">,</span> <span class="token1">{</span>chk<span class="token1">:</span> chk_value<span class="token1">}</span><span class="token1">,</span> <span class="token2">function</span> <span class="token1">(</span>data<span class="token1">)</span> <span class="token1">{</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span><span class="token1">(</span><span class="token3">request_string</span><span class="token1">(</span><span class="token4">'me'</span><span class="token1">)</span> <span class="token">==</span> <span class="token4">'lockup'</span><span class="token1">)</span><span class="token1">{</span> $flag <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">editCommon</span><span class="token1">(</span>$goods_common_id<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_state'</span> <span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">,</span><span class="token4">'common_verify'</span> <span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_ILLEGAL<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span><span class="token2">else</span><span class="token1">{</span> $flag <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">editCommon</span><span class="token1">(</span>$goods_common_id<span class="token1">,</span> <span class="token1">[</span> <span class="token4">'common_state'</span> <span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">,</span> <span class="token4">'common_verify'</span> <span class="token">=</span><span class="token">></span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">,</span> <span class="token4">'common_goods_from'</span> <span class="token">=</span><span class="token">></span> <span class="token6">1</span> <span class="token5">//外部导入一经上架,撕掉外部导入标签</span> <span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//对goods_base对应的数据上架</span> $goodsBaseModel <span class="token">=</span> <span class="token2">new</span> <span class="token3">Goods_BaseModel</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> $goods_item <span class="token">=</span> $goodsBaseModel<span class="token">-</span><span class="token">></span><span class="token3">getByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">"common_id:IN"</span><span class="token">=</span><span class="token">></span> $goods_common_id<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> $goods_ids <span class="token">=</span> <span class="token3">array_column</span><span class="token1">(</span>$goods_item<span class="token1">,</span> <span class="token4">'goods_id'</span><span class="token1">)</span><span class="token1">;</span> $flag <span class="token">=</span> $goodsBaseModel<span class="token">-</span><span class="token">></span><span class="token3">editBase</span><span class="token1">(</span>$goods_ids<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">"goods_is_shelves"</span><span class="token">=</span><span class="token">></span> Goods_BaseModel<span class="token1">:</span><span class="token1">:</span>GOODS_UP<span class="token1">)</span><span class="token1">,</span> <span class="token6">false</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> ``` ``` 删除商品: ``` <pre class="calibre14">``` <span class="token"><</span>label class<span class="token">=</span><span class="token4">"del"</span> data<span class="token">-</span>param<span class="token">=</span><span class="token4">"{'ctl':'Seller_Goods','met':'deleteGoodsCommonRows'}"</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-lajitong"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'删除'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>label<span class="token">></span> $flag <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">removeCommon</span><span class="token1">(</span>$goods_common_id<span class="token1">)</span><span class="token1">;</span> <span class="token5">//批量删除分销商的商品</span> <span class="token2">if</span><span class="token1">(</span>$shop_base <span class="token">==</span> <span class="token6">2</span> <span class="token">&&</span> <span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$id<span class="token1">)</span><span class="token1">)</span><span class="token1">{</span> foreach <span class="token1">(</span>$id as $key <span class="token">=</span><span class="token">></span> $value<span class="token1">)</span> <span class="token1">{</span> $all_dist_common <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">'common_parent_id'</span> <span class="token">=</span><span class="token">></span> $value<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$all_dist_common<span class="token1">)</span><span class="token1">)</span><span class="token1">{</span> foreach <span class="token1">(</span>$all_dist_common as $k <span class="token">=</span><span class="token">></span> $v<span class="token1">)</span> <span class="token1">{</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">removeCommon</span><span class="token1">(</span>$v<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span> <span class="token1">}</span> <span class="token1">}</span> ``` ``` #### 2、前台商品列表 文件路径:shop/controllers/Goods/GoodsCtl.php; 方法名:goodslist(); ##### 后台数据 ``` <pre class="calibre14">``` <span class="token5">//查询分类品牌和分类关联属性</span> <span class="token2">if</span> <span class="token1">(</span> <span class="token3">count</span><span class="token1">(</span>$brand_property<span class="token1">[</span><span class="token4">'common_ids'</span><span class="token1">]</span><span class="token1">)</span> <span class="token">==</span> <span class="token6">1</span> <span class="token">&&</span> $brand_property<span class="token1">[</span><span class="token4">'common_ids'</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token1">]</span> <span class="token">===</span> <span class="token6">false</span> <span class="token1">)</span> <span class="token1">{</span> $cond_row<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span> <span class="token">=</span> <span class="token">-</span><span class="token6">1</span><span class="token1">;</span> <span class="token1">}</span> <span class="token2">else</span> <span class="token1">{</span> $cond_row<span class="token1">[</span><span class="token4">'common_id:IN'</span><span class="token1">]</span> <span class="token">=</span> $brand_property<span class="token1">[</span><span class="token4">'common_ids'</span><span class="token1">]</span><span class="token1">;</span> <span class="token1">}</span> <span class="token5">//查找该分类下所有的子分类</span> $cat_list <span class="token">=</span> $Goods_CatModel<span class="token">-</span><span class="token">></span><span class="token3">getCatChildId</span><span class="token1">(</span>$cat_id<span class="token1">)</span><span class="token1">;</span> <span class="token5">//查找该分类的父级分类</span> $parent_cat_id <span class="token">=</span> $Goods_CatModel<span class="token">-</span><span class="token">></span><span class="token3">getCatParentTree</span><span class="token1">(</span>$cat_id<span class="token1">)</span><span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'cat_id:IN'</span><span class="token1">]</span> <span class="token">=</span> $cat_list<span class="token1">;</span> <span class="token5">//不显示供货商商品</span> $shop_list <span class="token">=</span> $shopBaseModel <span class="token">-</span><span class="token">></span> <span class="token3">getByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_type'</span> <span class="token">=</span><span class="token">></span> <span class="token6">1</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> $shop_ids <span class="token">=</span> <span class="token3">array_column</span><span class="token1">(</span>$shop_list<span class="token1">,</span><span class="token4">'shop_id'</span><span class="token1">)</span><span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'shop_id:IN'</span><span class="token1">]</span> <span class="token">=</span> $shop_ids<span class="token1">;</span> <span class="token5">//商品品牌</span> $cond_row<span class="token1">[</span><span class="token4">'brand_id:in'</span><span class="token1">]</span> <span class="token">=</span> $brand_id<span class="token1">;</span> <span class="token5">//商品common_id</span> $cond_row<span class="token1">[</span><span class="token4">'common_id:IN'</span><span class="token1">]</span> <span class="token">=</span> $com_id<span class="token1">;</span> <span class="token5">//商品的配送区域</span> <span class="token5">//获取默认区域</span> $transport_id <span class="token">=</span> <span class="token3">request_string</span><span class="token1">(</span><span class="token4">'transport_id'</span><span class="token1">,</span> <span class="token3">isset</span><span class="token1">(</span>$cookid_area<span class="token1">[</span><span class="token4">'city'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'id'</span><span class="token1">]</span><span class="token1">)</span> <span class="token">?</span> $cookid_area<span class="token1">[</span><span class="token4">'city'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'id'</span><span class="token1">]</span> <span class="token1">:</span> <span class="token4">''</span><span class="token1">)</span><span class="token1">;</span> $transport_area <span class="token">=</span> <span class="token3">request_string</span><span class="token1">(</span><span class="token4">'transport_area'</span><span class="token1">,</span> <span class="token3">isset</span><span class="token1">(</span>$cookid_area<span class="token1">[</span><span class="token4">'area'</span><span class="token1">]</span><span class="token1">)</span> <span class="token">?</span> $cookid_area<span class="token1">[</span><span class="token4">'area'</span><span class="token1">]</span> <span class="token1">:</span> <span class="token4">'请选择地区'</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//获取该售卖区域的所有模板</span> $transport_area_list <span class="token">=</span> $Transport_AreaModel<span class="token">-</span><span class="token">></span><span class="token3">getAreaTemplate</span><span class="token1">(</span>$transport_id<span class="token1">)</span><span class="token1">;</span> $transport_area_id <span class="token">=</span> <span class="token3">array_column</span><span class="token1">(</span>$transport_area_list<span class="token1">,</span><span class="token4">'id'</span><span class="token1">)</span><span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'transport_area_id:IN'</span><span class="token1">]</span> <span class="token">=</span> $transport_area_id<span class="token1">;</span> <span class="token5">//pc分站</span> $sub_site_id <span class="token">=</span> $_COOKIE<span class="token1">[</span><span class="token4">'sub_site_id'</span><span class="token1">]</span><span class="token1">;</span> $pc_site <span class="token">=</span> <span class="token6">true</span><span class="token1">;</span> <span class="token5">//wap分站</span> $sub_site_id <span class="token">=</span> <span class="token3">request_int</span><span class="token1">(</span><span class="token4">'sub_site_id'</span><span class="token1">)</span><span class="token1">;</span> $wap_site <span class="token">=</span> <span class="token6">true</span><span class="token1">;</span> <span class="token3">unset</span><span class="token1">(</span>$cond_row<span class="token1">[</span><span class="token4">'transport_area_id:IN'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//获取站点信息</span> $sub_site_district_ids <span class="token">=</span> $Sub_SiteModel<span class="token">-</span><span class="token">></span><span class="token3">getDistrictChildId</span><span class="token1">(</span>$sub_site_id<span class="token1">)</span><span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'district_id:IN'</span><span class="token1">]</span> <span class="token">=</span> $sub_site_district_ids<span class="token1">;</span> <span class="token5">//商品搜索(总)</span> <span class="token2">if</span><span class="token1">(</span><span class="token3">preg_match</span><span class="token1">(</span><span class="token4">'/http:\/\/[\w.]+[\w\/]*[\w.]*\??[\w=&\+\%]*/is'</span><span class="token1">,</span>$_REQUEST<span class="token1">[</span><span class="token4">'keywords'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span> $_REQUEST<span class="token1">[</span><span class="token4">'keywords'</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">""</span><span class="token1">;</span> <span class="token1">}</span> $_REQUEST<span class="token1">[</span><span class="token4">'keywords'</span><span class="token1">]</span> <span class="token">=</span> $this<span class="token">-</span><span class="token">></span><span class="token3">strFilter</span><span class="token1">(</span><span class="token3">strip_tags</span><span class="token1">(</span>$_REQUEST<span class="token1">[</span><span class="token4">'keywords'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//统计中心</span> Yf_Plugin_Manager<span class="token1">:</span><span class="token1">:</span><span class="token3">getInstance</span><span class="token1">(</span><span class="token1">)</span><span class="token">-</span><span class="token">></span><span class="token3">trigger</span><span class="token1">(</span><span class="token4">'analyticsKeywords'</span><span class="token1">,</span>$analytics_data<span class="token1">)</span><span class="token1">;</span> <span class="token5">//记录搜索关键词</span> $search_cond_row<span class="token1">[</span><span class="token4">'search_keyword'</span><span class="token1">]</span> <span class="token">=</span> $search<span class="token1">;</span> $search_row <span class="token">=</span> $Search_WordModel<span class="token">-</span><span class="token">></span><span class="token3">getSearchWordInfo</span><span class="token1">(</span>$search_cond_row<span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span> <span class="token1">(</span>$search_row<span class="token1">)</span> <span class="token1">{</span> $search_data<span class="token1">[</span><span class="token4">'search_nums'</span><span class="token1">]</span> <span class="token">=</span> $search_row<span class="token1">[</span><span class="token4">'search_nums'</span><span class="token1">]</span> <span class="token">+</span> <span class="token6">1</span><span class="token1">;</span> $flag <span class="token">=</span> $Search_WordModel<span class="token">-</span><span class="token">></span><span class="token3">editSearchWord</span><span class="token1">(</span>$search_row<span class="token1">[</span><span class="token4">'search_id'</span><span class="token1">]</span><span class="token1">,</span> $search_data<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token2">else</span> <span class="token1">{</span> $search_data<span class="token1">[</span><span class="token4">'search_keyword'</span><span class="token1">]</span> <span class="token">=</span> $search<span class="token1">;</span> $search_data<span class="token1">[</span><span class="token4">'search_char_index'</span><span class="token1">]</span> <span class="token">=</span> Text_Pinyin<span class="token1">:</span><span class="token1">:</span><span class="token3">pinyin</span><span class="token1">(</span>$search<span class="token1">,</span> <span class="token4">''</span><span class="token1">)</span><span class="token1">;</span> $search_data<span class="token1">[</span><span class="token4">'search_nums'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">1</span><span class="token1">;</span> $flag <span class="token">=</span> $Search_WordModel<span class="token">-</span><span class="token">></span><span class="token3">addSearchWord</span><span class="token1">(</span>$search_data<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token2">if</span><span class="token1">(</span>$sear_row<span class="token1">)</span><span class="token1">{</span> $cond_row<span class="token1">[</span><span class="token4">'common_name:LIKE'</span><span class="token1">]</span> <span class="token">=</span> $sear_row<span class="token1">;</span> <span class="token1">}</span> $cond_row<span class="token1">[</span><span class="token4">'shop_status'</span><span class="token1">]</span> <span class="token">=</span> Shop_BaseModel<span class="token1">:</span><span class="token1">:</span>SHOP_STATUS_OPEN<span class="token1">;</span> $actorder <span class="token">=</span> <span class="token3">strtolower</span><span class="token1">(</span><span class="token3">request_string</span><span class="token1">(</span><span class="token4">'actorder'</span><span class="token1">,</span><span class="token4">'desc'</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//按上架时间排序</span> $order_row<span class="token1">[</span><span class="token4">'common_id'</span><span class="token1">]</span> <span class="token">=</span> $actorder<span class="token1">;</span> <span class="token5">//按销量排序</span> $order_row<span class="token1">[</span><span class="token4">'common_salenum'</span><span class="token1">]</span> <span class="token">=</span> $actorder<span class="token1">;</span> <span class="token5">//按价格排序</span> $order_row<span class="token1">[</span><span class="token4">'common_price'</span><span class="token1">]</span> <span class="token">=</span> $actorder<span class="token1">;</span> <span class="token5">//按评论数排序</span> $order_row<span class="token1">[</span><span class="token4">'common_evaluate'</span><span class="token1">]</span> <span class="token">=</span> $actorder<span class="token1">;</span> <span class="token5">//仅显示有货</span> $cond_row<span class="token1">[</span><span class="token4">'common_stock:>'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">0</span><span class="token1">;</span> <span class="token5">//仅显示促销商品</span> $cond_row<span class="token1">[</span><span class="token4">'common_is_xian:!='</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">0</span><span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'common_is_jia:!='</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">0</span><span class="token1">;</span> <span class="token5">//自营店铺</span> $cond_row<span class="token1">[</span><span class="token4">'shop_self_support'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">1</span><span class="token1">;</span> <span class="token5">//入驻店铺</span> $cond_row<span class="token1">[</span><span class="token4">'shop_self_support'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">0</span><span class="token1">;</span> <span class="token5">//价格区间</span> $cond_row<span class="token1">[</span><span class="token4">'common_price:>='</span><span class="token1">]</span> <span class="token">=</span> $price_from<span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'common_price:<='</span><span class="token1">]</span> <span class="token">=</span> $price_to<span class="token1">;</span> <span class="token5">//虚拟商品</span> $cond_row<span class="token1">[</span><span class="token4">'common_is_virtual'</span><span class="token1">]</span> <span class="token">=</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_VIRTUAL<span class="token1">;</span> <span class="token5">//判断是否有属性</span> $cond_row<span class="token1">[</span><span class="token4">'common_state'</span><span class="token1">]</span> <span class="token">=</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'common_verify'</span><span class="token1">]</span> <span class="token">=</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_VERIFY_ALLOW<span class="token1">;</span> <span class="token5">//推广产品</span> $recommend_cond_row<span class="token1">[</span><span class="token4">'common_state'</span><span class="token1">]</span> <span class="token">=</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">;</span> $recommend_cond_row<span class="token1">[</span><span class="token4">'common_verify'</span><span class="token1">]</span> <span class="token">=</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_VERIFY_ALLOW<span class="token1">;</span> <span class="token5">//如果有查找的分类就显示该分类下的推广商品</span> $recommond_cond_row<span class="token1">[</span><span class="token4">'goods_cat_id'</span><span class="token1">]</span> <span class="token">=</span> $cat_id<span class="token1">;</span> <span class="token5">//如果没有传递分类就显示最新设置的分类推广</span> $recommond_order_row<span class="token1">[</span><span class="token4">'goods_recommend_id'</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">'DESC'</span><span class="token1">;</span> <span class="token">/</span>如果有分站,查询分站 $recommond_cond_row<span class="token1">[</span><span class="token4">'sub_site_id'</span><span class="token1">]</span> <span class="token">=</span> $sub_site_id<span class="token1">;</span> $recommend_row <span class="token">=</span> $Goods_RecommendModel<span class="token">-</span><span class="token">></span><span class="token3">getRccommonGoodsInfo</span><span class="token1">(</span>$recommond_cond_row<span class="token1">,</span> $recommond_order_row<span class="token1">)</span><span class="token1">;</span> <span class="token5">//如果商城没有设定推广商品,则将最新发布的四件商品作为推广商品显示</span> $recommend_row <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getGoodsList</span><span class="token1">(</span>$recommend_cond_row<span class="token1">,</span> $recommend_order_row<span class="token1">,</span> <span class="token6">1</span><span class="token1">,</span> <span class="token6">4</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//热卖推荐,查找商城中销量最多的商品</span> $hot_cond_row<span class="token1">[</span><span class="token4">'common_state'</span><span class="token1">]</span> <span class="token">=</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">;</span> $hot_cond_row<span class="token1">[</span><span class="token4">'common_verify'</span><span class="token1">]</span> <span class="token">=</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_VERIFY_ALLOW<span class="token1">;</span> <span class="token2">if</span><span class="token1">(</span>$sub_site_district_ids<span class="token1">)</span><span class="token1">{</span> $hot_cond_row<span class="token1">[</span><span class="token4">'district_id:IN'</span><span class="token1">]</span> <span class="token">=</span> $sub_site_district_ids<span class="token1">;</span> <span class="token1">}</span> $hot_order_row<span class="token1">[</span><span class="token4">'common_salenum'</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">'DESC'</span><span class="token1">;</span> $hot_sale <span class="token">=</span> $Goods_CommonModel<span class="token">-</span><span class="token">></span><span class="token3">getGoodsList</span><span class="token1">(</span>$hot_cond_row<span class="token1">,</span> $hot_order_row<span class="token1">,</span> <span class="token6">1</span><span class="token1">,</span> <span class="token6">3</span><span class="token1">)</span><span class="token1">;</span> $hot_sale <span class="token">=</span> $hot_sale<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">;</span> <span class="token5">//获取品牌信息</span> <span class="token5">//如果有查找的分类就显示该分类的相关品牌,如果没有传递分类就不显示品牌</span> $type_cond_row<span class="token1">[</span><span class="token4">'cat_id'</span><span class="token1">]</span> <span class="token">=</span> $cat_id<span class="token1">;</span> $brand_row <span class="token">=</span> $Goods_TypeModel<span class="token">-</span><span class="token">></span><span class="token3">getTypeBrand</span><span class="token1">(</span>$type_cond_row<span class="token1">)</span><span class="token1">;</span> <span class="token5">//获取分类信息</span> <span class="token5">//如果有品牌就显示该品牌下的分类,如果没有就不显示分类</span> $tbrand_cond_row<span class="token1">[</span><span class="token4">'brand_id'</span><span class="token1">]</span> <span class="token">=</span> $brand_id<span class="token1">;</span> $cat_row <span class="token">=</span> $Goods_TypeBrandModel<span class="token">-</span><span class="token">></span><span class="token3">getBrandType</span><span class="token1">(</span>$tbrand_cond_row<span class="token1">)</span><span class="token1">;</span> ``` ``` ##### 前台显示 ``` <pre class="calibre14">``` <span class="token5">//显示分类</span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$parent_cat<span class="token1">)</span><span class="token1">{</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token3">foreach</span><span class="token1">(</span>$parent_cat as $catkey <span class="token">=</span><span class="token">></span> $catval<span class="token1">)</span><span class="token1">:</span><span class="token">?</span><span class="token">></span> <span class="token"><</span>a href<span class="token">=</span><span class="token4">"<?= Yf_Registry::get('url') ?>?ctl=Goods_Goods&met=goodslist&cat_id=<?=($catval['cat_id'])?>"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$catval<span class="token1">[</span><span class="token4">'cat_name'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">isset</span><span class="token1">(</span>$catval<span class="token1">[</span><span class="token4">'ext'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span> <span class="token">?</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-iconjiantouyou"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php endforeach<span class="token1">;</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token">?</span><span class="token">></span> <span class="token5">//限时折扣</span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'promotion_type'</span><span class="token1">]</span> <span class="token">==</span> <span class="token4">'xianshi'</span> <span class="token1">)</span><span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>i class<span class="token">=</span><span class="token4">"group_purchase "</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'限时折扣:'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span> <span class="token"><</span>strong<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'直降'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>strong<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'down_price'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'lower_limit'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php echo <span class="token3">sprintf</span><span class="token1">(</span><span class="token4">'最低购%s件,'</span><span class="token1">,</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'lower_limit'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span>php echo $goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'explain'</span><span class="token1">]</span><span class="token1">;</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token5">//团购</span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'promotion_type'</span><span class="token1">]</span> <span class="token">==</span> <span class="token4">'groupbuy'</span><span class="token1">)</span> <span class="token1">{</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span> <span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'upper_limit'</span><span class="token1">]</span><span class="token1">)</span> <span class="token1">{</span><span class="token">?</span><span class="token">></span> <span class="token"><</span>i class<span class="token">=</span><span class="token4">"group_purchase "</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'团购:'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span> <span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span>php echo <span class="token3">sprintf</span><span class="token1">(</span><span class="token4">'最多限购%s件'</span><span class="token1">,</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'upper_limit'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>span<span class="token">></span><span class="token"><</span><span class="token">?</span>php echo $goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'remark'</span><span class="token1">]</span><span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token">?</span><span class="token">></span> <span class="token5">//加价购</span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"ncs-mansong"</span><span class="token">></span> <span class="token"><</span>i class<span class="token">=</span><span class="token4">"group_purchase "</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'加价购:'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"sale-rule"</span><span class="token">></span> <span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_name'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'购物满'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">format_money</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule_price'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'即可加价换购最多'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule_goods_limit'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">:</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule_goods_limit'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'样'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span>php endif<span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'商品'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token">?</span><span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"sale-rule-more"</span> nctype<span class="token">=</span><span class="token4">"show-rule"</span><span class="token">></span> <span class="token"><</span>a href<span class="token">=</span><span class="token4">"javascript:void(0);"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'详情'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-iconjiantouxia"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span> <span class="token"><</span><span class="token">/</span>a<span class="token">></span> <span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'goods'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span><span class="token">?</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"sale-rule-content"</span> style<span class="token">=</span><span class="token4">"display: none;"</span> nctype<span class="token">=</span><span class="token4">"rule-content"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"title"</span><span class="token">></span><span class="token"><</span>span class<span class="token">=</span><span class="token4">"sale-name"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_name'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">',共'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span>strong<span class="token">></span><span class="token"><</span><span class="token">?</span>php echo <span class="token3">count</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>strong<span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'种活动规则'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>a href<span class="token">=</span><span class="token4">"javascript:;"</span> nctype<span class="token">=</span><span class="token4">"hide-rule"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'关闭'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token3">foreach</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'goods_base'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'increase_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span> as $rule<span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"content clearfix"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"mjs-tit"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'购物满'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">format_money</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_price'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'即可加价换购更多'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_goods_limit'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">:</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_goods_limit'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'样'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span>php endif<span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'商品'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>ul class<span class="token">=</span><span class="token4">"mjs-info clearfix"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token3">foreach</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'redemption_goods'</span><span class="token1">]</span> as $goods<span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>li<span class="token">></span> <span class="token"><</span>a href<span class="token">=</span><span class="token4">"<?= Yf_Registry::get('url') ?>?ctl=Goods_Goods&met=goods&type=goods&gid=<?=($goods['goods_id'])?>"</span> title<span class="token">=</span><span class="token4">"<?=($goods['goods_name'])?>"</span> target<span class="token">=</span><span class="token4">"_blank"</span> class<span class="token">=</span><span class="token4">"gift"</span><span class="token">></span> <span class="token"><</span>img src<span class="token">=</span><span class="token4">"<?=image_thumb($goods['goods_image'],80,80)?>"</span> alt<span class="token">=</span><span class="token4">"<?=($goods['goods_name'])?>"</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token">&</span>nbsp<span class="token1">;</span> <span class="token"><</span><span class="token">/</span>li<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>ul<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token5">//满即送</span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span> <span class="token">&&</span> $goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span> <span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"ncs-mansong"</span><span class="token">></span> <span class="token"><</span>i class<span class="token">=</span><span class="token4">"group_purchase "</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'满即送:'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"sale-rule"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php $rule <span class="token">=</span> $goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token1">]</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'购物满'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">format_money</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_price'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_discount'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">',即享'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_discount'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'元优惠'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'goods_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">',送'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>a href<span class="token">=</span><span class="token4">"<?= Yf_Registry::get('url') ?>?ctl=Goods_Goods&met=goods&type=goods&gid=<?=($rule['goods_id'])?>"</span> title<span class="token">=</span><span class="token4">"<?=($rule['goods_name'])?>"</span> target<span class="token">=</span><span class="token4">"_blank"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'赠品'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"sale-rule-more"</span> nctype<span class="token">=</span><span class="token4">"show-rule"</span><span class="token">></span><span class="token"><</span>a href<span class="token">=</span><span class="token4">"javascript:void(0);"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'共'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>strong<span class="token">></span><span class="token"><</span><span class="token">?</span>php echo <span class="token3">count</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>strong<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'项,展开'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>i class<span class="token">=</span><span class="token4">"iconfont icon-iconjiantouxia"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>i<span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"sale-rule-content"</span> style<span class="token">=</span><span class="token4">"display: none;"</span> nctype<span class="token">=</span><span class="token4">"rule-content"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"title"</span><span class="token">></span><span class="token"><</span>span class<span class="token">=</span><span class="token4">"sale-name"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'满即送'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>span<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'共'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>strong<span class="token">></span><span class="token"><</span><span class="token">?</span>php echo <span class="token3">count</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>strong<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'项,促销活动规则'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>a href<span class="token">=</span><span class="token4">"javascript:;"</span> nctype<span class="token">=</span><span class="token4">"hide-rule"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'关闭'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"content clearfix"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"mjs-tit"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'mansong_name'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span>time<span class="token">></span><span class="token1">(</span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'mansong_start_time'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token">--</span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'mansong_end_time'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token1">)</span><span class="token"><</span><span class="token">/</span>time<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>ul class<span class="token">=</span><span class="token4">"mjs-info clearfix"</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token3">foreach</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'rule'</span><span class="token1">]</span> as $rule<span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span>li<span class="token">></span> <span class="token"><</span>span class<span class="token">=</span><span class="token4">"sale-rule"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'购物满'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">format_money</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_price'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_discount'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">', 即享'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'rule_discount'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>em<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">'元优惠'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token2">if</span><span class="token1">(</span><span class="token">!</span><span class="token3">empty</span><span class="token1">(</span>$rule<span class="token1">[</span><span class="token4">'goods_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">', 送 '</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span>a href<span class="token">=</span><span class="token4">"<?= Yf_Registry::get('url') ?>?ctl=Goods_Goods&met=goods&type=goods&gid=<?=($rule['goods_id'])?>"</span> title<span class="token">=</span><span class="token4">"<?=($rule['goods_name'])?>"</span> target<span class="token">=</span><span class="token4">"_blank"</span> class<span class="token">=</span><span class="token4">"gift"</span><span class="token">></span> <span class="token"><</span>img src<span class="token">=</span><span class="token4">"<?=image_thumb($rule['goods_image'],60,60)?>"</span> alt<span class="token">=</span><span class="token4">"<?=($rule['goods_name'])?>"</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>a<span class="token">></span><span class="token">&</span>nbsp<span class="token1">;</span><span class="token"><</span>br<span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">__</span><span class="token1">(</span><span class="token4">',数量有限,赠完为止。 '</span><span class="token1">)</span><span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>span<span class="token">></span> <span class="token"><</span><span class="token">/</span>li<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>ul<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"mjs-remark wp100 overflow"</span><span class="token">></span><span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token1">(</span>$goods_detail<span class="token1">[</span><span class="token4">'mansong_info'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'mansong_remark'</span><span class="token1">]</span><span class="token1">)</span><span class="token">?</span><span class="token">></span><span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">?</span>php <span class="token1">}</span> <span class="token">?</span><span class="token">></span> ``` ``` 加入购物车 ``` <pre class="calibre14">``` $<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span> url<span class="token1">:</span> SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Buyer_Cart&met=addCart&typ=json'</span><span class="token1">,</span> data<span class="token1">:</span> <span class="token1">{</span>goods_id<span class="token1">:</span>goods_id<span class="token1">,</span> goods_num<span class="token1">:</span> goods_num<span class="token1">}</span><span class="token1">,</span> dataType<span class="token1">:</span> <span class="token4">"json"</span><span class="token1">,</span> contentType<span class="token1">:</span> <span class="token4">"application/json;charset=utf-8"</span><span class="token1">,</span> async<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span> success<span class="token1">:</span> <span class="token2">function</span> <span class="token1">(</span>a<span class="token1">)</span> <span class="token1">{</span> <span class="token2">if</span> <span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">250</span><span class="token1">)</span> <span class="token1">{</span> Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span>a<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token2">else</span> <span class="token1">{</span> <span class="token5">//加入购物车成功后,修改购物车数量</span> $<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span> type<span class="token1">:</span> <span class="token4">"GET"</span><span class="token1">,</span> url<span class="token1">:</span> SITE_URL <span class="token">+</span> <span class="token4">"?ctl=Buyer_Cart&met=getCartGoodsNum&typ=json"</span><span class="token1">,</span> data<span class="token1">:</span> <span class="token1">{</span><span class="token1">}</span><span class="token1">,</span> dataType<span class="token1">:</span> <span class="token4">"json"</span><span class="token1">,</span> success<span class="token1">:</span> <span class="token2">function</span><span class="token1">(</span>data<span class="token1">)</span><span class="token1">{</span> <span class="token3">getCartList</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> $<span class="token1">(</span><span class="token4">'#cart_num'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">html</span><span class="token1">(</span>data<span class="token1">.</span>data<span class="token1">.</span>cart_count<span class="token1">)</span><span class="token1">;</span> $<span class="token1">(</span><span class="token4">'.cart_num_toolbar'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">html</span><span class="token1">(</span>data<span class="token1">.</span>data<span class="token1">.</span>cart_count<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> $<span class="token1">.</span><span class="token3">dialog</span><span class="token1">(</span><span class="token1">{</span> title<span class="token1">:</span> <span class="token4">"<?=__('加入购物车')?>"</span><span class="token1">,</span> height<span class="token1">:</span> <span class="token6">100</span><span class="token1">,</span> width<span class="token1">:</span> <span class="token6">250</span><span class="token1">,</span> lock<span class="token1">:</span> <span class="token6">true</span><span class="token1">,</span> drag<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span> content<span class="token1">:</span> <span class="token4">'url: '</span><span class="token">+</span>SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Buyer_Cart&met=add&typ=e'</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span><span class="token1">,</span> failure<span class="token1">:</span> <span class="token2">function</span> <span class="token1">(</span>a<span class="token1">)</span> <span class="token1">{</span> Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span><span class="token4">'<?=__('</span>操作失败!<span class="token4">')?>'</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> ``` ``` 收藏商品 ``` <pre class="calibre14">``` $<span class="token1">.</span><span class="token3">post</span><span class="token1">(</span>SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Goods_Goods&met=collectGoods&typ=json'</span><span class="token1">,</span><span class="token1">{</span>goods_id<span class="token1">:</span>e<span class="token1">}</span><span class="token1">,</span><span class="token2">function</span><span class="token1">(</span>data<span class="token1">)</span> <span class="token1">{</span> <span class="token2">if</span><span class="token1">(</span>data<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span> <span class="token1">{</span> Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">success</span><span class="token1">(</span>data<span class="token1">.</span>data<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">;</span> $<span class="token1">(</span><span class="token4">".icon-icoheart"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">addClass</span><span class="token1">(</span><span class="token4">"icon-taoxinshi"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">removeClass</span><span class="token1">(</span><span class="token4">'icon-icoheart'</span><span class="token1">)</span><span class="token1">;</span> <span class="token5">//toolbar显示收藏效果</span> $<span class="token1">(</span><span class="token4">"#collect_lable"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">removeClass</span><span class="token1">(</span><span class="token4">'icon-icoheart'</span><span class="token1">)</span><span class="token1">;</span> $<span class="token1">(</span><span class="token4">"#collect_lable"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">addClass</span><span class="token1">(</span><span class="token4">'icon-taoxinshi'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">addClass</span><span class="token1">(</span><span class="token4">'bbc_color'</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token2">else</span> <span class="token1">{</span> Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span>data<span class="token1">.</span>data<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> ``` ``` 收藏店铺 ``` <pre class="calibre15">``` $<span class="token1">.</span><span class="token3">post</span><span class="token1">(</span>SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Shop&met=addCollectShop&typ=json'</span><span class="token1">,</span><span class="token1">{</span>shop_id<span class="token1">:</span>e<span class="token1">}</span><span class="token1">,</span><span class="token2">function</span><span class="token1">(</span>data<span class="token1">)</span> <span class="token1">{</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> ``` ```