/
hualao.go
44 lines (35 loc) · 1 KB
/
hualao.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package controllers
import (
"fmt"
"github.com/astaxie/beego"
"github.com/sf100/chatter/chatterweb/models"
)
type HuaLaoController struct {
beego.Controller
}
func (this *HuaLaoController) Get() {
this.TplNames = "hualao/hualao.html"
}
func (this *HuaLaoController) Post() {
this.TplNames = "hualao/hualao.html"
user := this.GetSession("user").(*models.User)
users := models.GetUserFriend(user.Id)
fmt.Println(users)
//默认打开用户好友列表
this.Data["friendLen"] = len(users)
this.Data["qunsLen"] = models.GetUserQunNums(user.Id)
this.Data["Users"] = users
}
/*获取好友信息列表*/
func (this *HuaLaoController) GetUserFriend() {
user := this.GetSession("user").(*models.User)
users := models.GetUserFriend(user.Id)
this.TplNames = "hualao/userList.html"
this.Data["Users"] = users
}
func (this *HuaLaoController) GetUserQuns() {
user := this.GetSession("user").(*models.User)
quns := models.GetUserQuns(user.Id)
this.TplNames = "hualao/qunList.html"
this.Data["quns"] = quns
}