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
47ff92ec
authored
Jun 22, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
回写接口
parent
ff3e58b8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
12 deletions
app/Http/Controllers/Sync/BaseSyncController.php
app/Http/Controllers/Sync/SupplierSyncController.php
app/Http/Services/SyncSupplierService.php
app/Http/Controllers/Sync/BaseSyncController.php
0 → 100644
View file @
47ff92ec
<?php
namespace
App\Http\Controllers\Sync
;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SyncSupplierService
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Validator
;
//提供外部系统的接口
class
BaseSyncController
extends
Controller
{
public
function
syncResponse
(
$code
=
0
,
$msg
=
'成功'
,
$data
=
''
,
$count
=
0
)
{
echo
json_encode
([
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
,
]);
exit
();
}
}
app/Http/Controllers/Sync/SupplierSyncController.php
View file @
47ff92ec
<?php
namespace
App\Http\Controllers\
Api
;
namespace
App\Http\Controllers\
Sync
;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SyncSupplierService
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Validator
;
//提供外部系统的接口
class
SupplierSyncController
extends
Controller
class
SupplierSyncController
extends
BaseSync
Controller
{
public
function
syncUniteResult
(
Request
$request
)
{
$resultData
=
$request
->
only
([
'group_code'
,
'source_sn'
,
'company_name'
,
'init_nature'
,
'company_nature'
,
]);
$resultData
=
$request
->
only
([
'group_code'
,
'source_sn'
,
'company_name'
,
'init_nature'
,
'company_nature'
,
]);
$rules
=
[
"group_code"
=>
"required"
,
"source_sn"
=>
"required"
,
"company_name"
=>
"required"
,
"init_nature"
=>
'required'
,
"company_nature"
=>
"required"
,
];
$validator
=
Validator
::
make
(
$rules
,
$rules
);
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
$error
=
$validator
->
errors
()
->
first
();
$this
->
syncResponse
(
-
1
,
$error
);
}
$result
=
(
new
SyncSupplierService
())
->
syncSupplierToUnitedResult
(
$resultData
);
$this
->
syncResponse
(
0
,
'同步一体化信息成功'
);
}
}
app/Http/Services/SyncSupplierService.php
View file @
47ff92ec
...
...
@@ -151,12 +151,11 @@ class SyncSupplierService
$groupCode
=
array_get
(
$syncResult
,
'group_code'
);
$sourceSn
=
array_get
(
$syncResult
,
'source_sn'
);
$supplierId
=
$sourceSn
;
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
return
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'sync_united_status'
=>
SupplierChannelModel
::
SYNC_UNITED_STATUS_OK
,
'group_code'
=>
$groupCode
,
'company_nature'
=>
$syncResult
[
'company_nature'
],
]);
}
}
\ No newline at end of file
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