service

package
v0.0.0-...-db099c4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 最大消息id
	MaxMsgID = 0xffffffffffff

	// 基础消息类型 1~50
	MsgTypeText  int = 1 //文本消息
	MsgTypePic   int = 2 //图片消息
	MsgTypeVoice int = 3 //语音消息
	MsgTypeVideo int = 4 //视频消息

	// 系统消息类型 51~100
	MsgTypeNoticeText int = 51 // 文字通知

	// 业务消息类型 101+
	MsgTypeArticleCard int = 101 // 文章卡片消息

	// 接收类型
	ReceiveTypeBoth = 0 // 双方接收
	ReceiveTypePeer = 1 // 仅对方接收
	ReceiveTypeSelf = 2 // 仅自己接收
)

Variables

View Source
var ImSvc = NewIMService()

直接初始化,可以避免在使用时再实例化

View Source
var ServiceSms = NewSmsService()

ServiceSms 短信服务 使用七牛云 直接初始化,可以避免在使用时再实例化

View Source
var UserSvc = NewUserService()
View Source
var VCodeService = NewVCodeService()

VCodeService 验证码服务,主要提供生成验证码和获取验证码 直接初始化,可以避免在使用时再实例化

Functions

This section is empty.

Types

type ChatResp

type ChatResp struct {
	Chat     *model.ChatModel
	UserChat *model.UserChatModel
}

type IMService

type IMService interface {
	// chat
	FindChat(userId uint64, YUserId uint64, isCreate bool) (*ChatResp, error)

	// msg
	SendMsg(input model.SendMsgInput) (*model.MsgModel, error)
	GetMsgListByMsgIds(msgIds []uint64) (map[uint64]*model.MsgModel, error)
	GetNewMsgNumData(userId uint64) (*newMsgNumStat, error)
	GetChatMsgListByChatId(chatId uint64, lastCMId uint64, limit int) ([]*model.ChatMsgModel, error)

	// user chat
	GetUserChatList(userId uint64, lastMId uint64, limit int) ([]*model.UserChatModel, error)
}

func NewIMService

func NewIMService() IMService

type ISmsService

type ISmsService interface {
	Send(phoneNumber string, verifyCode int) error
	// contains filtered or unexported methods
}

ISmsService 短信服务接口定义

func NewSmsService

func NewSmsService() ISmsService

NewSmsService 实例化一个sms

type IVerifyCodeService

type IVerifyCodeService interface {
	// public func
	GenLoginVCode(phone string) (int, error)
	CheckLoginVCode(phone int64, vCode int) bool
	GetLoginVCode(phone int64) (int, error)
	// contains filtered or unexported methods
}

IVerifyCodeService 校验码服务接口定义

func NewVCodeService

func NewVCodeService() IVerifyCodeService

NewVCodeService 实例化一个验证码服务

type UserService

type UserService interface {
	CreateUser(user model.UserBaseModel) (id uint64, err error)
	GetUserById(id uint64) (*model.UserBaseModel, error)
	BatchGetUserListByIds(id []uint64) (map[uint64]*model.UserBaseModel, error)
	PhoneLogin(ctx context.Context, phone int64, verifyCode int) (tokenStr string, err error)
}

func NewUserService

func NewUserService() UserService

Jump to

Keyboard shortcuts

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