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
be362d47
Commit
be362d47
authored
Jun 23, 2025
by
wangzhengwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log完善
parent
87a57a66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
PayService.php
app/api/service/PayService.php
+5
-5
ProjectService.php
app/api/service/ProjectService.php
+9
-9
No files found.
app/api/service/PayService.php
View file @
be362d47
...
...
@@ -250,7 +250,7 @@ class PayService
public
static
function
orderTimeOut
()
{
$startTime
=
time
();
Log
::
info
(
"开始执行支付超时订单检查任务"
);
Log
::
channel
(
'payment_task'
)
->
info
(
"开始执行支付超时订单检查任务"
);
try
{
$expireTime
=
$startTime
-
self
::
ORDER_TIMEOUT
;
...
...
@@ -268,7 +268,7 @@ class PayService
if
(
empty
(
$orders
))
{
$msg
=
"没有需要处理的超时订单"
;
Log
::
info
(
$msg
);
Log
::
channel
(
'payment_task'
)
->
info
(
$msg
);
return
[
'status'
=>
true
,
'code'
=>
200
,
...
...
@@ -314,12 +314,12 @@ class PayService
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
Log
::
error
(
"处理超时订单失败:
{
$order
[
'order_no'
]
}
- "
.
$e
->
getMessage
());
Log
::
channel
(
'payment_task'
)
->
error
(
"处理超时订单失败:
{
$order
[
'order_no'
]
}
- "
.
$e
->
getMessage
());
}
}
$msg
=
"支付超时订单处理完成"
;
Log
::
info
(
"
{
$msg
}
,共处理: "
.
count
(
$orders
)
.
"条,成功:
{
$successCount
}
条"
);
Log
::
channel
(
'payment_task'
)
->
info
(
"
{
$msg
}
,共处理: "
.
count
(
$orders
)
.
"条,成功:
{
$successCount
}
条"
);
return
[
'status'
=>
true
,
...
...
@@ -335,7 +335,7 @@ class PayService
}
catch
(
\Exception
$e
)
{
$errorMsg
=
"支付超时订单任务执行失败: "
.
$e
->
getMessage
();
Log
::
error
(
$errorMsg
);
Log
::
channel
(
'payment_task'
)
->
error
(
$errorMsg
);
return
[
'status'
=>
false
,
'code'
=>
500
,
...
...
app/api/service/ProjectService.php
View file @
be362d47
...
...
@@ -123,7 +123,7 @@ class ProjectService
$currentTime
=
time
();
// 记录开始日志
trace
(
'开始执行项目招募超时处理,当前时间:'
.
date
(
'Y-m-d H:i:s'
,
$currentTime
),
'project'
);
Log
::
channel
(
'project_task'
)
->
info
(
'开始执行项目招募超时处理,当前时间:'
.
date
(
'Y-m-d H:i:s'
,
$currentTime
)
);
// 查询符合条件的项目
$projects
=
Project
::
where
(
'status'
,
1
)
...
...
@@ -134,12 +134,12 @@ class ProjectService
$result
[
'data'
][
'processed_count'
]
=
$totalCount
;
// 记录查询到的项目数量
trace
(
"共找到
{
$totalCount
}
个需要处理的超时项目"
,
'project'
);
Log
::
channel
(
'project_task'
)
->
info
(
"共找到
{
$totalCount
}
个需要处理的超时项目"
);
// 如果没有符合条件的项目,直接返回
if
(
$totalCount
===
0
)
{
$result
[
'message'
]
=
'没有需要处理的超时项目'
;
trace
(
'没有需要处理的超时项目,任务结束'
,
'project
'
);
Log
::
channel
(
'project_task'
)
->
info
(
'没有需要处理的超时项目,任务结束
'
);
return
$result
;
}
...
...
@@ -155,17 +155,17 @@ class ProjectService
$successCount
++
;
// 记录单个项目处理成功日志
trace
(
"项目ID:
{
$project
->
id
}
处理成功,状态已更新为招募结束"
,
'project'
);
Log
::
channel
(
'project_task'
)
->
info
(
"项目ID:
{
$project
->
id
}
处理成功,状态已更新为招募结束"
);
// 这里可以添加其他逻辑,比如发送通知等
// $this->sendNotification($project);
}
else
{
// 记录单个项目处理失败日志
trace
(
"项目ID:
{
$project
->
id
}
处理失败,保存时出错"
,
'error'
);
Log
::
channel
(
'project_task'
)
->
info
(
"项目ID:
{
$project
->
id
}
处理失败,保存时出错"
);
}
}
catch
(
\Exception
$e
)
{
// 记录单个项目处理异常日志
trace
(
"项目ID:
{
$project
->
id
}
处理异常:"
.
$e
->
getMessage
(),
'error'
);
Log
::
channel
(
'project_task'
)
->
info
(
"项目ID:
{
$project
->
id
}
处理异常:"
.
$e
->
getMessage
()
);
}
}
...
...
@@ -175,15 +175,15 @@ class ProjectService
if
(
$successCount
<
$totalCount
)
{
$failCount
=
$totalCount
-
$successCount
;
$result
[
'message'
]
=
"处理完成,成功
{
$successCount
}
个,失败
{
$failCount
}
个"
;
trace
(
"处理完成,成功
{
$successCount
}
个,失败
{
$failCount
}
个"
,
'project'
);
Log
::
channel
(
'project_task'
)
->
info
(
"处理完成,成功
{
$successCount
}
个,失败
{
$failCount
}
个"
);
}
else
{
$result
[
'message'
]
=
"所有
{
$successCount
}
个项目处理成功"
;
trace
(
"所有
{
$successCount
}
个项目处理成功"
,
'project'
);
Log
::
channel
(
'project_task'
)
->
info
(
"所有
{
$successCount
}
个项目处理成功"
);
}
}
catch
(
\Exception
$e
)
{
// 记录全局异常
trace
(
"项目招募超时处理出现全局异常:"
.
$e
->
getMessage
(),
'error'
);
Log
::
channel
(
'project_task'
)
->
info
(
"项目招募超时处理出现全局异常:"
.
$e
->
getMessage
()
);
$result
=
[
'status'
=>
false
,
...
...
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