go-wxhelper/app/index.go

30 lines
610 B
Go
Raw Permalink 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
2024-01-31 12:02:33 +08:00
result["aiModels"] = config.Conf.Ai.Models
// 渲染页面
ctx.HTML(http.StatusOK, "index.html", result)
}