利用sql将查询符合条件的id直接以","拼接为一个字符串返回:

SELECT GROUP_CONCAT(a.id SEPARATOR ',') FROM (select * FROM store_product where is_del = 1) as a