foreach($conn->query('SELECT * from ly_product') as $result) {
$type = $result['id'];
$type_name = $result['title'];
$new = getApiData($result['flag']);
//获取当前类型的价格
$current_price = $new['last'];
$arr = $conn->query("SELECT A.*,B.tel
FROM ly_warning A
LEFT JOIN ly_member B ON A.uid = B.id
WHERE A.low_point <= {$current_price}
AND A.height_point >= {$current_price}
AND B.service_end_time >= unix_timestamp(now())
AND B.balance > 0
AND A.product_id = {$type}
AND A.status = 1"
);
if($arr){
foreach($arr as $row) {
//业务处理
}
}
}
sleep(10);
}