新增一个简单的好友列表页面

This commit is contained in:
李寻欢
2023-11-30 11:37:02 +08:00
parent 6626f45af2
commit 6a259b0552
17 changed files with 523 additions and 40 deletions

26
app/index.go Normal file
View File

@@ -0,0 +1,26 @@
package app
import (
"fmt"
"github.com/gin-gonic/gin"
"go-wechat/service"
"net/http"
)
// Index
// @description: 首页
// @param ctx
func Index(ctx *gin.Context) {
var result = gin.H{
"msg": "success",
}
// 取出所有好友列表
friends, groups, err := service.GetAllFriend()
if err != nil {
result["msg"] = fmt.Sprintf("数据获取失败: %s", err.Error())
}
result["friends"] = friends
result["groups"] = groups
// 渲染页面
ctx.HTML(http.StatusOK, "index.html", result)
}