处理 推荐套餐bug

wenjuan
yanzai 1 year ago
parent f0ef4c0ac7
commit 746b753c76

@ -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) {
// 计算交集 // 计算交集

@ -261,7 +261,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="botm_blank_wrapper" style="font-size: 18rpx;color: #ccc;">10061457</view> <view class="botm_blank_wrapper" style="font-size: 18rpx;color: #ccc;">10080726</view>
</view> </view>
</view> </view>
</template> </template>

@ -64,8 +64,10 @@ const getComboRecommend = async () => {
}); });
$response(response, () => { $response(response, () => {
recommendPackageList.value = response.data.combos; recommendPackageList.value = response.data.combos;
if (recommendPackageList.value.length) { if (recommendPackageList.value.length>0) {
popup.value.open("center"); popup.value.open("center");
}else{
toDetails();
} }
uni.hideLoading(); uni.hideLoading();
}); });

Loading…
Cancel
Save