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
b204303f
Commit
b204303f
authored
May 23, 2025
by
wangzhengwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5.23
parent
de4c25ca
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
173 additions
and
21 deletions
+173
-21
Course.php
app/api/controller/Course.php
+1
-0
CourseProgress.php
app/api/controller/CourseProgress.php
+39
-1
Index.php
app/api/controller/manage/Index.php
+46
-10
User.php
app/api/controller/mine/User.php
+18
-2
UtilService.php
app/api/service/UtilService.php
+19
-1
Payment.php
app/model/Payment.php
+10
-0
Project.php
app/model/Project.php
+24
-7
Mail.php
app/model/project/Mail.php
+10
-0
User.php
app/model/project/User.php
+6
-0
No files found.
app/api/controller/Course.php
View file @
b204303f
...
...
@@ -105,6 +105,7 @@ class Course extends BaseController
$data
=
(
new
CourseModel
())
// ->with(['getTeacher','getSections'=>['getCourseClass'],'getCourseClass'])
->
getCouresDetail
(
$data
[
'course_id'
]);
CourseModel
::
where
(
'id'
,
$data
[
'course_id'
])
->
inc
(
'click'
)
->
update
([]);
return
$this
->
returnMsg
(
'success'
,
1
,
$data
);
...
...
app/api/controller/CourseProgress.php
View file @
b204303f
...
...
@@ -4,10 +4,13 @@ namespace app\api\controller;
use
app\api\middleware\Auth
;
use
app\api\service\UserService
;
use
app\api\service\UtilService
;
use
app\api\validate\CourseValidate
;
use
app\BaseController
;
use
think\facade\Request
;
use
app\model\Payment
;
use
think\Request
;
use
app\api\service\CourseProgressService
;
use
app\model\Course
as
CourseModel
;
class
CourseProgress
extends
BaseController
{
...
...
@@ -111,4 +114,39 @@ class CourseProgress extends BaseController
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$userWork
);
}
//视频播放
public
function
playVideo
(
Request
$request
)
{
// 参数验证
$vo
=
(
new
CourseValidate
())
->
goCheck
([
'course_id'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$courseId
=
$request
->
param
(
'course_id'
);
$userId
=
$request
->
userId
;
// 获取课程信息
$course
=
CourseModel
::
where
([
'id'
=>
$courseId
,
'status'
=>
3
,
'is_sell'
=>
1
,
'is_del'
=>
0
])
->
find
();
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
();
return
$this
->
returnMsg
(
'操作成功'
,
1
);
}
}
\ No newline at end of file
app/api/controller/manage/Index.php
View file @
b204303f
...
...
@@ -81,18 +81,54 @@ class Index extends BaseController
public
function
getProjectPendingList
(
$userId
)
{
$list
=
\app\model\Project
::
where
(
'user_id'
,
$userId
)
->
where
(
'status'
,
'in'
,[
0
,
1
,
3
])
->
field
([
'id'
,
'title'
,
'status'
,
'tag_ids'
])
// 1. 查询项目列表
$projects
=
\app\model\Project
::
where
(
'user_id'
,
$userId
)
->
where
(
'status'
,
'in'
,
[
0
,
1
,
3
])
->
field
([
'id'
,
'title'
,
'status'
,
'tag_ids'
])
->
select
();
$list
=
$list
->
map
(
function
(
$item
){
return
UtilService
::
infoWithTags
(
$item
,
\app\model\ProjectTag
::
class
,
'tag_ids'
);
});
// 2. 收集所有标签ID(去重)
$allTagIds
=
[];
foreach
(
$projects
as
$project
)
{
if
(
$project
->
tag_ids
)
{
$ids
=
explode
(
','
,
$project
->
tag_ids
);
$allTagIds
=
array_merge
(
$allTagIds
,
$ids
);
}
}
$allTagIds
=
array_unique
(
$allTagIds
);
// 3. 批量查询所有需要的标签
$tagsMap
=
[];
if
(
!
empty
(
$allTagIds
))
{
$tags
=
\app\model\ProjectTag
::
where
(
'is_del'
,
0
)
->
where
(
'id'
,
'in'
,
$allTagIds
)
->
column
(
'title'
,
'id'
);
$tagsMap
=
$tags
?:
[];
}
// 4. 组装结果
$result
=
[];
foreach
(
$projects
as
$project
)
{
$tagIds
=
$project
->
tag_ids
?
explode
(
','
,
$project
->
tag_ids
)
:
[];
$tags
=
[];
foreach
(
$tagIds
as
$tagId
)
{
if
(
isset
(
$tagsMap
[
$tagId
]))
{
$tags
[]
=
[
'id'
=>
$tagId
,
'title'
=>
$tagsMap
[
$tagId
]
];
}
}
$result
[]
=
[
'id'
=>
$project
->
id
,
'title'
=>
$project
->
title
,
'status'
=>
$project
->
status
,
'tags'
=>
$tags
];
}
return
$
lis
t
;
return
$
resul
t
;
}
}
\ No newline at end of file
app/api/controller/mine/User.php
View file @
b204303f
...
...
@@ -6,6 +6,7 @@ use app\api\middleware\Auth;
use
app\api\service\UserService
;
use
app\api\validate\UserValidate
;
use
app\BaseController
;
use
app\model\project\Mail
;
use
app\model\project\UserAccount
;
use
app\model\project\UserMoneyLog
;
use
app\model\project\UserSmrz
;
...
...
@@ -136,7 +137,7 @@ class User extends BaseController
->
count
();
if
(
$count
)
{
//
return $this->returnMsg('每天只能提现一次');
return
$this
->
returnMsg
(
'每天只能提现一次'
);
}
$UserWithdrawalModel
=
new
UserWithdrawal
();
...
...
@@ -158,12 +159,27 @@ class User extends BaseController
if
(
!
$res
[
'status'
])
{
return
$this
->
returnMsg
(
'网络错误'
);
return
$this
->
returnMsg
(
$res
[
'msg'
]
);
}
return
$this
->
returnMsg
(
'success'
,
1
);
}
//站内信
public
function
getUserMailList
(
Request
$request
)
{
$page
=
$request
->
param
(
'page/d'
,
1
);
$pageSize
=
$request
->
param
(
'pageSize/d'
,
10
);
$list
=
Mail
::
order
(
'createtime'
,
'desc'
)
->
paginate
([
'page'
=>
$page
,
'list_rows'
=>
$pageSize
]);
return
$this
->
returnMsg
(
'success'
,
1
,
$list
);
}
}
\ No newline at end of file
app/api/service/UtilService.php
View file @
b204303f
...
...
@@ -2,6 +2,7 @@
namespace
app\api\service
;
use
app\model\Payment
;
use
think\facade\Cache
;
class
UtilService
...
...
@@ -93,10 +94,27 @@ class UtilService
->
field
(
'id,title'
)
->
select
()
->
toArray
();
}
$result
=
$info
->
toArray
();
$result
[
'tags'
]
=
$tags
;
return
$result
;
}
/**
* 通用购买验证方法
* @param int $userId 用户ID
* @param int $productId 产品ID
* @param int $orderType 订单类型(1:视频 2:证书)
* @return bool
*/
public
static
function
checkPurchase
(
$userId
,
$productId
,
$orderType
)
{
return
Payment
::
where
([
'user_id'
=>
$userId
,
'order_type'
=>
$orderType
,
'pay_status'
=>
1
,
'order_id'
=>
$productId
])
->
count
()
>
0
;
}
}
\ No newline at end of file
app/model/Payment.php
0 → 100644
View file @
b204303f
<?php
namespace
app\model
;
use
think\Model
;
class
Payment
extends
Model
{
}
\ No newline at end of file
app/model/Project.php
View file @
b204303f
...
...
@@ -128,16 +128,34 @@ class Project extends Model
}
public
function
projectDetail
(
$id
,
$userId
)
//项目详情
public
function
projectDetail
(
$id
,
$userId
)
{
$where
=
[
'id'
=>
$id
];
$detail
=
self
::
where
(
$where
)
->
find
();
$project
=
self
::
find
(
$id
);
if
(
!
$project
)
{
return
[];
}
$detail
[
'is_put'
]
=
ProjectPut
::
where
([
'project_id'
=>
$id
,
'user_id'
=>
$userId
])
->
count
();
return
array_merge
(
$project
->
toArray
(),
[
'is_put'
=>
ProjectPut
::
where
([
'project_id'
=>
$id
,
'user_id'
=>
$userId
])
->
count
(),
'fileData'
=>
$this
->
getValidFiles
(
$project
->
file_id_str
)
]);
}
return
$detail
;
protected
function
getValidFiles
(
$fileIds
)
{
if
(
empty
(
$fileIds
))
{
return
[];
}
return
SystemUploadFile
::
whereIn
(
'fileid'
,
explode
(
','
,
$fileIds
))
->
where
(
'isdel'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
)
->
select
()
->
toArray
();
}
...
...
@@ -145,5 +163,4 @@ class Project extends Model
}
\ No newline at end of file
app/model/project/Mail.php
0 → 100644
View file @
b204303f
<?php
namespace
app\model\project
;
use
think\Model
;
class
Mail
extends
Model
{
}
\ No newline at end of file
app/model/project/User.php
View file @
b204303f
...
...
@@ -2,6 +2,7 @@
namespace
app\model\project
;
use
app\model\Payment
;
use
app\model\system\SystemUploadFile
;
use
think\Model
;
use
function
Symfony
\Component\Translation\t
;
...
...
@@ -93,5 +94,10 @@ class User extends Model
->
field
(
'id,title'
);
}
public
function
payments
()
{
return
$this
->
hasMany
(
Payment
::
class
);
}
}
\ No newline at end of file
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