关于递归问题   js
原数据格式
```
let obj =[
        {1:'20190805',2:'1',3:'success'},
        {1:'20191120',2:'1.1',3:'success'},
        {1:'20190212',2:'1.1.1',3:'success'},
        {1:'20190212',2:'1.1.2',3:'success'},
        {1:'20190212',2:'1.1.3',3:'success'},
        {1:'20190212',2:'1.2',3:'success'},
        {1:'20190212',2:'1.2.1',3:'success'},
        {1:'20190212',2:'2',3:'success'},
        {1:'20190212',2:'2.1',3:'success'},
        {1:'20190212',2:'2.2.1',3:'success'},
        {1:'20190212',2:'2.2',3:'success'},
        {1:'20190212',2:'2.3',3:'success'},
        {1:'20190212',2:'2.3.1',3:'success'},
        ...
        ]
```
最后想要下面这种结果格式，请问该怎么实现呢
```
let data = [
        {1: '20190805', 2: '1', 3: 'success', children: [
            {1: '20191120', 2: '1.1', 3: 'success', children: [
                {1: '20190212', 2: '1.1.1', 3: 'success'},
                {1: '20190212', 2: '1.1.2', 3: 'success'},
                {1: '20190212', 2: '1.1.3', 3: 'success'},
            ]}, {1: '20191120', 2: '1.2', 3: 'success', children: [
                    {1: '20190212', 2: '1.2.1', 3: 'success'},
                ]
            }]
        },
        {1: '20190212', 2: '2', 3: 'success', children: [
            {1: '20190212', 2: '2.1', 3: 'success', children: [
                {1: '20190212', 2: '2.2.1', 3: 'success'},
            ]},
            {1: '20190212', 2: '2.2', 3: 'success'},
            {1: '20190212', 2: '2.3', 3: 'success', children: [
                {1: '20190212', 2: '2.3.1', 3: 'success'}]
            }]
        },
        ...
    ]
```
```
/**
 *
 * @param {Array} source
 * @returns {Array} 分类好的数据
 */
function mark(source) {
  var temp = {};
  source.forEach(item => {
    temp[item["2"]] = item;
  });
  source.forEach(item => {
    var key = item["2"],
      parent;
    //子级
    if (key.length > 1) {
      //子级的父 id
      key = key.slice(0, -2);
      parent = temp[key];
      if (parent) {
        parent.children = parent.children || [];
        parent.children.push(item);
      }
    }
  });
  return Object.keys(temp).reduce((ret, key) => ret.concat(key.length === 1 ? temp[key] : []), []);
}


```