Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projecttwo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangtao
projecttwo
Commits
ead737c0
Commit
ead737c0
authored
Jun 13, 2025
by
wangzhengwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
排序课程课时修改
parent
f3b88cfd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
76 additions
and
37 deletions
+76
-37
Course.php
app/api/controller/Course.php
+2
-2
CourseProgress.php
app/api/controller/CourseProgress.php
+40
-16
Project.php
app/api/controller/project/Project.php
+9
-1
CertCategory.php
app/model/CertCategory.php
+2
-2
Course.php
app/model/Course.php
+2
-2
CourseCategory.php
app/model/CourseCategory.php
+2
-2
CourseClassCategory.php
app/model/CourseClassCategory.php
+1
-1
ProjectCategory.php
app/model/ProjectCategory.php
+18
-11
No files found.
app/api/controller/Course.php
View file @
ead737c0
...
...
@@ -165,7 +165,7 @@ class Course extends BaseController
$query
->
where
(
'user_id'
,
$userId
);
}])
->
append
([
'tvtime_str'
])
->
order
(
'sort'
,
'
a
sc'
);
->
order
(
'sort'
,
'
de
sc'
);
}]);
},
'getCourseClass'
=>
function
(
$query
)
use
(
$userId
)
{
...
...
@@ -175,7 +175,7 @@ class Course extends BaseController
$query
->
where
(
'user_id'
,
$userId
);
}])
->
append
([
'tvtime_str'
])
->
order
(
'sort'
,
'
a
sc'
);
->
order
(
'sort'
,
'
de
sc'
);
}
])
->
where
(
'id'
,
$data
[
'course_id'
])
...
...
app/api/controller/CourseProgress.php
View file @
ead737c0
...
...
@@ -7,6 +7,7 @@ use app\api\service\UserService;
use
app\api\service\UtilService
;
use
app\api\validate\CourseValidate
;
use
app\BaseController
;
use
app\model\CourseClass
;
use
app\model\Payment
;
use
think\facade\Request
;
use
app\api\service\CourseProgressService
;
...
...
@@ -89,31 +90,51 @@ class CourseProgress extends BaseController
*/
public
function
addUserWork
()
{
$vo
=
(
new
CourseValidate
())
->
goCheck
([
'course_id'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$userId
=
$this
->
request
->
userId
;
$data
=
Request
::
only
([
'course_id'
]);
$userWork
=
CourseProgressService
::
addUserWork
(
$userId
,
$data
[
'course_id'
]);
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$userWork
);
return
$this
->
returnMsg
(
'操作成功'
,
1
);
// $vo = (new CourseValidate())->goCheck(['course_id']);
// if ($vo !== true) {
// return $vo;
// }
//
// $userId = $this->request->userId;
// $data = Request::only(['course_id']);
//
// // 获取课程信息
// $course = CourseModel::where([
// 'id' => $data['course_id'],
// 'status' => 3,
// 'is_sell' => 1,
// 'is_del' => 0
// ])->find();
//
// if (!$course) {
// return $this->returnMsg('课程不存在');
// }
//
// // 验证购买状态(1表示视频类型)
// if ($course['price'] > 0 && !UtilService::checkPurchase($userId, $data['course_id'], 1)) {
// return $this->returnMsg('课程未购买', 202);
// }
//
// $userWork = CourseProgressService::addUserWork($userId, $data['course_id']);
//
// return $this->returnMsg('操作成功',1,$userWork);
}
//视频播放
public
function
playVideo
(
Request
$request
)
{
// 参数验证
$vo
=
(
new
CourseValidate
())
->
goCheck
([
'course_id'
]);
$vo
=
(
new
CourseValidate
())
->
goCheck
([
'course_id'
,
'course_class_id'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$courseId
=
$request
->
param
(
'course_id'
);
$
userId
=
$request
->
userId
;
$courseId
=
input
(
'course_id'
);
$
class_id
=
input
(
'course_class_id'
)
;
$userId
=
$this
->
request
->
userId
??
0
;
// 获取课程信息
$course
=
CourseModel
::
where
([
'id'
=>
$courseId
,
...
...
@@ -125,14 +146,17 @@ class CourseProgress extends BaseController
if
(
!
$course
)
{
return
$this
->
returnMsg
(
'课程不存在'
);
}
// 验证购买状态(1表示视频类型)
if
(
$course
[
'price'
]
>
0
&&
!
UtilService
::
checkPurchase
(
$userId
,
$courseId
,
1
))
{
return
$this
->
returnMsg
(
'课程未购买'
,
202
);
}
// 更新
点击
量
// 更新
播放
量
CourseModel
::
where
(
'id'
,
$courseId
)
->
inc
(
'tvclick'
)
->
update
();
CourseClass
::
where
(
'id'
,
$class_id
)
->
inc
(
'tvclick'
)
->
update
();
//添加作业
CourseProgressService
::
addUserWork
(
$userId
,
$courseId
);
return
$this
->
returnMsg
(
'操作成功'
,
1
);
}
...
...
app/api/controller/project/Project.php
View file @
ead737c0
...
...
@@ -19,7 +19,15 @@ class Project extends BaseController
$data
=
$request
->
param
();
$list
=
(
new
ProjectCategory
())
->
getProjectCategoryList
(
999
,
$data
[
'is_tj'
]
??
1
);
$list
=
(
new
ProjectCategory
())
->
getProjectCategoryList
();
return
$this
->
returnMsg
(
'success'
,
1
,
$list
);
}
//推荐项目列表
public
function
getProjectCategoryTjList
(
Request
$request
)
{
$list
=
(
new
ProjectCategory
())
->
getProjectCategoryTjList
();
return
$this
->
returnMsg
(
'success'
,
1
,
$list
);
}
...
...
app/model/CertCategory.php
View file @
ead737c0
...
...
@@ -48,11 +48,11 @@ class CertCategory extends Model
$where
[]
=
[
'is_del'
,
'='
,
0
];
return
$this
->
with
([
'children'
=>
function
(
$query
)
use
(
$where
)
{
$query
->
where
(
$where
);
$query
->
order
(
'sort'
,
'
a
sc'
);
$query
->
order
(
'sort'
,
'
de
sc'
);
}])
->
where
(
'pid'
,
$pid
)
->
where
(
$where
)
->
order
(
'sort'
,
'
a
sc'
)
->
order
(
'sort'
,
'
de
sc'
)
->
select
();
}
...
...
app/model/Course.php
View file @
ead737c0
...
...
@@ -160,7 +160,7 @@ class Course extends Model
{
return
$this
->
hasMany
(
CourseClassCategory
::
class
,
'course_id'
,
'id'
)
->
where
(
'is_del'
,
0
)
->
order
(
'sort'
,
'
a
sc'
)
->
order
(
'sort'
,
'
de
sc'
)
->
field
(
'id,title,course_id'
);
}
...
...
@@ -169,7 +169,7 @@ class Course extends Model
{
return
$this
->
hasMany
(
\app\model\CourseClass
::
class
,
'course_id'
,
'id'
)
->
where
(
'is_del'
,
0
)
->
order
(
'sort'
,
'
a
sc'
);
->
order
(
'sort'
,
'
de
sc'
);
}
//封面图
...
...
app/model/CourseCategory.php
View file @
ead737c0
...
...
@@ -56,11 +56,11 @@ class CourseCategory extends Model
$where
[]
=
[
'is_del'
,
'='
,
0
];
return
$this
->
with
([
'children'
=>
function
(
$query
)
use
(
$where
)
{
$query
->
where
(
$where
);
$query
->
order
(
'sort'
,
'
a
sc'
);
$query
->
order
(
'sort'
,
'
de
sc'
);
}])
->
where
(
'pid'
,
$pid
)
->
where
(
$where
)
->
order
(
'sort'
,
'
a
sc'
)
->
order
(
'sort'
,
'
de
sc'
)
->
select
();
}
...
...
app/model/CourseClassCategory.php
View file @
ead737c0
...
...
@@ -11,7 +11,7 @@ class CourseClassCategory extends Model
{
return
$this
->
hasMany
(
\app\model\CourseClass
::
class
,
'cate_id'
,
'id'
)
->
where
(
'is_del'
,
0
)
->
order
(
'sort'
,
'
a
sc'
);
->
order
(
'sort'
,
'
de
sc'
);
// ->field('id,title,cate_id');
}
}
\ No newline at end of file
app/model/ProjectCategory.php
View file @
ead737c0
...
...
@@ -58,21 +58,28 @@ class ProjectCategory extends Model
->
field
(
'fileid,filename,filesize,fileurl,filetype,storage'
);
}
public
function
getProjectCategoryList
(
$pid
=
0
,
$is_tj
=
0
)
public
function
getProjectCategoryList
(
$pid
=
0
)
{
return
$this
->
with
([
'children'
=>
function
(
$query
)
{
$query
->
order
(
'sort'
,
'desc'
);
$query
->
with
([
'thumb'
]);
},
'thumb'
])
->
where
(
'pid'
,
$pid
)
->
order
(
'sort'
,
'desc'
)
->
select
();
}
public
function
getProjectCategoryTjList
()
{
$query
=
$this
->
with
([
'children'
=>
function
(
$query
)
{
$query
->
order
(
'sort'
,
'asc'
);
$query
->
with
([
'thumb'
]);
},
'thumb'
])
->
order
(
'sort'
,
'asc'
)
->
where
(
'is_tj'
,
$is_tj
);
if
(
$pid
!=
999
)
{
$query
->
where
(
'pid'
,
$pid
);
}
$query
->
order
(
'sort'
,
'desc'
);
$query
->
with
([
'thumb'
]);
},
'thumb'
])
->
order
(
'sort'
,
'desc'
);
$query
->
where
(
'is_tj'
,
1
);
return
$query
->
select
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment