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
2b997b32
authored
Jun 01, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
ae18089a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
3 deletions
app/Http/Controllers/Sync/SupplierSyncController.php
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Controllers/Sync/SupplierSyncController.php
View file @
2b997b32
...
...
@@ -230,7 +230,7 @@ class SupplierSyncController extends BaseSyncController
}
Log
::
info
(
'[CRM同步]供应商已存在且不满足再次提交条件,跳过: '
.
$customerName
);
$this
->
syncResponse
(
-
1
,
'供应商已存在,跳过'
);
$this
->
syncResponse
(
0
,
'供应商已存在,跳过'
);
}
try
{
...
...
app/Http/Services/DataService.php
View file @
2b997b32
...
...
@@ -6,6 +6,7 @@ namespace App\Http\Services;
use
Carbon\Carbon
;
use
GuzzleHttp\Client
;
use
App\Model\LogModel
;
use
App\Model\SupplierLogModel
;
use
App\Model\RedisModel
;
use
App\Model\NationModel
;
use
App\Model\SkuUploadItem
;
...
...
@@ -15,19 +16,29 @@ use App\Model\IntracodeModel;
use
App\Model\DepartmentModel
;
use
GuzzleHttp\RequestOptions
;
use
App\Model\SkuUploadLogModel
;
use
App\Model\SupplierSyncModel
;
use
App\Model\SupplierApplyModel
;
use
App\Model\SupplierMemoModel
;
use
App\Model\AttachmentAuditModel
;
use
App\Model\StandardBrandModel
;
use
App\Model\SupplierExtendModel
;
use
App\Model\SupplierPayTypeModel
;
use
App\Model\SupplierAddressModel
;
use
Illuminate\Support\Facades\DB
;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierBlacklistModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierShareApplyModel
;
use
App\Model\SupplierReceiptModel
;
use
App\Model\PurchaseRemarkModel
;
use
Illuminate\Support\Facades\Log
;
use
App\Model\SupplierContractModel
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Illuminate\Support\Facades\Redis
;
use
App\Model\BigData\DataManageModel
;
use
App\Model\SupplierAttachmentsModel
;
use
App\Model\SupplierAttachmentModel
;
use
App\Model\StandardBrandMappingModel
;
use
App\Model\Purchase\PurchaseOrderModel
;
use
App\Http\Transformers\SupplierTransformer
;
...
...
@@ -2299,4 +2310,63 @@ class DataService
dump
(
"已删除
{
$count
}
个京东采购员类型的联系人"
);
}
}
public
function
clearSupplierData
(
$supplierId
)
{
$supplierId
=
(
int
)
$supplierId
;
if
(
$supplierId
<=
0
)
{
throw
new
\InvalidArgumentException
(
'supplier_id不能为空'
);
}
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
empty
(
$supplier
))
{
return
[
'supplier_id'
=>
$supplierId
,
'deleted'
=>
[],
'message'
=>
'供应商不存在'
,
];
}
$supplierCode
=
$supplier
->
supplier_code
;
$deleted
=
[];
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
&
$deleted
)
{
$deleteMap
=
[
'supplier_apply'
=>
SupplierApplyModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_attachment_audit'
=>
AttachmentAuditModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_attachments'
=>
SupplierAttachmentsModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_contact'
=>
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_contract'
=>
SupplierContractModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_extend'
=>
SupplierExtendModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_memo'
=>
SupplierMemoModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_pay_type'
=>
SupplierPayTypeModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_receipt'
=>
SupplierReceiptModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_share_apply'
=>
SupplierShareApplyModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_sync'
=>
SupplierSyncModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_address'
=>
SupplierAddressModel
::
where
(
'supplier_id'
,
$supplierId
),
'supplier_log'
=>
SupplierLogModel
::
where
(
'supplier_id'
,
$supplierId
),
'log'
=>
LogModel
::
where
(
'supplier_id'
,
$supplierId
),
'purchase_remark'
=>
PurchaseRemarkModel
::
where
(
'supplier_id'
,
$supplierId
),
];
foreach
(
$deleteMap
as
$table
=>
$query
)
{
$deleted
[
$table
]
=
$query
->
delete
();
}
$deleted
[
'supplier_channel'
]
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
delete
();
});
$deleted
[
'yunxin_account'
]
=
SupplierAccountModel
::
where
(
'supplier_id'
,
$supplierId
)
->
delete
();
$redis
=
new
RedisModel
();
$redis
->
hdel
(
'lie_supplier_info'
,
$supplierId
);
$redis
->
hdel
(
'supplier_sku_upload_ruler_v2'
,
$supplierId
);
$redis
->
del
(
'supplier_list_statistics_'
.
request
()
->
user
->
userId
);
return
[
'supplier_id'
=>
$supplierId
,
'supplier_code'
=>
$supplierCode
,
'deleted'
=>
$deleted
,
];
}
}
app/Http/routes.php
View file @
2b997b32
...
...
@@ -104,6 +104,11 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$result
=
CrmService
::
getSignCompanyList
();
$isAdmin
=
request
()
->
user
->
userId
==
1000
?
true
:
false
;
if
(
!
$isAdmin
)
{
return
response
()
->
json
([
'code'
=>
403
,
'msg'
=>
'无权限'
]);
}
$supplierId
=
(
int
)
request
()
->
get
(
'supplier_id'
);
$result
=
(
new
DataService
())
->
clearSupplierData
(
$supplierId
);
return
response
()
->
json
(
$result
);
});
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