💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 自销产品供应商 文件路径:shop/controllers/Seller/Shop/SupplierCtl.php 一、供货商 1.添加供货商 控制器:shop/controllers/Seller/Shop/SupplierCtl.php 模型:shop/models/shop/SupplierModel.php 视图:根据URL获得参数act的值,判断视图 ``` <pre class="calibre14">``` $act <span class="token">=</span> <span class="token3">request_string</span><span class="token1">(</span><span class="token4">'act'</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span> <span class="token1">(</span>$act <span class="token">==</span> <span class="token4">'edit'</span><span class="token1">)</span> <span class="token1">{</span> $supplier_id <span class="token">=</span> <span class="token3">request_int</span><span class="token1">(</span><span class="token4">'supplier_id'</span><span class="token1">)</span><span class="token1">;</span> $cond_row<span class="token1">[</span><span class="token4">'id'</span><span class="token1">]</span> <span class="token">=</span> $supplier_id<span class="token1">;</span> $data <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopSupplierModel<span class="token">-</span><span class="token">></span><span class="token3">getSupplierinfo</span><span class="token1">(</span>$supplier_id<span class="token1">)</span><span class="token1">;</span> $this<span class="token">-</span><span class="token">></span>view<span class="token">-</span><span class="token">></span><span class="token3">setMet</span><span class="token1">(</span><span class="token4">'setSupplier'</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> elseif <span class="token1">(</span>$act <span class="token">==</span> <span class="token4">'add'</span><span class="token1">)</span> <span class="token1">{</span> $this<span class="token">-</span><span class="token">></span>view<span class="token">-</span><span class="token">></span><span class="token3">setMet</span><span class="token1">(</span><span class="token4">'setSupplier'</span><span class="token1">)</span><span class="token1">;</span> $data <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> ``` ``` - shop/views/default/Seller/Shop/SupplierCtl/supplier.php 供应商列表:`$data = $this->shopSupplierModel->getSupplierlist($cond_row, array(), $page, $rows);` 方法:supplier() - shop/views/default/Seller/Shop/SupplierCtl/setSupplier.php 编辑、添加、删除供货商:editSupplier()、addSupplier()、delSupplier() 编辑:`$flag = $this->shopSupplierModel->editsupplier($supplier_id, $supplier);` 添加:`$flag = $this->shopSupplierModel->addsupplier($supplier);` 删除:`$flag = $this->shopSupplierModel->removeSupplier($supplier_id);`