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
bc479b92
authored
Dec 22, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
初始化
parent
845b8b88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
13 deletions
app/Http/Services/DataService.php
app/Http/Services/SupplierService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
bc479b92
...
...
@@ -3,7 +3,6 @@
namespace
App\Http\Services
;
//后台用户相关信息服务
use
Log
;
use
Carbon\Carbon
;
use
GuzzleHttp\Client
;
use
App\Model\LogModel
;
...
...
@@ -23,6 +22,7 @@ use App\Model\SupplierAddressModel;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierReceiptModel
;
use
Illuminate\Support\Facades\Log
;
use
App\Model\SupplierContractModel
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Illuminate\Support\Facades\Redis
;
...
...
@@ -877,7 +877,7 @@ class DataService
//同步供应商到erp
public
static
function
syncSupplierToErp
()
{
$supplierIds
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'group_code'
,
'!='
,
''
)
->
where
(
'create_time'
,
'>'
,
1723132800
)
$supplierIds
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'group_code'
,
'!='
,
''
)
->
where
(
'create_time'
,
'>'
,
1723132800
)
->
pluck
(
'supplier_id'
)
->
toArray
();
foreach
(
$supplierIds
as
$supplierId
)
{
(
new
SyncSupplierService
())
->
syncSupplierToErp
(
$supplierId
);
...
...
@@ -886,18 +886,18 @@ class DataService
public
static
function
repaireSkuUploadRuler
()
{
NationModel
::
where
(
'nation_id'
,
194
)
->
update
([
'international_code'
=>
'HK'
,
]);
NationModel
::
where
(
'nation_id'
,
194
)
->
update
([
'international_code'
=>
'HK'
,
]);
NationModel
::
where
(
'nation_id'
,
195
)
->
update
([
'international_code'
=>
'TW'
,
]);
NationModel
::
where
(
'nation_id'
,
195
)
->
update
([
'international_code'
=>
'TW'
,
]);
}
public
static
function
updateGroupCode
()
{
SupplierChannelModel
::
where
(
'supplier_code'
,
'L0005670'
)
->
update
([
'group_code'
=>
'G003815'
]);
SupplierChannelModel
::
where
(
'supplier_code'
,
'L0005670'
)
->
update
([
'group_code'
=>
'G003815'
]);
}
...
...
@@ -912,7 +912,7 @@ class DataService
$supplierId
=
$supplier
->
supplier_id
;
$supplierCode
=
$supplier
->
supplier_code
;
//重新初始化供应商的有效时间
(
new
SupplierService
())
->
initialCpTimeDays
(
$supplierId
,
$supplierCode
);
(
new
SupplierService
())
->
initialCpTimeDays
(
$supplierId
,
$supplierCode
);
\dump
(
'重新初始化供应商有效时间:'
.
$supplierId
.
' '
.
$supplierCode
);
}
}
...
...
@@ -923,4 +923,24 @@ class DataService
DB
::
connection
(
'liexin'
)
->
table
(
'user_oauth'
)
->
update
([
'sales_id'
=>
''
]);
Log
::
info
(
'已将所有用户oauth的sales_id重置为0'
);
}
//供应商
public
static
function
initSupplierCacche
()
{
ini_set
(
'memory_limit'
,
'512M'
);
$supplierList
=
SupplierChannelModel
::
select
([
'supplier_id'
,
'supplier_code'
,
'supplier_name'
])
->
get
()
->
toArray
();
$redis
=
new
RedisModel
();
foreach
(
$supplierList
as
$supplier
)
{
$supplierId
=
$supplier
[
'supplier_id'
];
$supplierCode
=
$supplier
[
'supplier_code'
];
$supplierName
=
$supplier
[
'supplier_name'
];
Log
::
info
(
'初始化供应商缓存:'
.
$supplierId
.
' '
.
$supplierCode
.
' '
.
$supplierName
);
// 这里可以添加具体的缓存初始化逻辑
$redis
->
hset
(
'lie_supplier_info'
,
$supplier
[
'supplier_id'
],
json_encode
(
$supplier
));
}
}
}
app/Http/Services/SupplierService.php
View file @
bc479b92
...
...
@@ -435,6 +435,8 @@ class SupplierService
if
(
$isAudit
&&
array_get
(
$oldSupplier
,
'status'
)
==
SupplierChannelModel
::
STATUS_PASSED
&&
!
$needAudit
&&
!
empty
(
$channel
[
'supplier_id'
]))
{
//什么都不需要操作
}
$redis
->
hset
(
'liexin_supplier_info'
,
$supplierId
,
json_encode
(
$newSupplier
));
return
$supplierId
;
}
...
...
@@ -512,12 +514,12 @@ class SupplierService
$cpTimeDay
=
7
;
$futuresCpTimeDay
=
30
;
}
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'cp_time_day'
=>
$cpTimeDay
,
'futures_cp_time_day'
=>
$futuresCpTimeDay
,
]);
$redis
=
new
RedisModel
();
$ruler
=
$redis
->
hget
(
'supplier_sku_upload_ruler_v2'
,
$supplierId
);
if
(
$ruler
)
{
...
...
app/Http/routes.php
View file @
bc479b92
...
...
@@ -96,7 +96,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
DataService
::
init
UserOauthSalesId
();
DataService
::
init
SupplierCacche
();
// DataService::initSupplierReceiptNationId();
// SupplierAccountService::initYunxinAccountName();
// DataService::syncSupplierToErp();
...
...
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