Merge branch 'zj' of pplokijuhyg/blog-server into master
This commit is contained in:
		
						commit
						f1329f47f7
					
				@ -10,34 +10,69 @@ var groupfind = async (ctx, next) => {
 | 
			
		||||
    let group = []
 | 
			
		||||
    await dbs.find("group").then((res) => {
 | 
			
		||||
        // console.log(res)
 | 
			
		||||
        for (let i in res.data) {
 | 
			
		||||
        // for (let i in res.data) {
 | 
			
		||||
            // if (parseInt(res.data[i].fuid) == 0) {
 | 
			
		||||
            //     // console.log(res.data[i])
 | 
			
		||||
            //     group.push({ name: res.data[i].groupname, num_key: res.data[i].num_key, child: [] })
 | 
			
		||||
            // }
 | 
			
		||||
        //     // console.log(res.data[i].num_key,res.data[i].fuid)
 | 
			
		||||
 | 
			
		||||
        // }
 | 
			
		||||
        // for (let m in res.data) {
 | 
			
		||||
        //     console.log(res.data[m].num_key, parseInt(res.data[m].fuid))
 | 
			
		||||
        //     // console.log(1111)
 | 
			
		||||
        //     if (res.data[m].num_key == parseInt(res.data[m].fuid)){
 | 
			
		||||
        //         for (let n in group) {
 | 
			
		||||
        //             if (group[n].num_key == parseInt(res.data[m].fuid)) {
 | 
			
		||||
        //                 group[n].child.push({ name: res.data[m].groupname, num_key: res.data[m].num_key, child: [] })
 | 
			
		||||
        //             }
 | 
			
		||||
        //         }
 | 
			
		||||
 | 
			
		||||
        //     }
 | 
			
		||||
        //     for (let n in group) {
 | 
			
		||||
        //         if (group[n].num_key == parseInt(res.data[m].fuid)) {
 | 
			
		||||
        //             group[n].child.push({ name: res.data[m].groupname, num_key: res.data[m].num_key, child: [] })
 | 
			
		||||
        //         }
 | 
			
		||||
        //     }
 | 
			
		||||
        // }
 | 
			
		||||
        
 | 
			
		||||
        for(let i in res.data){
 | 
			
		||||
            if (parseInt(res.data[i].fuid) == 0) {
 | 
			
		||||
                // console.log(res.data[i])
 | 
			
		||||
                group.push({ name: res.data[i].groupname, num_key: res.data[i].num_key, child: [] })
 | 
			
		||||
            }
 | 
			
		||||
            // console.log(res.data[i].num_key,res.data[i].fuid)
 | 
			
		||||
            for(let m in res.data){
 | 
			
		||||
                // console.log(parseInt(res.data[i].fuid),res.data[m].num_key)
 | 
			
		||||
                if(parseInt(res.data[i].fuid)==res.data[m].num_key){
 | 
			
		||||
                    // console.log(res.data[i])
 | 
			
		||||
                    for(let n in group){
 | 
			
		||||
                        console.log(group[n].num_key)
 | 
			
		||||
                        if(group[n].num_key==parseInt(res.data[i].fuid)){
 | 
			
		||||
                            group[n].child.push({name:res.data[i].groupname,num_key:res.data[i].num_key,child:[]})
 | 
			
		||||
                        }else{
 | 
			
		||||
                        //    group[n].child[n].push({name:res.data[i].groupname,num_key:res.data[i].num_key,child:[]})
 | 
			
		||||
                        for(k in group[n].child){
 | 
			
		||||
                            if(group[n].child[k].num_key==parseInt(res.data[i].fuid)){
 | 
			
		||||
                                group[n].child[k].child.push({name:res.data[i].groupname,num_key:res.data[i].num_key,child:[]})
 | 
			
		||||
                            }
 | 
			
		||||
                            console.log(group[n].child[k])
 | 
			
		||||
                        }
 | 
			
		||||
                            
 | 
			
		||||
                        // console.log(group[n].child.push({name:res.data[i].groupname,num_key:res.data[i].num_key,child:[]}))
 | 
			
		||||
                            
 | 
			
		||||
                            }
 | 
			
		||||
                            
 | 
			
		||||
                       
 | 
			
		||||
        }
 | 
			
		||||
        for (let m in res.data) {
 | 
			
		||||
            console.log(res.data[m].num_key, parseInt(res.data[m].fuid))
 | 
			
		||||
            // console.log(1111)
 | 
			
		||||
            if (res.data[m].num_key == parseInt(res.data[m].fuid)){
 | 
			
		||||
                for (let n in group) {
 | 
			
		||||
                    if (group[n].num_key == parseInt(res.data[m].fuid)) {
 | 
			
		||||
                        group[n].child.push({ name: res.data[m].groupname, num_key: res.data[m].num_key, child: [] })
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            for (let n in group) {
 | 
			
		||||
                if (group[n].num_key == parseInt(res.data[m].fuid)) {
 | 
			
		||||
                    group[n].child.push({ name: res.data[m].groupname, num_key: res.data[m].num_key, child: [] })
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        //  console.log("aaaaaa")
 | 
			
		||||
            // if (parseInt(res.data[i].fuid) == 0) {
 | 
			
		||||
            //     // console.log(res.data[i])
 | 
			
		||||
            //     group.push({ name: res.data[i].groupname, num_key: res.data[i].num_key, child: [] })
 | 
			
		||||
            // }
 | 
			
		||||
        }
 | 
			
		||||
        // for(let m in res.data){
 | 
			
		||||
        //     if(res.data[m])
 | 
			
		||||
        // }
 | 
			
		||||
 | 
			
		||||
        console.log(JSON.stringify(group))
 | 
			
		||||
        ctx.body = group
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user