user

package
v0.0.0-...-7a73484 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

*

  • @Author: Gosin
  • @Date: 2019/12/12 15:38

Index

Constants

View Source
const (
	LoginType_captcha = 1 // 验证码登录
	LoginType_pwd     = 2 // 密码登录

	SESSION_EXPIRE int64 = 2592000 // 过期时间暂定30天

	CHANNEL_unknown            = 0 // 未知
	CHANNEL_pc                 = 1 // pc的Saas系统
	CHANNEL_900sui_app         = 2 // 900岁app
	CHANNEL_kangxiangbao_app   = 3 // 康享宝app
	CHANNEL_900sui_wap         = 4 // 900岁wap
	CHANNEL_kadidou_wxapp      = 5 // 卡D兜小程序
	CHANNEL_kadidou_wxofficial = 6 // 微信公众号

	DEVICE_unknown  = 0 // 未知
	DEVICE_pc       = 1 // pc
	DEVICE_android  = 2 // android
	DEVICE_ios      = 3 // ios
	DEVICE_winphone = 4 // winphone
	DEVICE_mac      = 5 // mac

	//#登录场景
	//普通登录
	LOGIN_scene_normal = 0
	//主体登录
	LOGIN_scene_bus = 1
	//分店登录
	LOGIN_scene_shop = 2
)
View Source
const (
	//性别
	SEX_unknow = 0
	SEX_male   = 1
	SEX_female = 2

	//实名认证
	REAL_NAME_AUTH_no  = 0
	REAL_NAME_AUTH_yes = 1
)

Variables

This section is empty.

Functions

func GetChannel

func GetChannel() []int

渠道数组

func GetDevices

func GetDevices() []int

设备数组

func GetLoginScene

func GetLoginScene() []int

登录场景数组

func VerifyChannel

func VerifyChannel(channel Channel) error

验证渠道

func VerifyDevice

func VerifyDevice(device Device) error

验证设备

Types

type ArgsGetUserInfoByNick

type ArgsGetUserInfoByNick struct {
	Nick string
}

ArgsGetUserInfoByNick ArgsGetUserInfoByNick

type ArgsGetUserInfoByPhone

type ArgsGetUserInfoByPhone struct {
	Phone string
}

================后台接口================ ArgsGetUserInfoByPhone ArgsGetUserInfoByPhone

type ArgsGetWxOpenid

type ArgsGetWxOpenid struct {
	Appid string //微信应用的appid
	Code  string //微信返回的用于获取openid的临时code
}

获取用户微信openid接口入参

type ArgsIdentity

type ArgsIdentity struct {
	common.Utoken        //用户登录信息
	RealName      string //真实姓名
	CardNo        string //身份证号
	Uid           int    //rpc内部校验
}

实名认证入参

type ArgsLoginOut

type ArgsLoginOut struct {
	common.Utoken
	Channel
	Token string //登录字符串
}

type ArgsMemberList

type ArgsMemberList struct {
	common.Paging
	Nick       string // 用户名
	Phone      string // 手机号
	Type       string // 用户类型
	Status     string // 用户状态
	CtimeStart int64  // 注册开始时间
	CtimeEnd   int64  // 注册结束时间
}

会员列表入参

type ArgsUpdateMemberStatus

type ArgsUpdateMemberStatus struct {
	Uid    int
	Status int // 会员状态:开启/禁用
}

ArgsUpdateMemberStatus 更新会员状态入参

type ArgsUpdateUserinfoByUid

type ArgsUpdateUserinfoByUid struct {
	Uid           int    // uid 必须
	Nick          string // 用户昵称
	AvatarImgHash string // 图片hash
	Sex           int    // 性别 0=未定义  1=女 2=男
}

type ArgsUpdateUserinfoByUtoken

type ArgsUpdateUserinfoByUtoken struct {
	Utoken        common.Utoken //用户登录token
	Nick          string        // 用户昵称
	AvatarImgHash string        // 图片hash
	Sex           int           // 性别 0=未定义  1=女 2=男

}

type ArgsUserQrcode

type ArgsUserQrcode struct {
	common.Utoken
}

type ArgsWxBind

type ArgsWxBind struct {
	OpenHash string // 未绑定会员时的临时验证
	LoginParams
}

type ArgsWxLogin

type ArgsWxLogin struct {
	Appid string
	Code  string
	Channel
	Ip string
}

type ArgsWxMappLogin

type ArgsWxMappLogin struct {
	Appid         string //小程序id
	Code          string //小程序临时code
	Channel              //渠道id
	Device               //设备
	Ip            string //客户端ip
	Iv            string //手机号解密iv 非必传
	EncryptedData string //手机号加密数据 非必传
}

微信小程序登录

type Channel

type Channel = int // 注册渠道  0=未知, 1=pc网站 2=900岁app 3=康享宝app 4=900岁wap版,5=卡D兜小程序

type CheckLoginParams

type CheckLoginParams struct {
	Channel
	Token string // 登录token
}

验证登录参数

type CheckLoginReply

type CheckLoginReply struct {
	UidEncodeStr string //加密后的uid
	Nick         string // 用户昵称
	RealNameAuth int    // 是否实名认证
}

验证登录返回数据

type Device

type Device = int // 注册设备  0=未知  1=PC 2=Android 3=Ios 4=WinPhone  5=Mac

type FindPwdParams

type FindPwdParams struct {
	Phone    string // 手机号
	Captcha  string // 短信验证码
	Password string // 新密码
}

忘记密码参数

type FindPwdReply

type FindPwdReply struct {
	Ok bool // 修改状态
}

忘记密码返回数据

type LoginParams

type LoginParams struct {
	Phone      string
	LoginScene int    // 登录场景 0 =普通登录 1=saas总部(主体) 2=分店登录
	LoginType  int    // 登录方式 1=短信验证码登录(常量 LoginType_captcha) 2=密码登录(常量 LoginType_pwd)
	Captcha    string // 短信验证码
	Password   string // 密码
	Channel
	Device
	Ip string // 客户端ip
}

登录参数

type LoginReply

type LoginReply struct {
	Uid   int    // 用户id
	Token string // 登录token
}

登录返回数据

type MemberListBase

type MemberListBase struct {
	Uid            int     // 用户UID
	Nick           string  // 用户名
	Phone          string  // 手机号
	Name           string  // 真实姓名
	Email          string  // 邮箱
	Type           int     // 用户类型
	AccountBalance float64 // 帐户余额
	CardNo         string  // 身份证号码
	Ctime          int64   // 注册时间
	CtimeStr       string  // 注册时间字符串
	Ip             string  // 注册IP
}

type RegFast

type RegFast struct {
	Phone string // 手机
	Channel
	Device
}

快速注册

type RegParams

type RegParams struct {
	Phone    string // 手机
	Captcha  string // 短信验证码
	Password string // 密码
	Channel
	Device
}

注册所需参数

type RegReply

type RegReply struct {
	Uid int // 用户id
}

注册返回数据

type ReplyBaseUserinfo

type ReplyBaseUserinfo struct {
	Uid         int    // uid
	Nick        string // 用户昵称
	AvatarImgId int    // 图片id
	Sex         int    // 性别 0=未定义  1=女 2=男
}

用户基础信息

type ReplyGetUserInfoByPhone

type ReplyGetUserInfoByPhone struct {
	Phone string
	Uid   int
}

ReplyGetUserInfoByPhone ReplyGetUserInfoByPhone

type ReplyGetWxOpenid

type ReplyGetWxOpenid struct {
	Openid string
}

获取用户微信openid接口返回数据

type ReplyMemberInfo

type ReplyMemberInfo struct {
	Uid            int
	Nick           string  // 用户名
	Phone          string  // 手机号
	Email          string  // 邮箱
	Name           string  // 真实姓名
	Type           int     // 会员/用户类型
	Address        string  // 详细地址
	QqNo           string  // qq帐号
	CardNo         string  // 身份证号
	Sex            int     // 性别 0=未定义  1=女 2=男
	IsRealNameAuth int     // 实名认证 0=未认证  1=已认证
	AccountBalance float64 // 帐户余额
}

会员详情出参

type ReplyMemberList

type ReplyMemberList struct {
	TotalNum int
	List     []MemberListBase
}

会员列表出参

type ReplyUserAccountInfo

type ReplyUserAccountInfo struct {
	Uid   int
	Phone string
}

ReplyUserAccountInfo ReplyUserAccountInfo

type ReplyUserAuthInfo

type ReplyUserAuthInfo struct {
	Uid          int
	Name         string // 真实姓名
	CardNo       string // 身份证号码
	CardNoExpire string //身份证过期日期、格式:2037-10-01
	FaceData     string // 人脸图片base64编码数据
	Similarity   int    // 人脸相识度 1-100 值越高越准确
	Ctime        int64  // 认证时间
	CtimeStr     string
}

type ReplyUserInfo

type ReplyUserInfo struct {
	Uid         int
	Nick        string //昵称
	Name        string //真实姓名
	Phone       string
	AvatarImgId int
	Sex         int
}

type ReplyUserQrcode

type ReplyUserQrcode struct {
	QrcodeStr string //二维码信息
}

type ReplyUserinfo

type ReplyUserinfo struct {
	Uid            int    // uid
	Nick           string // 用户昵称
	AvatarImgId    int    // 图片id
	AvatarUrl      string //头像地址
	Sex            int    // 性别 0=未定义  1=女 2=男
	IsRealNameAuth int    // 实名认证 0=未认证  1=已认证
	Name           string // 真实姓名
	Phone          string //手机号
	PreLoginTime   int    //上次登录时间
	Ctime          int64  // 注册时间
}

type ReplyWxLogin

type ReplyWxLogin struct {
	OpenHash   string // 未绑定会员时的临时验证
	OpenId     string // 用户openId
	LoginReply        // 登录成功返回数据
}

type ReplyWxMappLogin

type ReplyWxMappLogin struct {
	OpenId        string // 用户openId
	Token         string // 登录token
	ReplyUserinfo        //用户信息
}

微信小程序登录返回

type Session

type Session struct {
	Uid        int    // 用户uid
	LoginTime  int64  // 第一次登录时间
	Refresh    int64  // 刷新时间
	ExpireTime int64  // session过期时间
	Ip         string // 客户端ip
	Device
}

用户登录Session

type UserAccount

type UserAccount interface {
	// UserAccountInfo 根据uid获取用户帐号信息
	GetUserAccountInfo(ctx context.Context, uid *int, reply *ReplyUserAccountInfo) error
}

type UserAuth

type UserAuth interface {
	// GetUserAuthInfoByUid 根据uid获取用户认证信息
	GetUserAuthInfoByUid(ctx context.Context, uid *int, reply *ReplyUserAuthInfo) error
}

type UserLogin

type UserLogin interface {
	// 注册
	Reg(ctx context.Context, args *RegParams, reply *RegReply) error
	// 登录
	Login(ctx context.Context, args *LoginParams, reply *LoginReply) error
	// 验证登录
	CheckLogin(ctx context.Context, args *CheckLoginParams, reply *CheckLoginReply) error
	// 找回密码
	FindPwd(ctx context.Context, args *FindPwdParams, reply *FindPwdReply) error
	// 微信登录
	WxLogin(ctx context.Context, args *ArgsWxLogin, reply *ReplyWxLogin) error
	// 微信登录绑定账号
	WxBind(ctx context.Context, args *ArgsWxBind, reply *LoginReply) error
	//快速注册(已注册则返回用户UID)
	FastReg(ctx context.Context, args *RegFast, reply *RegReply) error
	//退出登录
	LoginOut(ctx context.Context, args *ArgsLoginOut, reply *bool) error
	//获取用户的微信openid
	GetWxOpenid(ctx context.Context, args *ArgsGetWxOpenid, reply *ReplyGetWxOpenid) error
	//微信小程序登录
	WxMappLogin(ctx context.Context, args *ArgsWxMappLogin, reply *ReplyWxMappLogin) error
}

type Userinfo

type Userinfo interface {
	// 根据uid获取用户单条详细数据
	GetUserinfoByUid(ctx context.Context, uid *int, reply *ReplyUserinfo) error
	// 根据uids获取用户基础数据
	GetBaseUserinfoByUids(ctx context.Context, uids *[]int, reply *[]ReplyBaseUserinfo) error
	// 修改用户信息
	UpdateUserinfoByUid(ctx context.Context, args *ArgsUpdateUserinfoByUid, reply *bool) error
	//更具登录信息获取用户单条详细数据
	GetUserinfoByUtoken(ctx context.Context, utoken *common.Utoken, reply *ReplyUserinfo) error
	// 修改当前登录用户的信息
	UpdateUserinfoByUtoken(ctx context.Context, args *ArgsUpdateUserinfoByUtoken, reply *bool) error
	// 根据用户手机号获取用户信息
	GetUserInfoByPhone(ctx context.Context, args *ArgsGetUserInfoByPhone, reply *ReplyGetUserInfoByPhone) error
	// 根据nick获取用户信息
	GetUserInfoByNick(ctx context.Context, args *ArgsGetUserInfoByNick, reply *[]ReplyBaseUserinfo) error
	// 会员列表
	GetMemberList(ctx context.Context, args *ArgsMemberList, reply *ReplyMemberList) error
	// 会员详情
	GetMemberInfo(ctx context.Context, uid *int, reply *ReplyMemberInfo) error
	// 更改会员状态
	UpdateMemberStatus(ctx context.Context, args *ArgsUpdateMemberStatus, reply *bool) error
	//根据多个用户id查询用户信息-rpc
	GetUserInfosByUids(ctx context.Context, uids *[]int, reply *[]ReplyUserInfo) error
}

Jump to

Keyboard shortcuts

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