切换导航条
此项目
正在载入...
登录
郭盛
/
enterprise
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
何书鹏
4 years ago
提交
91435b7a79a0739e2446f875604e4b80dfab4a28
2 个父辈
109efcf7
007e2a7f
1 个管道 的构建
通过
耗费 2 秒
合并分支 'heshupeng' 到 'master'
课程收藏 查看合并请求
!180
变更
2
构建
2
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
39 行增加
和
1 行删除
application/mobile/controller/Course.php
public/mobile.html
application/mobile/controller/Course.php
查看文件 @
91435b7
...
...
@@ -9,6 +9,7 @@ use app\mobile\model\CourseCatalog;
use
app\mobile\model\CourseAppraise
;
use
app\mobile\model\CourseSpec
;
use
app\mobile\model\CourseOrder
;
use
app\mobile\model\CourseCollect
;
use
app\mobile\model\Company
;
use
app\mobile\model\CompanyUser
;
use
addons\epay\library\Service
;
...
...
@@ -134,6 +135,7 @@ class Course extends Api
"video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频
},
"is_buy": 0, //是否已购买:0=否,1=是
"is_collect": 0, //是否已收藏:0=否,1=是
}
})
*/
...
...
@@ -194,6 +196,9 @@ class Course extends Api
->
field
(
'id'
)
->
find
();
$info
[
'is_buy'
]
=
!
empty
(
$order
)
?
1
:
0
;
// 是否已收藏
$collect
=
CourseCollect
::
where
(
'user_id'
,
$this
->
auth
->
id
)
->
where
(
'course_id'
,
$course_id
)
->
field
(
'id'
)
->
find
();
$info
[
'is_collect'
]
=
!
empty
(
$collect
)
?
1
:
0
;
$this
->
success
(
'成功'
,
$info
->
visible
([
'id'
,
'title'
,
...
...
@@ -203,11 +208,44 @@ class Course extends Api
'content'
])
->
append
([
'video'
,
'is_buy'
'is_buy'
,
'is_collect'
]));
}
/**
* @ApiTitle (课程详情-收藏)
* @ApiSummary (课程详情-收藏)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="course_id", type="int", required=true, description="课程ID")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599032660",
"data": null
})
*/
public
function
collect
()
{
$course_id
=
$this
->
request
->
param
(
'course_id'
);
empty
(
$course_id
)
&&
$this
->
error
(
'缺少必要参数'
);
$info
=
CourseCollect
::
get
([
'course_id'
=>
$course_id
,
'user_id'
=>
$this
->
auth
->
id
]);
if
(
!
empty
(
$info
)){
$info
->
delete
();
$this
->
success
(
'取消收藏成功'
);
}
CourseCollect
::
create
([
'course_id'
=>
$course_id
,
'user_id'
=>
$this
->
auth
->
id
,
]);
$this
->
success
(
'收藏成功'
);
}
/**
* @ApiTitle (课程详情-目录)
* @ApiSummary (课程详情-目录)
* @ApiMethod (POST)
...
...
public/mobile.html
查看文件 @
91435b7
此 diff 太大无法显示。
请
注册
或
登录
后发表评论