Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
e14afb75
Commit
e14afb75
authored
Apr 22, 2022
by
hangjun83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
如果拆分后的总价存在小数并且相减小于1,提示。
parent
4a0d1355
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
server/app/Jobs/BhSorderRefundJob.php
server/app/Jobs/BhSorderRefundJob.php
+8
-1
server/app/Services/BhOrdersService.php
server/app/Services/BhOrdersService.php
+9
-2
No files found.
server/app/Jobs/BhSorderRefundJob.php
View file @
e14afb75
...
...
@@ -34,15 +34,22 @@ class BhSorderRefundJob extends Job
app
(
BhSorderRefundRepository
::
class
)
->
update
([
'status'
=>
'running'
],
$this
->
refundInfo
[
'id'
]);
$note
=
null
;
$refundInfo
=
json_decode
(
$this
->
refundInfo
[
'exec_content'
]);
$service
=
app
(
BhOrdersService
::
class
);
$service
->
sOrderRefund
(
$refundInfo
);
$service
->
sOrderRefund
(
$refundInfo
,
$note
);
//对任务进行更新
$update
=
[];
$update
[
'status'
]
=
'finish'
;
$update
[
'exec_nums'
]
=
$this
->
refundInfo
[
'exec_nums'
]
+
1
;
$update
[
'error_message'
]
=
''
;
if
(
$note
&&
count
(
$note
)
>
0
){
$update
[
'error_message'
]
=
json_encode
(
$note
,
JSON_UNESCAPED_UNICODE
);
}
}
catch
(
\Exception
$e
){
//对任务进行更新
$update
=
[];
...
...
server/app/Services/BhOrdersService.php
View file @
e14afb75
...
...
@@ -222,13 +222,12 @@ class BhOrdersService
* 处理退货逻辑
* @param $refundInfo
*/
public
function
sOrderRefund
(
$refundInfo
)
public
function
sOrderRefund
(
$refundInfo
,
&
$note
)
{
$sOrder
=
app
(
BhSordersRepository
::
class
)
->
getSorderItemsFromOrderNo
(
$refundInfo
->
order_no
);
if
(
!
$sOrder
){
throw
new
\LogicException
(
'该订单号不存在!'
,
500
);
}
try
{
$dbConnect
=
DB
::
connection
(
'bh_mysql'
);
...
...
@@ -264,6 +263,9 @@ class BhOrdersService
$service
=
app
(
BhSoitemsRepository
::
class
);
$soItem
=
$service
->
findWhere
([
'si_id'
=>
$orderitem
[
'si_id'
],
'si_if_cancel'
=>
0
]);
$soItem
=
current
(
$soItem
->
toArray
());
if
(
empty
(
$soItem
)
||
count
(
$soItem
)
==
0
)
{
throw
new
\LogicException
(
'购买项数据id:'
.
$orderitem
[
'si_id'
]
.
'数据不存在或已取消!'
,
500
);
}
//更新原本数据
$updateArr
=
[];
...
...
@@ -287,6 +289,11 @@ class BhOrdersService
$service
->
update
(
$updateArr
,
$soItem
[
'si_id'
]);
//判断是否能除尽
if
(
$updateArr
[
'si_amount'
]
!=
$currentAmount
&&
abs
(
bcsub
(
$currentAmount
-
$updateArr
[
'si_amount'
]))
<
1
){
$note
[]
=
$soItem
[
'si_id'
]
.
'金额有小数'
;
}
// 如果数量等于0,更新原有的数据,不重新生成新的
$updatedItem
=
[];
if
(
$num
==
0
){
...
...
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