Commit 54c1cad7 by 杨树贤

修复时间以及数据

parent 5571650a
...@@ -928,19 +928,25 @@ class DataService ...@@ -928,19 +928,25 @@ class DataService
public static function initSupplierCacche() public static function initSupplierCacche()
{ {
ini_set('memory_limit', '512M'); ini_set('memory_limit', '512M');
$supplierList = SupplierChannelModel::select([ $supplierList = SupplierChannelModel::get()->toArray();
'supplier_id',
'supplier_code',
'supplier_name'
])->get()->toArray();
$redis = new RedisModel(); $redis = new RedisModel();
foreach ($supplierList as $supplier) { foreach ($supplierList as $supplier) {
$supplierId = $supplier['supplier_id']; $data = [
$supplierCode = $supplier['supplier_code']; 'supplier_id' => $supplier['supplier_id'],
$supplierName = $supplier['supplier_name']; 'supplier_code' => $supplier['supplier_code'],
Log::info('初始化供应商缓存:' . $supplierId . ' ' . $supplierCode . ' ' . $supplierName); 'supplier_name' => $supplier['supplier_name'],
'stockup_type' => $supplier['stockup_type'],
'status' => $supplier['status'],
'supplier_group' => $supplier['supplier_group'],
'channel_uid' => $supplier['channel_uid'],
'purchase_uid' => $supplier['purchase_uid'],
'is_type' => $supplier['is_type'],
'region' => $supplier['region'],
'group_code' => $supplier['group_code'],
];
// 这里可以添加具体的缓存初始化逻辑 // 这里可以添加具体的缓存初始化逻辑
$redis->hset('lie_supplier_info', $supplier['supplier_id'], json_encode($supplier)); $redis->hset('lie_supplier_info', $supplier['supplier_id'], json_encode($data));
} }
} }
} }
...@@ -436,6 +436,20 @@ class SupplierService ...@@ -436,6 +436,20 @@ class SupplierService
//什么都不需要操作 //什么都不需要操作
} }
$redis = new RedisModel();
$redis->hset('liexin_supplier_info', $supplierId, json_encode([
'supplier_id' => $supplierId,
'supplier_code' => $newSupplier['supplier_code'],
'supplier_name' => $newSupplier['supplier_name'],
'stockup_type' => $newSupplier['stockup_type'],
'status' => $newSupplier['status'],
'supplier_group' => $newSupplier['supplier_group'],
'channel_uid' => $newSupplier['channel_uid'],
'purchase_uid' => $newSupplier['purchase_uid'],
'is_type' => $newSupplier['is_type'],
'region' => $newSupplier['region'],
'group_code' => $newSupplier['group_code'],
]));
return $supplierId; return $supplierId;
} }
......
...@@ -20,7 +20,7 @@ function apiReturn($errCode = 0, $errMsg = 'ok', $data = []) ...@@ -20,7 +20,7 @@ function apiReturn($errCode = 0, $errMsg = 'ok', $data = [])
return response()->json($data, 200); return response()->json($data, 200);
} }
function curl($url, $params = false, $isPost = 0, $https = 0, $cookie = '', $timeout = 1000) function curl($url, $params = false, $isPost = 0, $https = 0, $cookie = '', $timeout = 20)
{ {
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
......
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