|
|
|
@ -403,7 +403,6 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
|
|
|
|
// 用于存储每个数组及其与目标数组的相似度
|
|
|
|
// 用于存储每个数组及其与目标数组的相似度
|
|
|
|
$similarities = [];
|
|
|
|
$similarities = [];
|
|
|
|
foreach ($combo_temp as $index => $array) {
|
|
|
|
foreach ($combo_temp as $index => $array) {
|
|
|
|
|
|
|
|
|
|
|
|
$similarity = $this->jaccard_similarity($item_ids, $array);
|
|
|
|
$similarity = $this->jaccard_similarity($item_ids, $array);
|
|
|
|
$similarities[$index] = $similarity;
|
|
|
|
$similarities[$index] = $similarity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -422,6 +421,7 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
|
|
|
|
) as b on a.combo_id=b.c_id where a.status=1 and a.combo_id in (".$ids.")");
|
|
|
|
) as b on a.combo_id=b.c_id where a.status=1 and a.combo_id in (".$ids.")");
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($combos as $key => $combo) {
|
|
|
|
foreach ($combos as $key => $combo) {
|
|
|
|
|
|
|
|
|
|
|
|
$tags = json_decode($combo->tags, true);
|
|
|
|
$tags = json_decode($combo->tags, true);
|
|
|
|
$combo->tags2 = json_decode($combo->tags2, true);
|
|
|
|
$combo->tags2 = json_decode($combo->tags2, true);
|
|
|
|
foreach ($tags as $k => $tag) {
|
|
|
|
foreach ($tags as $k => $tag) {
|
|
|
|
@ -442,8 +442,14 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
|
|
|
|
'money' => number_format($combo->price - $item_all_price,2)
|
|
|
|
'money' => number_format($combo->price - $item_all_price,2)
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$list=[];
|
|
|
|
|
|
|
|
foreach ($combos as $key => $combo) {
|
|
|
|
|
|
|
|
if($combo->recommend['xiangsidu']<>'0%'){
|
|
|
|
|
|
|
|
$list[]=$combo;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return \Yz::Return(true, "查询完成", ['combos' => $combos]);
|
|
|
|
return \Yz::Return(true, "查询完成", ['combos' => $list]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function jaccard_similarity($set1, $set2) {
|
|
|
|
function jaccard_similarity($set1, $set2) {
|
|
|
|
// 计算交集
|
|
|
|
// 计算交集
|
|
|
|
|