Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7b195abd
authored
Jun 16, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
校验审核银行信息
parent
95413a20
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
app/Http/Controllers/Api/SupplierReceiptApiController.php
app/Http/Validators/ReceiptValidator.php
app/Http/Controllers/Api/SupplierReceiptApiController.php
View file @
7b195abd
...
...
@@ -64,23 +64,27 @@ class SupplierReceiptApiController extends Controller
$supplierId
=
$request
->
get
(
'supplier_id'
);
$model
=
new
SupplierReceiptModel
();
if
(
!
empty
(
$receiptId
))
{
$oldReceipt
=
$model
->
where
(
'receipt_id'
,
$receiptId
)
->
first
()
->
toArray
();
$result
=
$model
->
where
(
'receipt_id'
,
$receiptId
)
->
update
(
$receipt
);
}
else
{
$oldReceipt
=
[];
$receipt
[
'supplier_id'
]
=
$supplierId
;
$result
=
$model
->
insert
(
$receipt
);
$result
=
$model
->
insertGetId
(
$receipt
);
$receiptId
=
$result
;
}
if
(
$result
)
{
$supplierModel
=
new
SupplierChannelModel
();
$supplierStatus
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'status'
);
//不等于-1的时候是第一次新增供应商,单独银行信息,不需要修改状态
if
(
$supplierStatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
//供应商变成待审核
$newReceipt
=
$model
->
where
(
'receipt_id'
,
$receiptId
)
->
first
()
->
toArray
();
//如果修改的只是备注,则不需要转成审核
$needAudit
=
$this
->
checkNeedAudit
(
$oldReceipt
,
$newReceipt
);
if
(
$needAudit
||
empty
(
$request
->
get
(
'receipt_id'
)))
{
$supplierModel
=
new
SupplierChannelModel
();
//修改供应商为审核状态
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
}
$logService
=
new
LogService
();
$content
=
!
empty
(
$receipt
[
'receipt_id'
])
?
'修改银行信息'
:
'添加银行信息'
;
$remark
=
json_encode
(
$receipt
);
...
...
@@ -90,6 +94,24 @@ class SupplierReceiptApiController extends Controller
$this
->
response
(
-
1
,
'操作失败'
);
}
//判断是否要进入待审核状态,因为部分字段修改是不需要走审核的
private
function
checkNeedAudit
(
$oldReceipt
,
$newReceipt
)
{
$notNeedAuditField
=
[
'remark'
,
];
$diff
=
array_diff
(
$oldReceipt
,
$newReceipt
);
unset
(
$diff
[
'update_time'
]);
$changeField
=
array_keys
(
$diff
);
foreach
(
$changeField
as
$filed
)
{
//只要有一个不存在于不需要审核的字段,就返回需要审核
if
(
!
in_array
(
$filed
,
$notNeedAuditField
))
{
return
true
;
}
}
return
false
;
}
//删除
public
function
DeleteSupplierReceipt
(
$request
)
{
...
...
app/Http/Validators/ReceiptValidator.php
View file @
7b195abd
...
...
@@ -22,7 +22,6 @@ class ReceiptValidator
// "account_name" => "required",
"certificate"
=>
"required"
,
];
$receipt
[
'certificate'
]
=
'111'
;
if
(
$receipt
[
'receipt_type'
]
==
2
)
{
$rules
[
"swift_code"
]
=
'required'
;
}
...
...
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