Commit 5f2b7ba8 by 杨树贤

Merge branch 'ysx-spu的redis拆库-20230705'

parents 5d05f55b 33ea4d43
...@@ -99,6 +99,9 @@ REDIS_READ_HOST=redis.liexindev.me ...@@ -99,6 +99,9 @@ REDIS_READ_HOST=redis.liexindev.me
REDIS_READ_PASSWORD=icDb29mLy2s REDIS_READ_PASSWORD=icDb29mLy2s
REDIS_READ_PORT=6379 REDIS_READ_PORT=6379
REDIS_SPU_HOST=192.168.1.234
REDIS_SPU_PASSWORD=icDb29mLy1s
REDIS_SPU_PORT=6379
RABBITMQ_HOST=192.168.1.252 RABBITMQ_HOST=192.168.1.252
RABBITMQ_PORT=5672 RABBITMQ_PORT=5672
......
...@@ -12,6 +12,7 @@ use App\Model\SupplierChannelModel; ...@@ -12,6 +12,7 @@ use App\Model\SupplierChannelModel;
use App\Model\TagsModel; use App\Model\TagsModel;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use PhpAmqpLib\Connection\AMQPStreamConnection; use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage; use PhpAmqpLib\Message\AMQPMessage;
...@@ -38,6 +39,7 @@ class SkuService ...@@ -38,6 +39,7 @@ class SkuService
if (isset($data['error_code']) && $data['error_code'] == 0) { if (isset($data['error_code']) && $data['error_code'] == 0) {
$redis = new RedisModel; $redis = new RedisModel;
//处理供应商 //处理供应商
$spuRedis = Redis::connection('spu');
foreach ($data['data']['goods_id'] as $k => $goodsId) { foreach ($data['data']['goods_id'] as $k => $goodsId) {
$uploadItemService = new SkuUploadItemService(); $uploadItemService = new SkuUploadItemService();
$auditData = $uploadItemService->getSkuAuditData($data['data']['goods_id']); $auditData = $uploadItemService->getSkuAuditData($data['data']['goods_id']);
...@@ -60,7 +62,7 @@ class SkuService ...@@ -60,7 +62,7 @@ class SkuService
} }
//添加sku是否过期 //添加sku是否过期
$sku['is_expire'] = $data['data']['status'][$goodsId] && $data['data']['status'][$goodsId] > 0 ? 0 : 1; $sku['is_expire'] = $data['data']['status'][$goodsId] && $data['data']['status'][$goodsId] > 0 ? 0 : 1;
$spu = json_decode($redis->hget('spu', $sku['spu_id']), true); $spu = json_decode($spuRedis->hget('spu', $sku['spu_id']), true);
//型号处理 //型号处理
if (empty($sku['goods_name']) && !empty($spu)) { if (empty($sku['goods_name']) && !empty($spu)) {
$sku['goods_name'] = $spu['spu_name']; $sku['goods_name'] = $spu['spu_name'];
......
...@@ -426,6 +426,13 @@ return [ ...@@ -426,6 +426,13 @@ return [
'port' => env('REDIS_USER_PORT', 6379), 'port' => env('REDIS_USER_PORT', 6379),
'database' => 0, 'database' => 0,
'read_write_timeout' => 0,//new 'read_write_timeout' => 0,//new
],
'spu' => [
'host' => env('REDIS_SPU_HOST', ''),
'password' => env('REDIS_SPU_PASSWORD', null),
'port' => env('REDIS_SPU_PORT', 6379),
'database' => 0,
'read_write_timeout' => 0,//new
] ]
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment