多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 分销商品 分销商品 文件路径:shop/controllers/Seller/Supplier/GoodsCtl.php; ##### 后台数据 出售中的商品(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_parent_id:>'</span><span class="token">=</span><span class="token">></span><span class="token6">0</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_VERIFY_ALLOW<span class="token1">)</span><span class="token1">;</span> <span class="token5">// 如果有搜索单号</span> $cront_row<span class="token1">[</span><span class="token4">'common_name:like'</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">'%'</span> <span class="token1">.</span> $goods_key <span class="token1">.</span> <span class="token4">'%'</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> public <span class="token2">function</span> <span class="token3">getCommonNormal</span><span class="token1">(</span>$cond_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $order_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $page <span class="token">=</span> <span class="token6">1</span><span class="token1">,</span> $rows <span class="token">=</span> <span class="token6">100</span><span class="token1">)</span> <span class="token1">{</span> $cond_row<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">;</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> <span class="token2">return</span> $this<span class="token">-</span><span class="token">></span><span class="token3">listByWhere</span><span class="token1">(</span>$cond_row<span class="token1">,</span> $order_row<span class="token1">,</span> $page<span class="token1">,</span> $rows<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> ``` ``` 仓库中的商品(offline()): ``` <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_parent_id:>'</span><span class="token">=</span><span class="token">></span><span class="token6">0</span><span class="token1">)</span><span class="token1">;</span> $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_name:like'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'%'</span> <span class="token1">.</span> $goods_key <span class="token1">.</span> <span class="token4">'%'</span><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> public <span class="token2">function</span> <span class="token3">getCommonOffline</span><span class="token1">(</span>$cond_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $order_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $page <span class="token">=</span> <span class="token6">1</span><span class="token1">,</span> $rows <span class="token">=</span> <span class="token6">100</span><span class="token1">)</span> <span class="token1">{</span> $cond_row<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">;</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_OFFLINE<span class="token1">;</span> <span class="token5">//下架</span> $cond_row<span class="token1">[</span><span class="token4">'common_goods_from'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">1</span><span class="token1">;</span> <span class="token5">//不是外部导入商品(外部导入商品上架后属于正常商品,撕掉外部导入标签)</span> <span class="token2">if</span> <span class="token1">(</span>Web_ConfigModel<span class="token1">:</span><span class="token1">:</span><span class="token3">value</span><span class="token1">(</span><span class="token4">'goods_verify_flag'</span><span class="token1">)</span> <span class="token">==</span> <span class="token6">1</span><span class="token1">)</span> <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> <span class="token1">}</span> <span class="token2">return</span> $this<span class="token">-</span><span class="token">></span><span class="token3">listByWhere</span><span class="token1">(</span>$cond_row<span class="token1">,</span> $order_row<span class="token1">,</span> $page<span class="token1">,</span> $rows<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> ``` ``` 等待审核的商品(verify()): ``` <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_parent_id:>'</span><span class="token">=</span><span class="token">></span><span class="token6">0</span><span class="token1">)</span><span class="token1">;</span> $cront_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'common_name:like'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'%'</span> <span class="token1">.</span> $goods_key <span class="token1">.</span> <span class="token4">'%'</span><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> public <span class="token2">function</span> <span class="token3">getCommonVerifyWaiting</span><span class="token1">(</span>$cond_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $order_row <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $page <span class="token">=</span> <span class="token6">1</span><span class="token1">,</span> $rows <span class="token">=</span> <span class="token6">100</span><span class="token1">)</span> <span class="token1">{</span> $cond_row<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'common_state:IN'</span><span class="token1">]</span> <span class="token">=</span> <span class="token1">[</span>Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_OFFLINE<span class="token1">,</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_NORMAL<span class="token1">,</span> Goods_CommonModel<span class="token1">:</span><span class="token1">:</span>GOODS_STATE_TIMING<span class="token1">]</span><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_WAITING<span class="token1">;</span> <span class="token2">return</span> $this<span class="token">-</span><span class="token">></span><span class="token3">listByWhere</span><span class="token1">(</span>$cond_row<span class="token1">,</span> $order_row<span class="token1">,</span> $page<span class="token1">,</span> $rows<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> ``` ``` ##### 前台显示 前台显示与商品列表中显示一致