切换导航条
此项目
正在载入...
登录
何书鹏
/
anttest
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
何书鹏
4 years ago
提交
abb7a590e0bd132d8a33d3cb28b7036b5379f1ac
1 个父辈
bd852cb0
优惠券接口
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
75 行增加
和
3 行删除
application/api/controller/Coupons.php
public/api.html
application/api/controller/Coupons.php
查看文件 @
abb7a59
<?php
namespace
addons\shopro\controller
;
namespace
app\api\controller
;
/**
* 优惠券接口
*/
class
Coupons
extends
Base
{
protected
$noNeedLogin
=
[
'lists'
,
'detail'
,
'goods'
];
protected
$noNeedRight
=
[
'*'
];
// 领券中心,自己的优惠券
/**
* @ApiWeigh (99)
* @ApiTitle (领券中心,自己的优惠券)
* @ApiSummary (领券中心,自己的优惠券)
* @ApiMethod (GET)
*
* @ApiHeaders (name=token, type=string, required=false, description="请求的token")
* @ApiParams (name=type, type=inter, required=true, description="类型:0=领券中心,1=待使用,2=已使用,3=已失效")
*
* @ApiReturn({
"code": 1,
"msg": "优惠券中心",
"time": "1607909742",
"data": [{
"id": 1, //优惠券ID
"name": "满100减10", //优惠券名称
"type": "cash",
"goods_ids": "0",
"amount": "10.00", //减免金额
"enough": "100.00", //使用门槛
"stock": 0, //剩余券数量
"limit": 1, //每人限领
"gettime": {
"start": 1607875200,
"end": 1610640000
},
"usetime": { //有效期
"start": 1608220800, //开始时间
"end": 1611936000 //结束时间
},
"description": "满100减10", //优惠券描述
"usetimestart": 1608220800,
"usetimeend": 1611936000,
"gettimestart": 1607875200,
"gettimeend": 1610640000
}]
})
*/
public
function
index
()
{
$type
=
$this
->
request
->
get
(
'type'
);
$this
->
success
(
'优惠券中心'
,
\addons\shopro\model\Coupons
::
getCouponsList
(
$type
));
}
/**
* @ApiInternal
* 优惠券列表
*/
public
function
lists
()
{
$ids
=
$this
->
request
->
get
(
'ids'
);
...
...
@@ -23,12 +66,37 @@ class Coupons extends Base
}
/**
* @ApiWeigh (97)
* @ApiTitle (领取优惠券)
* @ApiSummary (领取优惠券)
* @ApiMethod (GET)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的token")
* @ApiParams (name=id, type=inter, required=true, description="优惠券ID")
*
* @ApiReturn({
"code": 1,
"msg": "领取成功",
"time": "1607911049",
"data": {
"user_id": 1, //用户ID
"coupons_id": "2", //优惠券ID
"createtime": 1607911050, //领取时间戳
"id": "1" //领取ID
}
})
*/
public
function
get
()
{
$id
=
$this
->
request
->
get
(
'id'
);
$this
->
success
(
'领取成功'
,
\addons\shopro\model\Coupons
::
getCoupon
(
$id
));
}
/**
* @ApiInternal
* 优惠券详情
*/
public
function
detail
()
{
$id
=
$this
->
request
->
get
(
'id'
);
...
...
@@ -38,6 +106,10 @@ class Coupons extends Base
$this
->
success
(
'优惠券详情'
,
$detail
);
}
/**
* @ApiInternal
* 优惠券详情
*/
public
function
goods
()
{
$id
=
$this
->
request
->
get
(
'id'
);
...
...
public/api.html
查看文件 @
abb7a59
此 diff 太大无法显示。
请
注册
或
登录
后发表评论