tp5.1已经支持json字段查询了
tp5.0还不支持,只能使用原生查询了
搞个例子
$momo = Db::query("select switchs->'$[*]' from timer where JSON_CONTAINS(switchs->'$[*].id', '\"$id\"', '$') and
JSON_CONTAINS(switchs->'$[*].fid', '\"$fid\"', '$') and
JSON_CONTAINS(switchs->'$[*].pid', '\"$pid\"', '$')"
);