用户库

This commit is contained in:
Liang Ding 2014-08-31 14:15:13 +08:00
parent 9664a7cada
commit 8eb51f5cc4
2 changed files with 11 additions and 2 deletions

View File

@ -5,5 +5,5 @@ import (
)
func main() {
fmt.Println("Hello, 世界")1
fmt.Println("Hello, daniel")
}

View File

@ -3,6 +3,7 @@ package file
import (
"encoding/json"
"github.com/b3log/wide/conf"
"github.com/b3log/wide/session"
"github.com/golang/glog"
"io/ioutil"
"net/http"
@ -13,9 +14,17 @@ import (
)
func GetFiles(w http.ResponseWriter, r *http.Request) {
session, _ := session.Store.Get(r, "wide-session")
username := session.Values["name"].(string)
glog.Info(username)
userRepos := strings.Replace(conf.Wide.UserRepos, "{user}", username, -1)
data := map[string]interface{}{"succ": true}
root := FileNode{"projects", conf.Wide.Repos, "d", []*FileNode{}}
root := FileNode{"projects", userRepos, "d", []*FileNode{}}
fileInfo, _ := os.Lstat(conf.Wide.Repos)
walk(conf.Wide.Repos, fileInfo, &root)