代码拉取完成,页面将自动刷新
同步操作将从 pixel/gin-vue-admin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package user
import (
"gitee.com/g-qs/gin-vue-admin/server/global"
"gitee.com/g-qs/gin-vue-admin/server/model/common/response"
"gitee.com/g-qs/gin-vue-admin/server/model/user"
userReq "gitee.com/g-qs/gin-vue-admin/server/model/user/request"
"gitee.com/g-qs/gin-vue-admin/server/service"
"gitee.com/g-qs/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"strconv"
)
type UserBindManageApi struct {
}
var BindService = service.ServiceGroupApp.UserServiceGroup.UserBindManageService
// CreateUserBindManage 创建用户绑定健管师
// @Tags UserBindManage
// @Summary 创建用户绑定健管师
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body user.UserBindManage true "创建用户绑定健管师"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /Bind/createUserBindManage [post]
func (BindApi *UserBindManageApi) CreateUserBindManage(c *gin.Context) {
var Bind user.UserBindManage
err := c.ShouldBindJSON(&Bind)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
id := utils.GetUserID(c)
Bind.Uid = id
if err := BindService.CreateUserBindManage(&Bind); err != nil {
global.GVA_LOG.Error("提交失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
} else {
response.OkWithMessage("提交成功", c)
}
}
// GetBindUserList 获取绑定用户列表
// @Tags UserBindManage
// @Summary 获取绑定用户列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query userReq.UserBindManageSearch true "获取绑定用户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /Bind/getUserBindManageList [get]
func (BindApi *UserBindManageApi) GetBindUserList(c *gin.Context) {
var pageInfo userReq.UserBindManageSearch
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if list, total, err := BindService.GetBindUserInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}
// UpdateBindStatus 更改绑定状态
// @Tags UserBindManage
// @Summary 更改绑定状态
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body user.UserBindManage true "更改绑定状态"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /Bind/updateBindStatus [put]
func (BindApi *UserBindManageApi) UpdateBindStatus(c *gin.Context) {
var Bind user.UserBindManage
err := c.ShouldBindJSON(&Bind)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := BindService.UpdateBindStatus(Bind.ID, strconv.Itoa(int(Bind.Status))); err != nil {
global.GVA_LOG.Error("操作失败!", zap.Error(err))
response.FailWithMessage("操作失败", c)
} else {
response.OkWithMessage("操作成功", c)
}
}
// DeleteUserBindManage 删除用户绑定健管师
// @Tags UserBindManage
// @Summary 删除用户绑定健管师
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body user.UserBindManage true "删除用户绑定健管师"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /Bind/deleteUserBindManage [delete]
func (BindApi *UserBindManageApi) DeleteUserBindManage(c *gin.Context) {
id := c.Query("ID")
if err := BindService.DeleteUserBindManage(id); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
} else {
response.OkWithMessage("删除成功", c)
}
}
// DeleteUserBindManageByIds 批量删除用户绑定健管师
// @Tags UserBindManage
// @Summary 批量删除用户绑定健管师
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除用户绑定健管师"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /Bind/deleteUserBindManageByIds [delete]
func (BindApi *UserBindManageApi) DeleteUserBindManageByIds(c *gin.Context) {
ids := c.QueryArray("ids[]")
if err := BindService.DeleteUserBindManageByIds(ids); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
}
}
// UpdateUserBindManage 更新用户绑定健管师
// @Tags UserBindManage
// @Summary 更新用户绑定健管师
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body user.UserBindManage true "更新用户绑定健管师"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /Bind/updateUserBindManage [put]
func (BindApi *UserBindManageApi) UpdateUserBindManage(c *gin.Context) {
var Bind user.UserBindManage
err := c.ShouldBindJSON(&Bind)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := BindService.UpdateUserBindManage(Bind); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
}
}
// FindUserBindManage 用id查询用户绑定健管师
// @Tags UserBindManage
// @Summary 用id查询用户绑定健管师
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query user.UserBindManage true "用id查询用户绑定健管师"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /Bind/findUserBindManage [get]
func (BindApi *UserBindManageApi) FindUserBindManage(c *gin.Context) {
id := c.Query("ID")
if reBind, err := BindService.GetUserBindManage(id); err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"reBind": reBind}, c)
}
}
// GetUserBindManageList 分页获取用户绑定健管师列表
// @Tags UserBindManage
// @Summary 分页获取用户绑定健管师列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query userReq.UserBindManageSearch true "分页获取用户绑定健管师列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /Bind/getUserBindManageList [get]
func (BindApi *UserBindManageApi) GetUserBindManageList(c *gin.Context) {
var pageInfo userReq.UserBindManageSearch
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if list, total, err := BindService.GetUserBindManageInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。