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
71d25a23
authored
Aug 24, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
推送任务方法
parent
bc7d0c37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletions
app/Http/Services/DataService.php
app/Http/Services/DataService.php
View file @
71d25a23
...
@@ -16,6 +16,8 @@ use GuzzleHttp\RequestOptions;
...
@@ -16,6 +16,8 @@ use GuzzleHttp\RequestOptions;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Redis
;
use
Illuminate\Support\Facades\Redis
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Maatwebsite\Excel\Facades\Excel
;
use
PhpAmqpLib\Connection\AMQPStreamConnection
;
use
PhpAmqpLib\Message\AMQPMessage
;
//这个服务是处理数据的,比如导出信息,或者临时修复数据,所以代码会比较多
//这个服务是处理数据的,比如导出信息,或者临时修复数据,所以代码会比较多
class
DataService
class
DataService
...
@@ -201,7 +203,7 @@ class DataService
...
@@ -201,7 +203,7 @@ class DataService
'status'
=>
$supplierModel
::
STATUS_BLOCK
,
'status'
=>
$supplierModel
::
STATUS_BLOCK
,
'is_type'
=>
0
,
'is_type'
=>
0
,
'create_name'
=>
'admin'
,
'create_name'
=>
'admin'
,
'block_reason'
=>
'系统拉黑'
,
'block_reason'
=>
'系统拉黑'
,
];
];
$supplierId
=
$supplierModel
->
insertGetId
(
$insertData
);
$supplierId
=
$supplierModel
->
insertGetId
(
$insertData
);
$supplierService
=
new
SupplierService
();
$supplierService
=
new
SupplierService
();
...
@@ -260,6 +262,32 @@ class DataService
...
@@ -260,6 +262,32 @@ class DataService
}
}
}
}
//推送更新供应商的队列
public
function
pushSupplierSKu
()
{
$supplierModel
=
new
SupplierChannelModel
();
$suppliers
=
$supplierModel
->
where
(
'is_type'
,
0
)
->
limit
(
10
)
->
get
()
->
toArray
();
$redis
=
new
RedisModel
();
foreach
(
$suppliers
as
$supplier
)
{
$supplierTag
=
$redis
->
hget
(
'supplier_search_tags'
,
$supplier
[
'supplier_code'
]);
if
(
!
$supplierTag
)
{
continue
;
}
$message
=
json_encode
([
'supplier_code'
=>
$supplier
[
'supplier_code'
],
]);
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq.host'
),
config
(
'database.connections.rabbitmq.port'
),
config
(
'database.connections.rabbitmq.login'
),
config
(
'database.connections.rabbitmq.password'
));
$channel
=
$conn
->
channel
();
$channel
->
queue_declare
(
'supplier_zhuanmai_update'
,
false
,
true
,
false
,
false
);
$msg
=
new
AMQPMessage
(
$message
,
array
(
'content_type'
=>
'text/plain'
));
$result
=
$channel
->
basic_publish
(
$msg
,
''
,
'supplier_zhuanmai_update'
);
}
}
}
}
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