MCPcopy Index your code
hub / github.com/TruthHun/DocHub / Get

Method Get

controllers/HomeControllers/UserController.go:32–154  ·  view source on GitHub ↗

会员中心

()

Source from the content-addressed store, hash-verified

30
31//会员中心
32func (this *UserController) Get() {
33 uid, _ := this.GetInt(":uid")
34 path := this.GetString(":splat")
35 params := conv.Path2Map(path)
36 //排序
37 sort := "new"
38 if param, ok := params["sort"]; ok {
39 sort = param
40 }
41 //页码
42 p := 1
43 if page, ok := params["p"]; ok {
44 p = helper.Interface2Int(page)
45 if p < 1 {
46 p = 1
47 }
48 }
49
50 switch sort {
51 case "dcnt":
52 sort = "dcnt"
53 case "score":
54 sort = "score"
55 case "vcnt":
56 sort = "vcnt"
57 case "ccnt":
58 sort = "ccnt"
59 default:
60 sort = "new"
61 }
62 //显示风格
63 style := "list"
64 if s, ok := params["style"]; ok {
65 style = s
66 }
67 if style != "th" {
68 style = "list"
69 }
70 //cid:collect folder id ,收藏夹id
71 cid := 0
72 if s, ok := params["cid"]; ok {
73 cid = helper.Interface2Int(s)
74 }
75 if p < 1 {
76 p = 1
77 }
78 if uid < 1 {
79 uid = this.IsLogin
80 }
81 this.Data["Uid"] = uid
82
83 if uid <= 0 {
84 this.Redirect("/user/login", 302)
85 return
86 }
87
88 listRows := 16
89 user, rows, err := models.NewUser().GetById(uid)

Callers 1

PrepareMethod · 0.45

Calls 3

GetByPageMethod · 0.80
UserListMethod · 0.80
GetByIdMethod · 0.45

Tested by

no test coverage detected