1
0
forked from lxh/go-wxhelper
go-wxhelper/app/index.go

29 lines
566 B
Go
Raw Normal View History

package app
import (
"fmt"
"github.com/gin-gonic/gin"
2024-01-09 10:48:21 +08:00
"go-wechat/config"
"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
2024-01-09 10:48:21 +08:00
result["vnc"] = config.Conf.Wechat.VncUrl
// 渲染页面
ctx.HTML(http.StatusOK, "index.html", result)
}