多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 咨询管理 文件路径:shop/controllers/Seller/Service/ConsultCtl.php 一、咨询列表 视图:shop/views/default/Seller/Service/ConsultCtl/index.php 方法:index() ``` <pre class="calibre14">``` $data <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>consultBaseModel<span class="token">-</span><span class="token">></span><span class="token3">getBaseList</span><span class="token1">(</span>$cond_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span> <span class="token4">'answer_time'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'desc'</span><span class="token1">,</span> <span class="token4">'question_time'</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> $rows<span class="token1">)</span><span class="token1">;</span> ``` ``` 二、回复、修改回复咨询 视图:shop/views/default/Seller/Service/ConsultCtl/reply.php 回复提交验证:`$('#form').validator({})` 方法:replyConsult() ``` <pre class="calibre14">``` <span class="token5">//首先过滤违禁词</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>$consult_answer<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">'failure'</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>consultBaseModel<span class="token">-</span><span class="token">></span><span class="token3">editBase</span><span class="token1">(</span>$consult_id<span class="token1">,</span> $data<span class="token1">)</span><span class="token1">;</span> ``` ``` 三、删除咨询 方法:delConsult()、delAllConsult() ``` <pre class="calibre14">``` <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">"{'ctl':'Seller_Service_Consult','met':'delConsult','id':'<?= $value['consult_id'] ?>'}"</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>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_Service_Consult','met':'delAllConsult'}"</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> ``` ``` ``` <pre class="calibre14">``` <span class="token5">//delConsult()</span> $flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>consultBaseModel<span class="token">-</span><span class="token">></span><span class="token3">removeBase</span><span class="token1">(</span>$consult_id<span class="token1">)</span><span class="token1">;</span> <span class="token5">//delAllConsult()</span> $del_flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>consultBaseModel<span class="token">-</span><span class="token">></span><span class="token3">removeSelectedConsult</span><span class="token1">(</span>$v<span class="token1">)</span><span class="token1">;</span> ``` ``` 四、用户购买咨询 - 视图:shop/views/default/Goods/GoodsCtl/goods.php 商品详情->购买咨询 JS:shop/static/default/js/goods\_detail.js ``` <pre class="calibre14">``` <span class="token5">//咨询</span> <span class="token3">load_goodseval</span><span class="token1">(</span>SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Goods_Goods&met=getConsultListRows&goods_id='</span> <span class="token">+</span> goods_id<span class="token1">,</span><span class="token4">'goodsadvisory'</span><span class="token1">)</span><span class="token1">;</span> ``` ``` - 购买咨询视图:shop/views/default/Goods/GoodsCtl/getConsultListRows.php 方法:getConsultListRows(); - 发起咨询提问: 视图:shop/views/default/Buyer/Service/ConsultCtl/add.php 控制器方法:shop/controllers/Buyer/Service/ConsultCtl.php -> addConsult() `$flag = $this->consultBaseModel->addBase($data);`