478 lines
9.6 KiB
Go
478 lines
9.6 KiB
Go
package web_acc
|
|
|
|
import (
|
|
"time"
|
|
"videoweb/pub/pubdef"
|
|
"videoweb/web/service/srv_acc"
|
|
)
|
|
|
|
/////////////////////////登录//////////////////////////
|
|
/******************主后台登录***********************/
|
|
// POST /web/login/acc
|
|
|
|
// 请求参数
|
|
type MainWebLoginReq struct {
|
|
// 账户
|
|
Acc string `json:"acc,omitempty"`
|
|
// 密码
|
|
Pwd string `json:"pwd,omitempty"`
|
|
// 验证码
|
|
Code string `json:"code,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MainWebLoginResp struct {
|
|
// 账户id
|
|
AccId int64 `json:"accId"`
|
|
// 账户
|
|
Acc string `json:"acc"`
|
|
// 角色id
|
|
RoleId int64 `json:"roleId"`
|
|
// token
|
|
Token string `json:"token"`
|
|
// 二维码
|
|
Qurl []byte `json:"qurl"`
|
|
}
|
|
|
|
/******************绑定二维码***********************/
|
|
// POST /web/login/bind
|
|
|
|
// 请求参数
|
|
type BindQurlReq struct {
|
|
//账户
|
|
Acc string `json:"acc,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type BindQurlResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************绑定二维码***********************/
|
|
|
|
/////////////////////////角色//////////////////////////
|
|
// GET /web/role/list
|
|
// 请求参数
|
|
|
|
// 角色记录
|
|
type MwRoleRec struct {
|
|
// 角色Id
|
|
Id int64 `json:"id"`
|
|
// 角色名称
|
|
Name string `json:"name"`
|
|
// 描述
|
|
Desc string `json:"desc"`
|
|
// 是否启用 false:禁用 true:启用
|
|
IsEnb bool `json:"isEnb"`
|
|
// 已有权限的api
|
|
ApiMenus []string `json:"apiMenus"`
|
|
// 创建时间
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
// 更新时间
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleListResp struct {
|
|
// 总共数量
|
|
TotalCount int64 `json:"totalCount"`
|
|
// 当前页配置记录
|
|
RoleRecs []*MwRoleRec `json:"roleRecs"`
|
|
}
|
|
|
|
/******************角色添加***********************/
|
|
// POST /web/role/add
|
|
|
|
// 请求参数
|
|
type MwRoleAddReq struct {
|
|
// 名称
|
|
Name string `json:"name"`
|
|
// 描述
|
|
Desc string `json:"desc"`
|
|
// 状态
|
|
IsEnb bool `json:"isEnb"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleAddResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************角色删除***********************/
|
|
// POST /web/role/del
|
|
|
|
// 请求参数
|
|
type MwRoleDelReq struct {
|
|
// 角色id
|
|
Id int64 `json:"id,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleDelResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************角色获取信息***********************/
|
|
// GET /web/role/getinfo
|
|
|
|
// 请求参数
|
|
type MwRoleGetInfoReq struct {
|
|
// 角色id
|
|
Id int64 `form:"id" json:"id,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleGetInfoResp struct {
|
|
RoleRec *MwRoleRec `json:"roleRec"`
|
|
}
|
|
|
|
/******************角色更新***********************/
|
|
// POST /web/role/up
|
|
|
|
// 请求参数
|
|
type MwRoleUpReq struct {
|
|
// 角色id
|
|
Id int64 `json:"id"`
|
|
// 名称
|
|
Name string `json:"name"`
|
|
// 描述
|
|
Desc string `json:"desc"`
|
|
// 状态
|
|
IsEnb bool `json:"isEnb"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleUpResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************角色使能***********************/
|
|
// POST /web/role/enable
|
|
|
|
// 请求参数
|
|
type MwRoleEnableReq struct {
|
|
// 角色id
|
|
Id int64 `json:"id"`
|
|
// 状态
|
|
IsEnb bool `json:"isEnb"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleEnableResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************角色下拉***********************/
|
|
// GET /web/role/drop
|
|
|
|
// 请求参数
|
|
|
|
type MwRoleDrop struct {
|
|
// 角色Id
|
|
Id int64 `json:"id,omitempty"`
|
|
// 角色名称
|
|
Name string `json:"name,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleDropResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
RoleDrop []*MwRoleDrop `json:"roleDrop"`
|
|
}
|
|
|
|
/******************获取权限***********************/
|
|
// GET /web/role/getauth
|
|
|
|
type Router_Meta struct {
|
|
//
|
|
Title string `json:"title"`
|
|
//
|
|
Icon string `json:"icon"`
|
|
//
|
|
NoCache bool `json:"noCache"`
|
|
}
|
|
|
|
type Router_ApiUrl struct {
|
|
//
|
|
Url []string `json:"url,omitempty"`
|
|
//
|
|
Desc string `json:"desc,omitempty"`
|
|
//
|
|
Status bool `json:"status,omitempty"`
|
|
//
|
|
Method []string `json:"method,omitempty"`
|
|
}
|
|
|
|
type Router struct {
|
|
//
|
|
Path string `json:"path"`
|
|
//
|
|
Component string `json:"component"`
|
|
//
|
|
Redirect string `json:"redirect"`
|
|
//
|
|
Name string `json:"name"`
|
|
//
|
|
IsShow bool `json:"isShow"`
|
|
//
|
|
Hidden bool `json:"hidden"`
|
|
//
|
|
Meta *Router_Meta `json:"meta"`
|
|
//
|
|
Children []*Router `json:"children"`
|
|
ApiUrl []*Router_ApiUrl `json:"apiUrl"`
|
|
}
|
|
|
|
// 请求参数
|
|
type MwRoleGetAuthReq struct {
|
|
// 角色id
|
|
Id int64 `form:"id" json:"id,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleGetAuthResp struct {
|
|
// 角色id
|
|
Id int64 `json:"id,omitempty"`
|
|
//
|
|
Router []*Router `json:"router,omitempty"`
|
|
}
|
|
|
|
/******************更新权限***********************/
|
|
// POST /web/role/upauth
|
|
|
|
// 请求参数
|
|
type MwRoleUpAuthReq struct {
|
|
// 角色id
|
|
Id int64 `json:"id,omitempty"`
|
|
Router []*Router `json:"router,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwRoleUpAuthResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/////////////////////////账号//////////////////////////
|
|
|
|
type MwAccRec struct {
|
|
// 账号Id
|
|
Id int64 `json:"id"`
|
|
// 用户名
|
|
UserName string `json:"userName"`
|
|
// 账号
|
|
Acc string `json:"acc"`
|
|
// 邮箱
|
|
Email string `json:"email"`
|
|
// 角色Id
|
|
RoleId int64 `json:"roleId"`
|
|
// 角色名
|
|
RoleName string `json:"roleName"`
|
|
// // 二步签名
|
|
// Base32 string `json:"base32"`
|
|
// 是否已签名
|
|
IsBase32 bool `json:"isBase32"`
|
|
// 使能
|
|
IsEnb bool `json:"isEnb"`
|
|
//禁用原因
|
|
FeedBack string `json:"feedBack"`
|
|
// 创建时间
|
|
CreatedAt int64 `json:"createdAt"`
|
|
// 更新时间
|
|
UpdatedAt int64 `json:"updatedAt"`
|
|
// 允许访问的IP
|
|
LimitIP []string `json:"limitIP"`
|
|
}
|
|
|
|
/******************账号列表***********************/
|
|
// GET /web/acc/list
|
|
|
|
// 请求参数
|
|
type MwAccListReq struct {
|
|
// 搜索条件
|
|
KeyWords string `json:"keyWords" form:"keyWords"`
|
|
//状态 1正常 2 禁用
|
|
Status int64 `json:"status" form:"status"`
|
|
// 页码
|
|
pubdef.Page
|
|
}
|
|
|
|
// 返回参数
|
|
type MwAccListResp struct {
|
|
// 总共数量
|
|
TotalCount int64 `json:"totalCount"`
|
|
// 当前页配置记录
|
|
AccRec []*MwAccRec `json:"accRec"`
|
|
}
|
|
|
|
/******************账号添加***********************/
|
|
// POST /web/acc/add
|
|
|
|
// 请求参数
|
|
type MwAccAddReq struct {
|
|
// 名称
|
|
Name string `json:"name"`
|
|
// 密码
|
|
Pwd string `json:"pwd"`
|
|
// 账户
|
|
Acc string `json:"acc"`
|
|
// 邮箱
|
|
Email string `json:"email"`
|
|
// 角色ID
|
|
RoleId int64 `json:"roleId"`
|
|
// 使能
|
|
IsEnb bool `json:"isEnb"`
|
|
// 允许访问的IP
|
|
LimitIP []string `json:"limitIP"`
|
|
}
|
|
|
|
type MwAccAddResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************账号删除***********************/
|
|
// POST web/mw/acc/del
|
|
|
|
// 请求参数
|
|
type MwAccDelReq struct {
|
|
// 账号Id
|
|
Id int64 `json:"id,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwAccDelResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************账号获取信息***********************/
|
|
// GET /web/acc/getinfo
|
|
// 请求参数
|
|
type MwAccGetInfoReq struct {
|
|
// 角色id
|
|
Id int64 `form:"id" json:"id,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwAccGetInfoResp struct {
|
|
// 账号Id
|
|
Id int64 `json:"id"`
|
|
// 用户名
|
|
UserName string `json:"userName"`
|
|
// 账号
|
|
Acc string `json:"acc"`
|
|
// 密码
|
|
Pwd string `json:"pwd"`
|
|
// 邮箱
|
|
Email string `json:"email"`
|
|
// 角色Id
|
|
RoleId int64 `json:"roleId"`
|
|
// 使能
|
|
IsEnb bool `json:"isEnb"`
|
|
// 允许访问的IP
|
|
LimitIP []string `json:"limitIP"`
|
|
}
|
|
|
|
/******************角色更新***********************/
|
|
// POST web/mw/acc/up
|
|
|
|
// 请求参数
|
|
type MwAccUpReq struct {
|
|
// 账号Id
|
|
Id int64 `json:"id"`
|
|
// 用户名
|
|
UserName string `json:"userName"`
|
|
// 账号
|
|
Acc string `json:"acc"`
|
|
// 密码
|
|
Pwd string `json:"pwd"`
|
|
// 邮箱
|
|
Email string `json:"email"`
|
|
// 角色Id
|
|
RoleId int64 `json:"roleId"`
|
|
// 使能
|
|
IsEnb bool `json:"isEnb"`
|
|
// 允许访问的IP
|
|
LimitIP []string `json:"limitIP"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwAccUpResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************账号获取状态***********************/
|
|
// GET web/mw/acc/getstatus
|
|
|
|
// 请求参数
|
|
type MwAccGetStatusReq struct {
|
|
// 角色id
|
|
Id int64 `form:"id" json:"id,omitempty"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwAccGetStatusResp struct {
|
|
|
|
// 账号Id
|
|
Id int64 `json:"id"`
|
|
// 用户名
|
|
UserName string `json:"userName"`
|
|
// 使能
|
|
IsEnb bool `json:"isEnb"`
|
|
//禁用原因
|
|
FeedBack string `json:"feedBack"`
|
|
}
|
|
|
|
/******************账号保存状态***********************/
|
|
// POST web/mw/acc/savestatus
|
|
// 请求参数
|
|
type MwAccSaveStatusReq struct {
|
|
// 账号Id
|
|
Id int64 `json:"id"`
|
|
// 用户名
|
|
UserName string `json:"userName"`
|
|
// 使能
|
|
IsEnb bool `json:"isEnb"`
|
|
//禁用原因
|
|
FeedBack string `json:"feedBack"`
|
|
}
|
|
|
|
// 返回参数
|
|
type MwAccSaveStatusResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|
|
|
|
/******************获取账号操作列表***********************/
|
|
// POST web/acc/ops
|
|
// 请求参数
|
|
type AccOpLogReq struct {
|
|
srv_acc.OpLogSearch
|
|
}
|
|
|
|
// AccOpLogResp 返回参数
|
|
type AccOpLogResp struct {
|
|
Total int64 `json:"total" bson:"total"`
|
|
List []*srv_acc.OpLogInfo `json:"list" bson:"list"`
|
|
}
|
|
|
|
// 修改账号密码
|
|
type MwAccUpPwdReq struct {
|
|
// 账号Id
|
|
Id int64 `json:"id" binding:"required"`
|
|
// 密码
|
|
Pwd string `json:"pwd"`
|
|
}
|
|
|
|
type MwAccUpPwdResp struct {
|
|
// 是否成功 true:成功 false:未成功
|
|
Result bool `json:"result,omitempty"`
|
|
}
|