Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Cong.Zhao
/
musician-api.hikoon.com
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
2f5c3d49
...
2f5c3d49606f6638e9befeb0292cc75763f66707
authored
2021-11-17 16:08:42 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
拆账
1 parent
6957ea96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
0 deletions
app/Helper/ErrorCode.php
app/Services/WithdrawService.php
app/Helper/ErrorCode.php
View file @
2f5c3d4
...
...
@@ -21,6 +21,8 @@ class ErrorCode
const
WITHDRAW_HANDLE_ERROR
=
40052
;
const
WITHDRAW_CONFIRM_BILLS_FAIL
=
40053
;
const
WITHDRAW_APPLY_FAIL
=
40054
;
const
WITHDRAW_FAIL
=
40055
;
...
...
@@ -42,6 +44,7 @@ class ErrorCode
self
::
WITHDRAW_HANDLE_ERROR
=>
'提现操作失败'
,
self
::
WITHDRAW_CONFIRM_BILLS_FAIL
=>
'确认账单失败'
,
self
::
WITHDRAW_APPLY_FAIL
=>
'提现申请失败'
,
self
::
WITHDRAW_FAIL
=>
'提现失败'
,
];
...
...
app/Services/WithdrawService.php
View file @
2f5c3d4
...
...
@@ -66,6 +66,40 @@ class WithdrawService extends Service implements WithdrawInterface
public
function
success
(
StakeholderIncomeSyncApp
$app
)
{
$condition
=
$this
->
compose
(
$app
);
DB
::
beginTransaction
();
try
{
//修改状态-》提现中 -> 提现完成
StakeholderIncomeSyncApp
::
query
()
->
where
([
'serial_no'
=>
$app
->
serial_no
,
'identifier'
=>
$this
->
identifier
->
identifier
,
'sync_status'
=>
1
,
'withdraw_status'
=>
2
])
->
update
([
'withdraw_status'
=>
3
]);
//修改资金账户
StakeholderBalanceByPayer
::
query
()
->
where
([
'condition'
=>
$condition
])
->
where
(
'freeze'
,
'>='
,
$app
->
total_money
)
->
update
([
'freeze'
=>
DB
::
raw
(
"freeze -
{
$app
->
total_money
}
"
),
'pay_out'
=>
DB
::
raw
(
"pay_out +
{
$app
->
total_money
}
"
),
]);
//提现申请日志
StakeholderWithdrawAppLogs
::
query
()
->
create
([
'serial_no'
=>
$app
->
serial_no
,
'identifier'
=>
$this
->
identifier
->
identifier
,
'type'
=>
__FUNCTION__
,
'withdraw_money'
=>
$app
->
total_money
,
]);
DB
::
commit
();
return
Response
::
success
();
}
catch
(
\Exception
$e
)
{
DB
::
rollBack
();
Log
::
channel
(
'api'
)
->
error
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
return
Response
::
error
(
ErrorCode
::
WITHDRAW_APPLY_FAIL
);
}
}
/**
...
...
@@ -75,6 +109,38 @@ class WithdrawService extends Service implements WithdrawInterface
public
function
fail
(
StakeholderIncomeSyncApp
$app
)
{
$condition
=
$this
->
compose
(
$app
);
DB
::
beginTransaction
();
try
{
//修改状态-》提现中 -》 已确认
StakeholderIncomeSyncApp
::
query
()
->
where
([
'serial_no'
=>
$app
->
serial_no
,
'identifier'
=>
$this
->
identifier
->
identifier
,
'sync_status'
=>
1
,
'withdraw_status'
=>
2
])
->
update
([
'withdraw_status'
=>
1
]);
//修改资金账户
StakeholderBalanceByPayer
::
query
()
->
where
([
'condition'
=>
$condition
])
->
where
(
'freeze'
,
'>='
,
$app
->
total_money
)
->
update
([
'freeze'
=>
DB
::
raw
(
"freeze -
{
$app
->
total_money
}
"
),
'balance'
=>
DB
::
raw
(
"balance +
{
$app
->
total_money
}
"
),
]);
//提现申请日志
StakeholderWithdrawAppLogs
::
query
()
->
create
([
'serial_no'
=>
$app
->
serial_no
,
'identifier'
=>
$this
->
identifier
->
identifier
,
'type'
=>
__FUNCTION__
,
'withdraw_money'
=>
$app
->
total_money
,
]);
DB
::
commit
();
return
Response
::
success
();
}
catch
(
\Exception
$e
)
{
DB
::
rollBack
();
Log
::
channel
(
'api'
)
->
error
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
return
Response
::
error
();
}
}
/**
...
...
Please
register
or
sign in
to post a comment