Commit 5f14a4d0 by mushishixian

数据处理

parent cabea6c7
Showing with 24 additions and 0 deletions
......@@ -235,6 +235,30 @@ class DataService
}
}
//初始化供应商对应的搜索标签到redis
public function initSupplierSearchTags()
{
//初始化所有正式服务器的标签情况到redis
$supplierModel = new SupplierChannelModel();
$suppliers = $supplierModel->where('is_type', 0)->get()->toArray();
$redis = new RedisModel();
foreach ($suppliers as $supplier) {
//1精选,2原厂直供,3认证,4猎芯自营,100无标签
$tagFlags = [];
//先去判断供应商性质是否为原厂,如果是的话,写入标签2
if ($supplier['supplier_group'] == 4) {
$tagFlags[] = 2;
}
if ($supplier['has_certification'] == 1) {
$tagFlags[] = 3;
}
$redis->hset('supplier_search_tags', $supplier['supplier_code'], json_encode([
'supplier_code' => $supplier['supplier_code'],
'tags' => $tagFlags,
]));
}
}
}
......
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