我有一个这样的数组
[
{
"comments_id": 1,
"comments_content":"xxxxx",
"hasreply": 0,
"reply_id": null,
"reply_content": null,
},
{
"comments_id": 2,
"comments_content":"xxxxx",
"hasreply": 1,
"reply_id": 1,
"reply_content": "xxxxxxx",
},
{
"comments_id": 2,
"comments_content":"xxxxx",
"hasreply": 1,
"reply_id": 2,
"reply_content": "xxxxxxx",
}
]
向根据相同comments_id,合并数组
[
{
"comments_id": 1,
"comments_content":"xxxxx",
"replys":[]
},
{
"comments_id": 2,
"comments_content":"xxxxx",
"replys":[
{
"reply_id",1,
"reply_content":"xxx"
},
{
"reply_id",2,
"reply_content":"xxx"
},``
]
}
]