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
9068cece
authored
May 28, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
d9bda88f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
13 deletions
.env
app/Http/Controllers/Api/SkuApiController.php
app/Http/Services/SkuService.php
app/Http/routes.php
.env
View file @
9068cece
...
@@ -35,7 +35,7 @@ LIEXIN_DB_USERNAME=liexin
...
@@ -35,7 +35,7 @@ LIEXIN_DB_USERNAME=liexin
LIEXIN_DB_PASSWORD=liexin#zsyM
LIEXIN_DB_PASSWORD=liexin#zsyM
//自营基石数据库
//自营基石数据库
DB_SELF_HOST=192.168.1.23
5
DB_SELF_HOST=192.168.1.23
4
DB_SELF_DATABASE=liexin_data
DB_SELF_DATABASE=liexin_data
DB_SELF_USERNAME=spu
DB_SELF_USERNAME=spu
DB_SELF_PASSWORD=spu
DB_SELF_PASSWORD=spu
...
@@ -49,14 +49,14 @@ DB_PASSWORD_YUNXIN=liexin_yunxin#zsyM
...
@@ -49,14 +49,14 @@ DB_PASSWORD_YUNXIN=liexin_yunxin#zsyM
DB_YUNXIN_PORT=3306
DB_YUNXIN_PORT=3306
//联营sku数据库01
//联营sku数据库01
DB_SKU_HOST=192.168.1.23
5
DB_SKU_HOST=192.168.1.23
4
DB_SKU_DATABASE=liexin_sku_1
DB_SKU_DATABASE=liexin_sku_1
DB_SKU_USERNAME=spu
DB_SKU_USERNAME=spu
DB_SKU_PASSWORD=spu
DB_SKU_PASSWORD=spu
DB_SKU_PORT=3306
DB_SKU_PORT=3306
//联营SPU数据库
//联营SPU数据库
DB_SPU_HOST=192.168.1.23
5
DB_SPU_HOST=192.168.1.23
4
DB_SPU_DATABASE=liexin_spu
DB_SPU_DATABASE=liexin_spu
DB_SPU_USERNAME=spu
DB_SPU_USERNAME=spu
DB_SPU_PASSWORD=spu
DB_SPU_PASSWORD=spu
...
@@ -66,11 +66,11 @@ CACHE_DRIVER=file
...
@@ -66,11 +66,11 @@ CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=redis
QUEUE_DRIVER=redis
REDIS_HOST=192.168.1.23
5
REDIS_HOST=192.168.1.23
4
REDIS_PASSWORD=icDb29mLy2s
REDIS_PASSWORD=icDb29mLy2s
REDIS_PORT=6379
REDIS_PORT=6379
REDIS_USER_HOST=192.168.1.23
5
REDIS_USER_HOST=192.168.1.23
4
REDIS_USER_PASSWORD=icDb29mLy2s
REDIS_USER_PASSWORD=icDb29mLy2s
REDIS_USER_PORT=6379
REDIS_USER_PORT=6379
...
...
app/Http/Controllers/Api/SkuApiController.php
View file @
9068cece
...
@@ -70,13 +70,15 @@ class SkuApiController extends Controller
...
@@ -70,13 +70,15 @@ class SkuApiController extends Controller
// $endTime = $updateTime[1];
// $endTime = $updateTime[1];
// }
// }
$uploadLogId
=
SkuUploadLogModel
::
where
(
'supplier_code'
,
$supplierCode
)
$uploadLogId
=
SkuUploadLogModel
::
where
(
'supplier_code'
,
$supplierCode
)
->
where
(
'status'
,
SkuUploadLogModel
::
STATUS_HANDLED
)
->
value
(
'id'
);
->
where
(
'status'
,
SkuUploadLogModel
::
STATUS_HANDLED
)
->
orderBy
(
'id'
,
'desc'
)
->
value
(
'id'
);
$data
=
[
$data
=
[
'supplier_code'
=>
$supplierCode
,
'supplier_code'
=>
$supplierCode
,
'brand_id'
=>
$brandId
,
'brand_id'
=>
$brandId
,
'upload_log_id'
=>
$uploadLogId
,
'log_id'
=>
$uploadLogId
,
"down_type"
=>
1
,
];
];
//改成队列
//改成队列
(
new
SkuService
())
->
batchOffShelfSkuQueue
(
$data
);
(
new
SkuService
())
->
batchOffShelfSkuQueue
(
$data
);
...
...
app/Http/Services/SkuService.php
View file @
9068cece
...
@@ -158,11 +158,11 @@ class SkuService
...
@@ -158,11 +158,11 @@ class SkuService
config
(
'database.connections.rabbitmq.login'
),
config
(
'database.connections.rabbitmq.login'
),
config
(
'database.connections.rabbitmq.password'
));
config
(
'database.connections.rabbitmq.password'
));
$channel
=
$conn
->
channel
();
$channel
=
$conn
->
channel
();
$channel
->
queue_declare
(
'
test_batch_update_goods_status
'
,
false
,
true
,
false
,
false
);
$channel
->
queue_declare
(
'
lie_footstone_batch_downsku_queue
'
,
false
,
true
,
false
,
false
);
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
));
array
(
'content_type'
=>
'text/plain'
));
$channel
->
basic_publish
(
$msg
,
''
,
'
test_batch_update_goods_status
'
);
$channel
->
basic_publish
(
$msg
,
''
,
'
lie_footstone_batch_downsku_queue
'
);
}
}
//批量更新sku状态,走队列的
//批量更新sku状态,走队列的
...
@@ -174,6 +174,7 @@ class SkuService
...
@@ -174,6 +174,7 @@ class SkuService
//上架
//上架
$queueData
=
[];
$queueData
=
[];
if
(
$data
[
'operate_type'
]
==
self
::
OPERATE_TYPE_PUTAWAY
)
{
if
(
$data
[
'operate_type'
]
==
self
::
OPERATE_TYPE_PUTAWAY
)
{
$queueName
=
'lie_batch_upsku_queue'
;
$data
[
'cp_time'
]
=
$data
[
'is_long_term'
]
==
1
?
self
::
LONG_TERM_TIMESTAMP
:
strtotime
(
$data
[
'cp_time'
]);
$data
[
'cp_time'
]
=
$data
[
'is_long_term'
]
==
1
?
self
::
LONG_TERM_TIMESTAMP
:
strtotime
(
$data
[
'cp_time'
]);
foreach
(
$skuIds
as
$skuId
)
{
foreach
(
$skuIds
as
$skuId
)
{
$queueData
[]
=
[
$queueData
[]
=
[
...
@@ -182,10 +183,11 @@ class SkuService
...
@@ -182,10 +183,11 @@ class SkuService
];
];
}
}
}
else
{
}
else
{
$queueName
=
'lie_batch_downsku_queue'
;
$queueData
[
'down_type'
]
=
2
;
$queueData
[
'down_type'
]
=
2
;
$queueData
[
'data'
]
=
$skuIds
;
$queueData
[
'data'
]
=
$skuIds
;
}
}
QueueService
::
publishQueue
(
'test_update_goods_status'
,
$queueData
);
QueueService
::
publishQueue
(
$queueName
,
$queueData
);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
return
$exception
;
return
$exception
;
}
}
...
...
app/Http/routes.php
View file @
9068cece
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
*/
*/
use
App\Http\Services\SkuService
;
Route
::
group
([
'middleware'
=>
[
'web'
,
'menu'
]],
function
()
{
Route
::
group
([
'middleware'
=>
[
'web'
,
'menu'
]],
function
()
{
Route
::
get
(
'/'
,
'WebController@Entrance'
);
Route
::
get
(
'/'
,
'WebController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/web/{key}'
,
'WebController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/web/{key}'
,
'WebController@Entrance'
);
...
@@ -51,6 +53,11 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () {
...
@@ -51,6 +53,11 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () {
});
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$service
=
new
\App\Http\Services\DataService
();
$data
=
[
$service
->
transferPayType
(
true
);
'sku_ids'
=>
'1163833791883548099,1163833787833091377'
,
'is_long_term'
=>
-
1
,
'operate_type'
=>
1
,
'cp_time'
=>
'2022-05-31 0:0:0'
,
];
(
new
SkuService
())
->
batchUpdateSkuStatus
(
$data
);
});
});
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