user

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

This section is empty.

Variables

View Source
var CreateUserRouter = router.Handler(func(c router.Context) {
	var (
		input CreateUserParams
	)

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return CreateUser(input)
	})
})
View Source
var GetListRouter = router.Handler(func(c router.Context) {
	var (
		input Query
	)

	c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response {
		return GetList(helper.NewContext(&c), input)
	})
})
View Source
var GetProfileByAdminRouter = router.Handler(func(c router.Context) {
	userId := c.Param("user_id")

	c.ResponseFunc(nil, func() schema.Response {
		return GetProfileByAdmin(helper.NewContext(&c), userId)
	})
})
View Source
var UpdatePasswordByAdminRouter = router.Handler(func(c router.Context) {
	var (
		input UpdatePasswordByAdminParams
	)

	userId := c.Param("user_id")

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return UpdatePasswordByAdmin(helper.NewContext(&c), userId, input)
	})
})
View Source
var UpdateProfileByAdminRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateProfileParams
	)

	userId := c.Param("user_id")

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return UpdateProfileByAdmin(helper.NewContext(&c), userId, input)
	})
})

Functions

func CreateUser

func CreateUser(input CreateUserParams) (res schema.Response)

func GetList

func GetList(c helper.Context, input Query) (res schema.Response)

func GetProfileByAdmin

func GetProfileByAdmin(c helper.Context, userId string) (res schema.Response)

func UpdatePasswordByAdmin

func UpdatePasswordByAdmin(c helper.Context, userId string, input UpdatePasswordByAdminParams) (res schema.Response)

func UpdateProfileByAdmin

func UpdateProfileByAdmin(c helper.Context, userId string, input UpdateProfileParams) (res schema.Response)

Types

type CreateUserParams

type CreateUserParams struct {
	Username *string      `json:"username" validate:"omitempty,min=3,max=36" comment:"用户名"`
	Email    *string      `json:"email" validate:"omitempty,email,max=36" comment:"邮箱"`
	Phone    *string      `json:"phone" validate:"omitempty,numeric,max=11" comment:"手机号"`
	Nickname *string      `json:"nickname" validate:"omitempty" comment:"昵称"`
	Gender   model.Gender `json:"gender" validate:"required,min=0,oneof=0 1 2" comment:"性别"`
	Password string       `json:"password" validate:"required,min=6,max=32" comment:"密码"`
}

type Query

type Query struct {
	schema.Query
}

type UpdatePasswordByAdminParams

type UpdatePasswordByAdminParams struct {
	NewPassword string `json:"new_password" validate:"required" comment:"新密码"`
}

type UpdateProfileParams

type UpdateProfileParams struct {
	Username *string                    `json:"username" validate:"omitempty,min=1,max=36" comment:"用户名"` // 用户名,部分用户有机会修改自己的用户名,比如微信注册的帐号
	Nickname *string                    `json:"nickname" validate:"omitempty,min=1,max=36" comment:"昵称"`
	Gender   *model.Gender              `json:"gender" validate:"omitempty,oneof=0 1 2" comment:"性别"`
	Avatar   *string                    `json:"avatar" validate:"omitempty,url" comment:"头像"`
	Wechat   *UpdateWechatProfileParams `json:"wechat" validate:"omitempty" comment:"微信信息"` // 更新微信绑定的帐号相关
}

type UpdateWechatProfileParams

type UpdateWechatProfileParams struct {
	Nickname  *string `json:"nickname" validate:"omitempty,min=1,max=36" comment:"微信昵称"` // 用户昵称
	AvatarUrl *string `json:"avatar_url" validate:"omitempty,url" comment:"微信头像"`        // 用户头像
	Gender    *int    `json:"gender" validate:"omitempty,number" comment:"微信性别"`         // 性别
	Country   *string `json:"country" validate:"omitempty" comment:"微信信息国家"`             // 国家
	Province  *string `json:"province" validate:"omitempty" comment:"微信信息省份"`            // 省份
	City      *string `json:"city" validate:"omitempty" comment:"微信信息城市"`                // 城市
	Language  *string `json:"language" validate:"omitempty" comment:"微信信息语言"`            // 语言
}

绑定的微信信息帐号相关

Jump to

Keyboard shortcuts

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