// 路由注册-用户注册
// 秒寻科技
// zt 2024-01-04

package userrouter

import (
	"ipsomc/core/gin/midware/endecrypt"
	"ipsomc/core/gin/midware/islogin"
	"ipsomc/core/user/userhandler"

	"github.com/gin-gonic/gin"
)

// 配置项目路由
func SetRouter(r *gin.RouterGroup) {
	groupRouter := r.Group("/user") //路由分组
	groupHan := userhandler.UserHan{}

	//请求参数解密
	groupRouter.Use(endecrypt.DecryptReqParam())

	//用户登录
	groupRouter.POST("/operatorLogin", groupHan.OperatorLoginHan)

	//用户登录检查，该"行"后面的接口都需要用户登录后方可操作
	groupRouter.Use(islogin.PcIsLogin())

	//操作员接口
	groupRouter.POST("/addOperator", groupHan.AddOperatorHan)
	groupRouter.POST("/updateOperator", groupHan.UpdateOperatorHan)
	groupRouter.POST("/updateOperatorPwd", groupHan.UpdateOperatorPwdHan)
	groupRouter.POST("/resetOperatorPwd", groupHan.ResetOperatorPwdHan)
	groupRouter.POST("/deleteOperator", groupHan.DeleteOperatorHan)
	groupRouter.POST("/getOperatorById", groupHan.GetOperatorByIdHan)
	groupRouter.POST("/getOperatorPageList", groupHan.GetOperatorPageListHan)
	groupRouter.POST("/getSysOperatorByCompanyId", groupHan.GetSysOperatorByCompanyIdHan)

	//角色接口
	groupRouter.POST("/addRole", groupHan.AddRoleHan)
	groupRouter.POST("/updateRole", groupHan.UpdateRoleHan)
	groupRouter.POST("/deleteRole", groupHan.DeleteRoleHan)
	groupRouter.POST("/getRoleById", groupHan.GetRoleByIdHan)
	groupRouter.POST("/getRolePageList", groupHan.GetRolePageListHan)

	//权限接口
	groupRouter.POST("/addPermission", groupHan.AddPermissionHan)
	groupRouter.POST("/updatePermission", groupHan.UpdatePermissionHan)
	groupRouter.POST("/deletePermission", groupHan.DeletePermissionHan)
	groupRouter.POST("/getPermissionById", groupHan.GetPermissionByIdHan)
	groupRouter.POST("/getPermissionList", groupHan.GetPermissionListHan)
	groupRouter.POST("/getPermissionPageList", groupHan.GetPermissionPageListHan)

	//操作员权限接口
	groupRouter.POST("/getOperatorPermission", groupHan.GetOperatorPermissionHan)
	groupRouter.GET("/getOperatorPermission", groupHan.GetOperatorPermissionHan)

}
