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
a56e3081
Commit
a56e3081
authored
Jul 03, 2025
by
wangzhengwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业验证
parent
20609579
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
0 deletions
+25
-0
PayController.php
app/api/controller/PayController.php
+6
-0
CertOrder.php
app/api/controller/cert/CertOrder.php
+6
-0
ProjectPut.php
app/api/controller/project/ProjectPut.php
+7
-0
UtilService.php
app/api/service/UtilService.php
+6
-0
No files found.
app/api/controller/PayController.php
View file @
a56e3081
...
...
@@ -4,6 +4,7 @@ namespace app\api\controller;
use
app\api\middleware\Auth
;
use
app\api\service\AlipayTradeService
;
use
app\api\service\UtilService
;
use
app\BaseController
;
use
app\model\Payment
;
use
think\facade\Log
;
...
...
@@ -24,6 +25,11 @@ class PayController
*/
public
function
create
(
$params
)
{
$userRole
=
UtilService
::
checkUserRole
(
$params
[
'user_id'
]);
if
(
$userRole
!=
1
)
{
return
json
([
'code'
=>
0
,
'msg'
=>
'企业账号不能购买'
]);
}
// 在调用 PayService::createPayment() 之前先检查是否存在有效支付记录
$existingPayment
=
Db
::
name
(
'payment'
)
...
...
app/api/controller/cert/CertOrder.php
View file @
a56e3081
...
...
@@ -35,6 +35,12 @@ class CertOrder extends BaseController
unset
(
$data
[
'pay_type'
]);
$userRole
=
UtilService
::
checkUserRole
(
$data
[
'user_id'
]);
if
(
$userRole
!=
1
)
{
return
json
([
'code'
=>
0
,
'msg'
=>
'企业账号不能报名'
]);
}
$where
=
[
'is_del'
=>
0
,
'user_id'
=>
$data
[
'user_id'
],
'cert_id'
=>
$data
[
'cert_id'
]];
$count
=
OrderModel
::
where
(
$where
)
->
count
();
if
(
$count
>
0
)
{
...
...
app/api/controller/project/ProjectPut.php
View file @
a56e3081
...
...
@@ -3,6 +3,7 @@
namespace
app\api\controller\project
;
use
app\api\middleware\Auth
;
use
app\api\service\UtilService
;
use
app\api\validate\ProjectValidate
;
use
app\BaseController
;
use
think\Request
;
...
...
@@ -28,6 +29,12 @@ class ProjectPut extends BaseController
$data
=
$request
->
only
([
'project_id'
,
'user_desc'
,
'file_id_str'
]);
$userRole
=
UtilService
::
checkUserRole
(
$request
->
userId
);
if
(
$userRole
!=
1
)
{
return
json
([
'code'
=>
0
,
'msg'
=>
'企业账号不能申请'
]);
}
$projectData
=
ProjectModel
::
where
([
'id'
=>
$data
[
'project_id'
]])
->
find
();
if
(
$projectData
[
'status'
]
!=
1
)
{
...
...
app/api/service/UtilService.php
View file @
a56e3081
...
...
@@ -5,6 +5,7 @@ namespace app\api\service;
use
app\model\CourseClass
;
use
app\model\Payment
;
use
think\facade\Cache
;
use
think\facade\Db
;
class
UtilService
{
...
...
@@ -133,4 +134,9 @@ class UtilService
'order_id'
=>
$productId
])
->
count
();
}
public
static
function
checkUserRole
(
$userId
=
0
)
{
return
Db
::
name
(
'user'
)
->
where
([
'id'
=>
$userId
])
->
value
(
'role'
);
}
}
\ 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