# 消费者保障服务
文件路径:shop/controllers/Seller/Shop/ContractCtl.php
流程:加入->平台审核->审核通过
一、消费者保障服务
- 七天退货
- 品质承诺
- 破损寄补
- 极速物流
- 服务状态(开启、关闭)
参数:contract\_type\_state
模型:shop/models/shop/ContractTypeModel.php
```
<pre class="calibre14">```
public static $state <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span>
<span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'open'</span><span class="token1">,</span>
<span class="token4">'2'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'close'</span><span class="token1">,</span>
<span class="token1">)</span><span class="token1">;</span>
```
```
- 保障服务申请状态(未加入、已加入、加入审核中、退出审核)
模型:shop/models/shop/class Shop\_ContractModel extends Shop\_Contract.php
```
<pre class="calibre14">```
const CONTRACT_INUSE <span class="token">=</span> <span class="token6">1</span><span class="token1">;</span>
const CONTRACT_UNUSE <span class="token">=</span> <span class="token6">2</span><span class="token1">;</span>
const CONTRACT_JOIN <span class="token">=</span> <span class="token6">1</span><span class="token1">;</span>
const CONTRACT_QUIT <span class="token">=</span> <span class="token6">2</span><span class="token1">;</span>
public static $state <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span>
<span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'inuse'</span><span class="token1">,</span>
<span class="token4">'2'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'unuse'</span><span class="token1">,</span>
<span class="token1">)</span><span class="token1">;</span>
public <span class="token2">function</span> <span class="token3">getContractList</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>
$data <span class="token">=</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>
$Shop_ContractLogModel <span class="token">=</span> <span class="token2">new</span> <span class="token3">Shop_ContractLogModel</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
foreach <span class="token1">(</span>$data<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span> as $key <span class="token">=</span><span class="token">></span> $val<span class="token1">)</span>
<span class="token1">{</span>
$log <span class="token">=</span> $Shop_ContractLogModel<span class="token">-</span><span class="token">></span><span class="token3">getOneLog</span><span class="token1">(</span>$val<span class="token1">[</span><span class="token4">'contract_log_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span>
$data<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">[</span>$key<span class="token1">]</span><span class="token1">[</span><span class="token4">'log_state'</span><span class="token1">]</span> <span class="token">=</span> $log<span class="token1">[</span><span class="token4">'contract_log_state_etext'</span><span class="token1">]</span><span class="token1">;</span>
<span class="token2">if</span> <span class="token1">(</span>$val<span class="token1">[</span><span class="token4">'contract_state'</span><span class="token1">]</span> <span class="token">==</span> self<span class="token1">:</span><span class="token1">:</span>CONTRACT_INUSE<span class="token1">)</span>
<span class="token1">{</span>
<span class="token2">if</span> <span class="token1">(</span>$val<span class="token1">[</span><span class="token4">'contract_use_state'</span><span class="token1">]</span> <span class="token">==</span> self<span class="token1">:</span><span class="token1">:</span>CONTRACT_JOIN<span class="token1">)</span>
<span class="token1">{</span>
<span class="token2">if</span> <span class="token1">(</span>$log<span class="token1">[</span><span class="token4">'contract_log_state'</span><span class="token1">]</span> <span class="token">==</span> Shop_ContractLogModel<span class="token1">:</span><span class="token1">:</span>LOG_STATE_PASS<span class="token1">)</span>
<span class="token1">{</span>
$data<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">[</span>$key<span class="token1">]</span><span class="token1">[</span><span class="token4">'contract_state_text'</span><span class="token1">]</span> <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'已加入'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
$data<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">[</span>$key<span class="token1">]</span><span class="token1">[</span><span class="token4">'contract_state_text'</span><span class="token1">]</span> <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'加入审核中'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
elseif <span class="token1">(</span>$val<span class="token1">[</span><span class="token4">'contract_use_state'</span><span class="token1">]</span> <span class="token">==</span> self<span class="token1">:</span><span class="token1">:</span>CONTRACT_QUIT<span class="token1">)</span>
<span class="token1">{</span>
<span class="token2">if</span> <span class="token1">(</span>$log<span class="token1">[</span><span class="token4">'contract_log_state'</span><span class="token1">]</span> <span class="token">==</span> Shop_ContractLogModel<span class="token1">:</span><span class="token1">:</span>LOG_STATE_PASS<span class="token1">)</span>
<span class="token1">{</span>
$data<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">[</span>$key<span class="token1">]</span><span class="token1">[</span><span class="token4">'contract_state_text'</span><span class="token1">]</span> <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'未加入'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
$data<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">[</span>$key<span class="token1">]</span><span class="token1">[</span><span class="token4">'contract_state_text'</span><span class="token1">]</span> <span class="token">=</span> <span class="token3">__</span><span class="token1">(</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>
elseif <span class="token1">(</span>$val<span class="token1">[</span><span class="token4">'contract_state'</span><span class="token1">]</span> <span class="token">==</span> self<span class="token1">:</span><span class="token1">:</span>CONTRACT_UNUSE<span class="token1">)</span>
<span class="token1">{</span>
$data<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">[</span>$key<span class="token1">]</span><span class="token1">[</span><span class="token4">'contract_state_text'</span><span class="token1">]</span> <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'永久禁止使用'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token2">return</span> $data<span class="token1">;</span>
<span class="token1">}</span>
```
```
视图:根据URL获得参数act的值,判断视图
```
<pre class="calibre14">```
<span class="token2">if</span> <span class="token1">(</span>$act <span class="token">==</span> <span class="token4">"detail"</span><span class="token1">)</span>
<span class="token1">{</span>
$data <span class="token">=</span> $this<span class="token">-</span><span class="token">></span><span class="token3">detail</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">'detail'</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>
```
```
1.加入活动
- 控制器:shop/controllers/Seller/Shop/ContractCtl.php
- 视图:shop/views/default/Seller/Shop/ContractCtl/index.php
加入表单验证:`$("[nc_type='applybtn']").click(function (){})`
方法:joinContract()
```
<pre class="calibre14">```
$contract <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopContractModel<span class="token">-</span><span class="token">></span><span class="token3">getOneByWhere</span><span class="token1">(</span>$cond_row<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>$contract<span class="token1">)</span><span class="token1">)</span>
<span class="token1">{</span>
$field_row<span class="token1">[</span><span class="token4">'contract_type_id'</span><span class="token1">]</span> <span class="token">=</span> $contract_type_id<span class="token1">;</span>
$field_row<span class="token1">[</span><span class="token4">'contract_type_name'</span><span class="token1">]</span> <span class="token">=</span> $data<span class="token1">[</span><span class="token4">'contract_type_name'</span><span class="token1">]</span><span class="token1">;</span>
$field_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>
$field_row<span class="token1">[</span><span class="token4">'shop_name'</span><span class="token1">]</span> <span class="token">=</span> $shop<span class="token1">[</span><span class="token4">'shop_name'</span><span class="token1">]</span><span class="token1">;</span>
$field_row<span class="token1">[</span><span class="token4">'contract_use_state'</span><span class="token1">]</span> <span class="token">=</span> Shop_ContractModel<span class="token1">:</span><span class="token1">:</span>CONTRACT_JOIN<span class="token1">;</span>
$contract_id <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopContractModel<span class="token">-</span><span class="token">></span><span class="token3">addContract</span><span class="token1">(</span>$field_row<span class="token1">,</span> <span class="token6">true</span><span class="token1">)</span><span class="token1">;</span>
<span class="token3">check_rs</span><span class="token1">(</span>$contract_id<span class="token1">,</span> $rs_row<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
$contract_id <span class="token">=</span> $contract<span class="token1">[</span><span class="token4">'contract_id'</span><span class="token1">]</span><span class="token1">;</span>
$field_row<span class="token1">[</span><span class="token4">'contract_use_state'</span><span class="token1">]</span> <span class="token">=</span> Shop_ContractModel<span class="token1">:</span><span class="token1">:</span>CONTRACT_JOIN<span class="token1">;</span>
$flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopContractModel<span class="token">-</span><span class="token">></span><span class="token3">editContract</span><span class="token1">(</span>$contract_id<span class="token1">,</span> $field_row<span class="token1">)</span><span class="token1">;</span>
<span class="token3">check_rs</span><span class="token1">(</span>$flag<span class="token1">,</span> $rs_row<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
```
```
- 平台审核加入:
控制器:shop/controllers/Api/Operation/ContractCtl.php
视图:shop\_admin/views/default/Operation/ContractCtl/log.php
JS:shop\_admin/static/default/js/controllers/operation/contract\_list.js
2.退出活动
- 控制器:shop/controllers/Seller/Shop/ContractCtl.php
- 视图:shop/views/default/Seller/Shop/ContractCtl/index.php
表单验证:`$("[nc_type='quitbtn']").click(function (){})`
方法:quitContract()
`$flag = $this->shopContractModel->editContract($contract_id, $clog_row);`
- 平台审核退出:
控制器:shop/controllers/Api/Operation/ContractCtl.php
视图:shop\_admin/views/default/Operation/ContractCtl/log.php
JS:shop\_admin/static/default/js/controllers/operation/contract\_list.js
3.查看服务详情
视图:shop/views/default/Seller/Shop/ContractCtl/detail.php
服务详情:
```
<pre class="calibre15">```
$data<span class="token1">[</span><span class="token4">'contract_type'</span><span class="token1">]</span> <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopContractTypeModel<span class="token">-</span><span class="token">></span><span class="token3">getOne</span><span class="token1">(</span>$cond_row<span class="token1">[</span><span class="token4">'contract_type_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span>
$contract <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopContractModel<span class="token">-</span><span class="token">></span><span class="token3">getOneByWhere</span><span class="token1">(</span>$cond_row<span class="token1">)</span><span class="token1">;</span>
$data<span class="token1">[</span><span class="token4">'contract'</span><span class="token1">]</span> <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopContractModel<span class="token">-</span><span class="token">></span><span class="token3">getOneContract</span><span class="token1">(</span>$contract<span class="token1">[</span><span class="token4">'contract_id'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">;</span>
$data<span class="token1">[</span><span class="token4">'log'</span><span class="token1">]</span> <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopContractLogModel<span class="token">-</span><span class="token">></span><span class="token3">getContractLogList</span><span class="token1">(</span>$cond_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'contract_log_date'</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>
```
```
- 序言
- 系统要求
- 版本更新日志
- 远丰商城技术对接说明
- 开发指导
- 框架内容
- 基础
- 开发规范
- 目录结构
- 架构
- 架构总览
- 数据库
- 数据库连接
- 基本使用
- 缓存
- 配置
- 路由
- 数据字典
- ucenter
- shop
- paycenter
- ucenter_admin
- shop_admin
- paycenter_admin
- 通讯内容
- 商家中心
- 顶部导航栏
- 店铺信息栏
- 店铺及商品提示栏
- 交易提示栏
- 销售情况统计栏
- 单品销量排行栏
- 店铺运营推广栏
- 平台联系方式栏
- 订单物流
- 商品
- 商品列表
- 商品详情
- 商品发布与编辑
- 分销商品
- 关联版式
- 商品规格
- 图片空间
- 淘宝导入
- 订单流程
- 交易订单
- 订单退款/退货
- 促销
- 团购管理
- 加价购
- 限时折扣
- 满即送
- 代金券管理
- 分销
- 店铺
- 店铺设置
- 自销产品供应商
- 实体店铺
- 品牌申请
- 店铺信息
- 消费者保障服务
- 门店账号
- 分销商--产品供应商
- 分销明细
- 批发市场
- 售后服务
- 咨询管理
- 投诉管理
- 退款管理
- 退货管理
- 云方案架构
- 负载集群
- 云存储
- 接口
- Api接口说明
- 品牌
- 商品规格
- 商品类型
- 商品分类
- 商品
- 订单
- 商品/店铺收藏
- 足迹
- 退款及退货
- 商家店铺
- 会员
- 入驻协议
- 订单接口
- 商品接口
- 订单物流接口
- 商家中心接口
- 促销接口
- 快递鸟物流接口
- 代金券接口
- 首页版块
- 团购
- 平台红包
- 限时折扣接口
- 拼团接口
- wap首页模板
- 杂项
- 远程上传图片
- JS
- 银联支付
- 多语言
- 商品评分
- 图片加载
- 买家申请退款退货
- 商家退款退货
- 平台退款退货
- 添加发票
- 提交订单
- 确认订单
- 运费销售区域
- 获取会员地址
- 充值
- 导出XLS
- 商城系统集成
- 多语言实现
- 三级分销推广链接发展推广员
- app.ini.php
- 去分销
- 版本更新
- 物流支持
- 运营人员建议
- 业务逻辑
- 统计结算
- 客服消息
- 账号
- 三级分销
- IM
- 配置
- 平台帐号
- 活动数据表说明