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
c3e4b737
authored
Mar 28, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
日志同步
parent
4909d17f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
10 deletions
app/Http/Services/LogService.php
app/Http/Services/SyncSupplierService.php
app/Http/Transformers/LogTransformer.php
app/Http/routes.php
app/Http/Services/LogService.php
View file @
c3e4b737
...
...
@@ -120,9 +120,9 @@ class LogService
$filter
=
new
LogFilter
();
$query
=
$filter
->
defaultFilter
(
$query
);
if
(
$type
)
{
$logs
=
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
$type
)
->
limit
(
$limit
)
->
get
();
$logs
=
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
$type
)
->
limit
(
$limit
)
->
get
()
->
toArray
()
;
}
else
{
$logs
=
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
limit
(
$limit
)
->
get
();
$logs
=
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
limit
(
$limit
)
->
get
()
->
toArray
()
;
}
$transformer
=
new
LogTransformer
();
$logs
=
$transformer
->
transformList
(
$logs
);
...
...
app/Http/Services/SyncSupplierService.php
View file @
c3e4b737
...
...
@@ -103,6 +103,20 @@ class SyncSupplierService
}
}
//审核流程
$updateLogs
=
(
new
LogService
())
->
getLogs
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
);
$reviewProcess
=
[];
if
(
$updateLogs
)
{
foreach
(
$updateLogs
as
$log
)
{
$content
=
is_array
(
$log
[
'content'
])
&&
!
empty
(
$log
[
'content'
])
?
$log
[
'content'
][
0
]
:
$log
[
'content'
];
$reviewProcess
[]
=
[
'operator'
=>
$log
[
'admin_name'
],
'operateDate'
=>
$log
[
'add_time'
],
'operate'
=>
$content
,
];
}
}
$message
[
'reviewProcess'
]
=
$reviewProcess
;
if
(
$conn
)
{
}
else
{
...
...
app/Http/Transformers/LogTransformer.php
View file @
c3e4b737
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Transformers;
use
App\Http\Services\LogService
;
use
App\Model\SupplierReceiptModel
;
class
LogTransformer
{
...
...
@@ -41,7 +42,20 @@ class LogTransformer
$oldReceipt
=
json_decode
(
$item
[
'remark'
],
true
);
//新增
if
(
empty
(
$oldReceipt
[
'receipt_id'
]))
{
$item
[
'content'
]
.=
' : '
.
"银行名称 :
{
$oldReceipt
[
'bank_name'
]
}
| 账户号码 :
{
$oldReceipt
[
'account_no'
]
}
"
;
$type
=
array_get
(
$oldReceipt
,
'receipt_type'
,
1
);
$type
=
$type
==
1
?
"大陆"
:
"香港以及国外"
;
$swiftCodeText
=
(
$type
==
'香港以及国外'
)
?
' | 国际代码 : '
.
array_get
(
$oldReceipt
,
'swift_code'
)
:
''
;
$item
[
'content'
]
.=
' : '
.
"银行所在地 :
{
$type
}
| 银行名称 :
{
$oldReceipt
[
'bank_name'
]
}
| 账户号码 :
{
$oldReceipt
[
'account_no'
]
}
| 银行地址 :
{
$oldReceipt
[
'account_adderss'
]
}
"
.
$swiftCodeText
;
}
else
{
$newReceipt
=
SupplierReceiptModel
::
where
(
'receipt_id'
,
$oldReceipt
[
'receipt_id'
])
->
first
();
if
(
!
empty
(
$newReceipt
))
{
$newReceipt
=
$newReceipt
->
toArray
();
$type
=
array_get
(
$newReceipt
,
'receipt_type'
,
1
);
$type
=
$type
==
1
?
"大陆"
:
"香港以及国外"
;
$swiftCodeText
=
(
$type
==
'香港以及国外'
)
?
' | 国际代码 : '
.
array_get
(
$newReceipt
,
'swift_code'
)
:
''
;
$item
[
'content'
]
.=
' : '
.
"银行所在地 :
{
$type
}
| 银行名称 :
{
$newReceipt
[
'bank_name'
]
}
| 账户号码 :
{
$newReceipt
[
'account_no'
]
}
| 银行地址 :
{
$newReceipt
[
'account_adderss'
]
}
"
.
$swiftCodeText
;
}
}
}
...
...
@@ -63,11 +77,11 @@ class LogTransformer
if
(
empty
(
$oldReceipt
[
'receipt_id'
]))
{
//新增日志
$content
=
"银行名称 :
{
$oldReceipt
[
'bank_name'
]
}
| 账户号码 :
{
$oldReceipt
[
'account_no'
]
}
"
;
}
else
{
}
else
{
if
(
$receipt
)
{
//修改日志
}
else
{
}
else
{
//删除日志
}
}
...
...
app/Http/routes.php
View file @
c3e4b737
...
...
@@ -82,9 +82,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
//(new \App\Http\Services\StatisticsSkuUploadService())->statisticBrandSkuNum();
//(new \App\Http\Services\DataService())->exportSupplierDataForLevel();
\App\Model\SupplierChannelModel
::
where
(
'supplier_code'
,
'L0016240'
)
->
update
([
'supplier_name'
=>
'RUID (HONG KONG) ELECTRONICS CO., LIMITED'
]);
(
new
\App\Http\Services\SyncSupplierService
())
->
syncSupplierToErp
(
12469
);
});
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