services

package
v0.0.0-...-cf0f625 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateBit

func CalculateBit(actions []string, withPermissions bool, code string, permissions map[string]uint32) map[string]uint32

func EncryptMd5

func EncryptMd5(input string) string

func EncryptMd5By16Bit

func EncryptMd5By16Bit(data string) string

func GetUserPermissions

func GetUserPermissions(appkey string, userId uint) map[string]uint32

func JWTAuth

func JWTAuth() func(c *see.Context)

func ProtoFailure

func ProtoFailure() *proto.Reply

func ProtoSucceed

func ProtoSucceed() *proto.Reply

func Wrapper

func Wrapper(handle WrapperFuncType) see.HandlerFunc

Types

type ChangPassParam

type ChangPassParam struct {
	Password       string `json:"password" validate:"required"`
	NewPassword    string `json:"newPassword" validate:"required"`
	ValidateCodeId string `json:"validateCodeId" validate:"required"` // 验证码Id
	ValidateCode   string `json:"validateCode" validate:"required"`   // 验证码
}

type ChangingStatusParam

type ChangingStatusParam struct {
	Id     string `json:"id" validate:"required"`
	Status bool   `json:"status" validate:"required"`
}

type FirstUserParam

type FirstUserParam struct {
	Password       string `json:"password" validate:"required"`       // 密码
	Account        string `json:"account" validate:"required"`        // 账号
	NickName       string `json:"nickName" validate:"-"`              // 昵称
	ValidateCodeId string `json:"validateCodeId" validate:"required"` // 验证码Id
	ValidateCode   string `json:"validateCode" validate:"required"`   // 验证码
}

type LoginParam

type LoginParam struct {
	Account        string `json:"account" validate:"required"`        // 账号
	Password       string `json:"password" validate:"required"`       // 密码
	ValidateCodeId string `json:"validateCodeId" validate:"required"` // 验证码Id
	ValidateCode   string `json:"validateCode" validate:"required"`   // 验证码
}

type LoginResp

type LoginResp struct {
	Authorization string // Token
	NickName      string
}

type PaginateParam

type PaginateParam struct {
	Page   uint32              `json:"page" validate:"required"`
	Limit  uint32              `json:"limit" validate:"required"`
	Search map[string][]string `json:"search" validate:"-"`
}

type RegisterAppParam

type RegisterAppParam struct {
	ValidateCodeId string `json:"validateCodeId" validate:"required"` // 验证码Id
	ValidateCode   string `json:"validateCode" validate:"required"`   // 验证码
	Name           string `json:"name" validate:"required"`
	Remark         string `json:"remark" validate:"-"`
}

type RegisterParam

type RegisterParam struct {
	ValidateCodeId string `json:"validateCodeId" validate:"required"` // 验证码Id
	ValidateCode   string `json:"validateCode" validate:"required"`   // 验证码
	Password       string `json:"password" validate:"required"`       // 密码
	Account        string `json:"account" validate:"required"`        // 账号
	NickName       string `json:"nickName" validate:"required"`       // 昵称
	Mobile         string `json:"mobile" validate:"required"`         // 手机号
	Email          string `json:"email" validate:"required"`          // 邮箱
	Info           struct {
		RealName string `json:"realName" validate:"-"` // 详情
		Age      uint   `json:"age" validate:"-"`      // 年龄
		Sex      uint   `json:"sex" validate:"-"`      // 性别
		Nation   string `json:"nation" validate:"-"`   // 民族
		Address  string `json:"address" validate:"-"`  // 地址
		IdCard   string `json:"idCard" validate:"-"`   // 身份证
	} `json:"info" validate:"-"` // 详情
}

type Response

type Response struct {
	Code    int         `json:"code"`
	Message interface{} `json:"message"`
	Data    interface{} `json:"data"`
}

func Failure

func Failure(msg interface{}) Response

func RespData

func RespData(data interface{}) Response

func Success

func Success(msg interface{}) Response

type Svr

type Svr struct {
	Name  string
	Conf  *config.Config
	See   *see.Engine
	Redis redisx.Rediser
}
var App *Svr

func (*Svr) AdminGetUserList

func (this *Svr) AdminGetUserList(c *see.Context) Response

@Summary 获取账号列表 @Description 管理员获取账号列表 @Tags Management @Accept json @Produce json @Param Body body PaginateParam true "分页参数" @Success 200 {object} Response "响应信息" @Router /admin/account/list [post]

func (*Svr) AuthorityVerify

func (this *Svr) AuthorityVerify(ctx context.Context, in *proto.AuthorityVerifyRequest) (*proto.Reply, error)

func (*Svr) Bind

func (this *Svr) Bind()

func (*Svr) BindUserRole

func (this *Svr) BindUserRole(ctx context.Context, in *proto.BindUserRoleRequest) (*proto.Reply, error)

func (*Svr) ChangingPasswordBySelf

func (this *Svr) ChangingPasswordBySelf(c *see.Context) Response

@Summary 修改密码 @Description 通过旧密码设置新密码 @Tags Management @Accept json @Produce json @Param Body body ChangPassParam true "修改密码参数" @Success 200 {object} Response "响应信息" @Router /admin/changingPassword [post]

func (*Svr) ChangingStatusByAdmin

func (this *Svr) ChangingStatusByAdmin(c *see.Context) Response

@Summary 启/停用账号 @Description 切换账号状态 @Tags Management @Accept json @Produce json @Param Body body ChangingStatusParam true "修改用户状态参数" @Success 200 {object} Response "响应信息" @Router /admin/changingUserStatus [post]

func (*Svr) ChangingUserStatus

func (this *Svr) ChangingUserStatus(ctx context.Context, in *proto.ChangingUserStatusRequest) (*proto.Reply, error)

func (*Svr) CreateFirstUser

func (this *Svr) CreateFirstUser(c *see.Context) Response

@Summary 初始化管理员 @Description 创建第一个管理员用户 @Tags Initialized @Accept json @Produce json @Param Body body FirstUserParam true "初始化参数" @Success 200 {object} Response "响应信息" @Router /admin/createFirstUser [post]

func (*Svr) CreateRole

func (this *Svr) CreateRole(ctx context.Context, in *proto.RoleInfo) (*proto.Reply, error)

func (*Svr) CreateUser

func (this *Svr) CreateUser(ctx context.Context, in *proto.CreateUserRequest) (*proto.CreateUserReply, error)

func (*Svr) DeleteRole

func (this *Svr) DeleteRole(ctx context.Context, in *proto.DeleteRoleRequest) (*proto.Reply, error)

func (*Svr) DisableMenu

func (this *Svr) DisableMenu(ctx context.Context, in *proto.DisableMenuRequest) (*proto.Reply, error)

func (*Svr) GetAppMenus

func (this *Svr) GetAppMenus(ctx context.Context, in *proto.NullRequest) (*proto.MenusRequest, error)

func (*Svr) GetRoleList

func (this *Svr) GetRoleList(ctx context.Context, in *proto.PaginateRequest) (*proto.GetRoleListReply, error)

func (*Svr) GetUserList

func (this *Svr) GetUserList(ctx context.Context, in *proto.PaginateRequest) (*proto.GetUserListReply, error)

func (*Svr) Initialized

func (this *Svr) Initialized(c *see.Context) Response

@Summary 系统初始化 @Description 判断是否已初始化系统 @Tags Initialized @Accept json @Produce json @Success 200 {object} Response @Router /admin/initialized [get]

func (*Svr) LoginByAccount

func (this *Svr) LoginByAccount(c *see.Context) Response

@Summary 登录 @Description 通过账号密码登录 @Tags Public @Accept json @Produce json @Param Body body LoginParam true "登录参数" @Success 200 {object} Response{data=LoginResp} "token" @Router /loginByAccount [post]

func (*Svr) PermissionsTpl

func (this *Svr) PermissionsTpl(ctx context.Context, in *proto.PermissionsTplRequest) (*proto.Reply, error)

func (*Svr) RegisterApp

func (this *Svr) RegisterApp(c *see.Context) Response

@Summary 注册应用 @Description 注册新应用 @Tags Management @Accept json @Produce json @Param Body body RegisterAppParam true "注册参数" @Success 200 {object} Response @Router /admin/app/register [post]

func (*Svr) RegisterUser

func (this *Svr) RegisterUser(c *see.Context) Response

@Summary 注册用户 @Description 注册新用户 @Tags Public @Accept json @Produce json @Param Body body RegisterParam true "注册参数" @Success 200 {object} Response @Router /user/register [post]

func (*Svr) Run

func (this *Svr) Run()

func (*Svr) TokenRefresh

func (this *Svr) TokenRefresh(ctx context.Context, in *proto.Token) (*proto.Token, error)

func (*Svr) TokenVerify

func (this *Svr) TokenVerify(ctx context.Context, in *proto.Token) (*proto.TokenVerifyReply, error)

func (*Svr) UpdateRole

func (this *Svr) UpdateRole(ctx context.Context, in *proto.UpdateRoleRequest) (*proto.Reply, error)

func (*Svr) UpdateUserInfo

func (this *Svr) UpdateUserInfo(ctx context.Context, in *proto.UpdateUserInfoRequest) (*proto.Reply, error)

func (*Svr) ValidateCodeByBase64

func (this *Svr) ValidateCodeByBase64(c *see.Context) Response

@Summary 验证码 @Description 获取图形验证码 @Tags Public @Accept json @Produce json @Success 200 {object} Response @Router /validateCodeByBase64 [get]

func (*Svr) ValidateCodeVerify

func (this *Svr) ValidateCodeVerify(id, val string, by ...string) bool

type WrapperFuncType

type WrapperFuncType func(c *see.Context) Response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL