多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 店铺设置 文件路径: 1. shop/controllers/Seller/Shop/SetshopCtl.php 2. shop/controllers/Seller/Shop/DecorationCtl.php 3. shop/controllers/Seller/Shop/NavCtl.php 4. shop/controllers/Seller/Shop/CatCtl.php 一、店铺设置 控制器:shop/controllers/Seller/Shop/SetshopCtl.php 模型:shop/models/shop/BaseModel.php 视图:shop/views/default/Seller/Shop/SetshopCtl/index.php 确认提交表单验证:`$('#form').validator({})` 修改店铺信息方法:editShop(); `$flag = $this->shopBaseModel->editBase($shop_id, $edit_shop_row);` 二、店铺幻灯片 控制器:shop/controllers/Seller/Shop/SetshopCtl.php 模型:shop/models/shop/BaseModel.php 视图:shop/views/default/Seller/Shop/SetshopCtl/slide.php 确认提交表单验证:`$('#form').validator({})` 修改店铺幻灯片方法:editSlide(); `$flag = $this->shopBaseModel->editBase($shop_id, $data);` 三、店铺模板 控制器:shop/controllers/Seller/Shop/SetshopCtl.php 模型:shop/models/shop/BaseModel.php 视图:shop/views/default/Seller/Shop/SetshopCtl/theme.php 确认提交表单验证:`$('#form').validator({})` 修改店铺模板方法:setShopTemp(); `$flag = $this->shopBaseModel->editBase($shop_id, $data);` 四、店铺装修 控制器:shop/controllers/Seller/Shop/DecorationCtl.php 模型:shop/models/shop/BaseModel.php、shop/models/shop/DecorationModel.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><span class="token3">empty</span><span class="token1">(</span>$act<span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token5">//进入这个页面创建店铺装潢</span> $shop_decoration_info <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopDecorationModel<span class="token">-</span><span class="token">></span><span class="token3">getOneByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span> <span class="token">=</span><span class="token">></span> $shop_id<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span> <span class="token1">(</span><span class="token3">empty</span><span class="token1">(</span>$shop_decoration_info<span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token5">//创建默认装修</span> $param <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> $param<span class="token1">[</span><span class="token4">'decoration_name'</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">'默认装修'</span><span class="token1">;</span> $param<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> $shop_id<span class="token1">;</span> $decoration_id <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopDecorationModel<span class="token">-</span><span class="token">></span><span class="token3">addDecoration</span><span class="token1">(</span>$param<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token2">else</span> <span class="token1">{</span> $decoration_id <span class="token">=</span> $shop_decoration_info<span class="token1">[</span><span class="token4">'decoration_id'</span><span class="token1">]</span><span class="token1">;</span> <span class="token1">}</span> $renovation_list <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>$shop_id<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">"set"</span><span class="token1">)</span> <span class="token1">{</span> $decoration_detail <span class="token">=</span> $this<span class="token">-</span><span class="token">></span><span class="token3">decorationList</span><span class="token1">(</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">'setdecoration'</span><span class="token1">)</span><span class="token1">;</span><span class="token5">//视图</span> <span class="token1">}</span> include $this<span class="token">-</span><span class="token">></span>view<span class="token">-</span><span class="token">></span><span class="token3">getView</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> ``` ``` - shop/views/default/Seller/Shop/DecorationCtl/decoration.php 确认提交表单验证:`$('#form').validator({})` 修改店铺模板方法:editRenovation(); `$renovation_list = $this->shopBaseModel->editBase($shop_id, $renovation);` - shop/views/default/Seller/Shop/DecorationCtl/setdecoration.php(URL获得参数act = set) 店铺装修选项 五、店铺导航 控制器:shop/controllers/Seller/Shop/NavCtl.php 模型:shop/models/shop/NavModel.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> $nav_id <span class="token">=</span> <span class="token3">request_int</span><span class="token1">(</span><span class="token4">'nav_id'</span><span class="token1">)</span><span class="token1">;</span> $data <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopNavModel<span class="token">-</span><span class="token">></span><span class="token3">getNavinfo</span><span class="token1">(</span>$nav_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">'setNav'</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">'setNav'</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> include $this<span class="token">-</span><span class="token">></span>view<span class="token">-</span><span class="token">></span><span class="token3">getView</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> ``` ``` - shop/views/default/Seller/Shop/NavCtl/nav.php 店铺表单列表:`$data = $this->shopNavModel->getNavlist($shop_id, array(), $page, $rows);` 模型:shop/models/shop/NavModel.php 方法:nav() - shop/views/default/Seller/Shop/NavCtl/setNav.php 确认提交表单验证:`$('#form').validator({})` 编辑、添加、删除导航:editNav()、addNav()、delNav() 编辑:`$flag = $this->shopNavModel->editNav($nav_id, $nav);` 添加:`$flag = $this->shopNavModel->addNav($nav);` 删除:`$flag = $this->shopNavModel->removeNav($nav_id);` 六、店铺分类 控制器:shop/controllers/Seller/Shop/CatCtl.php 模型:shop/models/shop/GoodCatModel.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> $pid <span class="token">=</span> <span class="token3">request_int</span><span class="token1">(</span><span class="token4">'pid'</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> $pid<span class="token1">;</span> $data <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopGoodCatModel<span class="token">-</span><span class="token">></span><span class="token3">getOne</span><span class="token1">(</span>$pid<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">'setCat'</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> $pid <span class="token">=</span> <span class="token3">request_int</span><span class="token1">(</span><span class="token4">'pid'</span><span class="token1">)</span><span class="token1">;</span> $shop_id<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> $data <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopGoodCatModel<span class="token">-</span><span class="token">></span><span class="token3">getGoodCatparent</span><span class="token1">(</span>$shop_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">'setCat'</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> include $this<span class="token">-</span><span class="token">></span>view<span class="token">-</span><span class="token">></span><span class="token3">getView</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> ``` ``` - shop/views/default/Seller/Shop/CatCtl/cat.php 店铺分类列表:`$data = $this->shopGoodCatModel->getGoodCatList($shop_id, array('shop_goods_cat_displayorder'=> 'DESC'));;` 模型:shop/models/shop/GoodCatModel.php 方法:nav() - shop/views/default/Seller/Shop/CatCtl/setCat.php 确认提交表单验证:`$('#form').validator({})` 编辑、添加、删除分类:editCa()、addCa()、delCa() 编辑:`$flag = $this->shopGoodCatModel->editGoodCat($shop_goods_cat_id, $cat);` 添加:`$flag = $this->shopGoodCatModel->addGoodCat($cat);` 删除:参数parent\_id,根据参数判断删除导航 ``` <pre class="calibre14">``` $cat_id <span class="token">=</span> <span class="token3">request_int</span><span class="token1">(</span><span class="token4">"id"</span><span class="token1">)</span><span class="token1">;</span> $cat <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopGoodCatModel<span class="token">-</span><span class="token">></span><span class="token3">getOne</span><span class="token1">(</span>$cat_id<span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span> <span class="token1">(</span>$cat<span class="token1">[</span><span class="token4">'parent_id'</span><span class="token1">]</span> <span class="token">==</span> <span class="token4">"0"</span><span class="token1">)</span> <span class="token1">{</span> $flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopGoodCatModel<span class="token">-</span><span class="token">></span><span class="token3">removeGoodAllCat</span><span class="token1">(</span>$cat_id<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> $this<span class="token">-</span><span class="token">></span>shopGoodCatModel<span class="token">-</span><span class="token">></span><span class="token3">removeGoodCat</span><span class="token1">(</span>$cat_id<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> ``` ``` 七、售后服务 控制器:shop/controllers/Seller/Shop/SetshopCtl.php 模型:shop/models/shop/BaseModel.php 视图:shop/views/default/Seller/Shop/SetshopCtl/service.php 确认提交表单验证:`$('#form').validator({})` 方法:editShopCommonService() 判断违禁词: ``` <pre class="calibre15">``` $common_service <span class="token">=</span> <span class="token3">request_string</span><span class="token1">(</span><span class="token4">'common_service'</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span> <span class="token1">(</span>Text_Filter<span class="token1">:</span><span class="token1">:</span><span class="token3">checkBanned</span><span class="token1">(</span>$common_service<span class="token1">,</span> $matche_row<span class="token1">)</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> $msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'含有违禁词'</span><span class="token1">)</span><span class="token1">;</span> $status <span class="token">=</span> <span class="token6">250</span><span class="token1">;</span> $this<span class="token">-</span><span class="token">></span>data<span class="token">-</span><span class="token">></span><span class="token3">addBody</span><span class="token1">(</span><span class="token">-</span><span class="token6">140</span><span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span> $msg<span class="token1">,</span> $status<span class="token1">)</span><span class="token1">;</span> <span class="token2">return</span> <span class="token6">false</span><span class="token1">;</span> <span class="token1">}</span> $flag <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">editBase</span><span class="token1">(</span>$shop_id<span class="token1">,</span> $shop_edit_row<span class="token1">)</span><span class="token1">;</span> ``` ```