# 限时折扣
文件路径:shop/controllers/Seller/Promotion/DiscountCtl.php
一、活动列表【方法:index();】
- 控制器:shop/controllers/Seller/Promotion/DiscountCtl.php ->index()
- 模型:shop/models/Discount/QuotaModel.php
shop/models/Discount/BaseModel.php
- 视图:shop/views/default/Seller/Promotion/DiscountCtl/index.php
1.套餐过期时间及备注
```
<pre class="calibre14">```
<span class="token2">if</span> <span class="token1">(</span><span class="token">!</span>$this<span class="token">-</span><span class="token">></span>self_support_flag<span class="token1">)</span> <span class="token5">//普通店铺</span>
<span class="token1">{</span>
$com_flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>combo_flag<span class="token1">;</span>
<span class="token2">if</span> <span class="token1">(</span>$this<span class="token">-</span><span class="token">></span>combo_flag<span class="token1">)</span><span class="token5">//套餐可用</span>
<span class="token1">{</span>
$combo_row <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>discountQuotaModel<span class="token">-</span><span class="token">></span><span class="token3">getDiscountQuotaByShopID</span><span class="token1">(</span>Perm<span class="token1">:</span><span class="token1">:</span>$shopId<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token5">//店铺下的加价购活动列表</span>
$data <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>discountBaseModel<span class="token">-</span><span class="token">></span><span class="token3">getDiscountActList</span><span class="token1">(</span>$cond_row<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'discount_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> $rows<span class="token1">)</span><span class="token1">;</span>
```
```
2.活动状态
模型:shop/models/Discount/BaseModel.php
参数:increase\_state(0.全部1.正常 2.已结束 3.管理员关闭)
```
<pre class="calibre14">```
const NORMAL <span class="token">=</span> <span class="token6">1</span><span class="token1">;</span><span class="token5">//正常</span>
const END <span class="token">=</span> <span class="token6">2</span><span class="token1">;</span><span class="token5">//结束</span>
const CANCEL <span class="token">=</span> <span class="token6">3</span><span class="token1">;</span><span class="token5">//管理员关闭</span>
```
```
3.操作
- 编辑(添加活动)
方法:shop/controllers/Seller/Promotion/DiscountCtl.php ->addDiscount()
视图:shop/views/default/Seller/Promotion/DiscountCtl/add.php
模型: shop/models/Discount/BaseModel.php
提交时表单验证:`$('#form').validator({})`
提交成功写入数据:`$discount_id = $this->discountBaseModel->addDiscountActivity($field_row, true);`
- 管理
视图:shop/views/default/Seller/Promotion/DiscountCtl/manage.php
添加商品:通过AJAX获取可以参加限时折扣的商品,已经参加团购活动的商品除外
方法:getShopGoods();
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'.btn_search_goods'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">on</span><span class="token1">(</span><span class="token4">'click'</span><span class="token1">,</span> <span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
var url <span class="token">=</span> SITE_URL <span class="token">+</span> <span class="token4">'?ctl=Seller_Promotion_Discount&met=getShopGoods&typ=e'</span><span class="token1">;</span>
var key <span class="token">=</span> $<span class="token1">(</span><span class="token4">'#search_goods_name'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
url <span class="token">=</span> key <span class="token">?</span> url <span class="token">+</span> <span class="token4">"&goods_name="</span> <span class="token">+</span> key <span class="token1">:</span> url<span class="token1">;</span>
$<span class="token1">(</span><span class="token4">'.search-goods-list-bd'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">load</span><span class="token1">(</span>url<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
- 删除限时折扣
控制器:shop/controllers/Seller/Promotion/DiscountCtl.php ->removeDiscountAct()
模型:shop/models/Discount/BaseModel.php
视图:shop/views/default/Seller/Promotion/DiscountCtl/index.php
二、添加活动
1.活动开始时间:不得小于当前时间,且小于套餐结束时间
2.活动结束时间:不得小于当前时间,且小于套餐结束时间
3.提交
新增活动提交时进行表单验证:`$('#form').validator({})`
- 方法:shop/controllers/Seller/Promotion/DiscountCtl.php ->addDiscount()
- 视图:shop/views/default/Seller/Promotion/DiscountCtl/add.php
- 模型: shop/models/Discount/BaseModel.php
三、套餐管理【方法:combo();】
1、套餐活动列表
- 控制器:shop/controllers/Seller/Promotion/DiscountCtl.php ->combo()
- 模型:shop/models/Shop/CostModel.php
- 视图:shop/views/default/Seller/Promotion/DiscountCtl/combo.php
2.、购买套餐
- 视图:shop/views/default/Seller/Promotion/DiscountCtl/combo.php
- 控制器:shop/controllers/Seller/Promotion/DiscountCtl.php ->addCombo()
- 模型:shop/models/Discount/ComboModel.php
(1)购买套餐时提交时进行表单验证:`$('#form').validator({})`
(2)在店铺的账期结算中扣除相关费用并且在paycenter中添加交易记录
参数:店铺id,根据店铺id号获取店铺套餐详情
1、原套餐已经过期,更新套餐开始时间和结束时间
2、原套餐尚未过期,只需更新结束时间
3、如果没有套餐详情,则套餐购买
- 序言
- 系统要求
- 版本更新日志
- 远丰商城技术对接说明
- 开发指导
- 框架内容
- 基础
- 开发规范
- 目录结构
- 架构
- 架构总览
- 数据库
- 数据库连接
- 基本使用
- 缓存
- 配置
- 路由
- 数据字典
- ucenter
- shop
- paycenter
- ucenter_admin
- shop_admin
- paycenter_admin
- 通讯内容
- 商家中心
- 顶部导航栏
- 店铺信息栏
- 店铺及商品提示栏
- 交易提示栏
- 销售情况统计栏
- 单品销量排行栏
- 店铺运营推广栏
- 平台联系方式栏
- 订单物流
- 商品
- 商品列表
- 商品详情
- 商品发布与编辑
- 分销商品
- 关联版式
- 商品规格
- 图片空间
- 淘宝导入
- 订单流程
- 交易订单
- 订单退款/退货
- 促销
- 团购管理
- 加价购
- 限时折扣
- 满即送
- 代金券管理
- 分销
- 店铺
- 店铺设置
- 自销产品供应商
- 实体店铺
- 品牌申请
- 店铺信息
- 消费者保障服务
- 门店账号
- 分销商--产品供应商
- 分销明细
- 批发市场
- 售后服务
- 咨询管理
- 投诉管理
- 退款管理
- 退货管理
- 云方案架构
- 负载集群
- 云存储
- 接口
- Api接口说明
- 品牌
- 商品规格
- 商品类型
- 商品分类
- 商品
- 订单
- 商品/店铺收藏
- 足迹
- 退款及退货
- 商家店铺
- 会员
- 入驻协议
- 订单接口
- 商品接口
- 订单物流接口
- 商家中心接口
- 促销接口
- 快递鸟物流接口
- 代金券接口
- 首页版块
- 团购
- 平台红包
- 限时折扣接口
- 拼团接口
- wap首页模板
- 杂项
- 远程上传图片
- JS
- 银联支付
- 多语言
- 商品评分
- 图片加载
- 买家申请退款退货
- 商家退款退货
- 平台退款退货
- 添加发票
- 提交订单
- 确认订单
- 运费销售区域
- 获取会员地址
- 充值
- 导出XLS
- 商城系统集成
- 多语言实现
- 三级分销推广链接发展推广员
- app.ini.php
- 去分销
- 版本更新
- 物流支持
- 运营人员建议
- 业务逻辑
- 统计结算
- 客服消息
- 账号
- 三级分销
- IM
- 配置
- 平台帐号
- 活动数据表说明