🔥 改为前后端分离形式
This commit is contained in:
33
app/contact.go
Normal file
33
app/contact.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-wechat/common/response"
|
||||
"go-wechat/service"
|
||||
)
|
||||
|
||||
// GetFriends
|
||||
// @description: 获取好友列表
|
||||
// @param ctx
|
||||
func GetFriends(ctx *gin.Context) {
|
||||
// 取出所有好友列表
|
||||
friends, _, err := service.GetAllFriend()
|
||||
if err != nil {
|
||||
response.New(ctx).SetMsg("系统错误").SetError(err).Fail()
|
||||
}
|
||||
|
||||
response.New(ctx).SetData(friends).Success()
|
||||
}
|
||||
|
||||
// GetGroups
|
||||
// @description: 获取群列表
|
||||
// @param ctx
|
||||
func GetGroups(ctx *gin.Context) {
|
||||
// 取出所有好友列表
|
||||
_, groups, err := service.GetAllFriend()
|
||||
if err != nil {
|
||||
response.New(ctx).SetMsg("系统错误").SetError(err).Fail()
|
||||
}
|
||||
|
||||
response.New(ctx).SetData(groups).Success()
|
||||
}
|
||||
Reference in New Issue
Block a user