service

package
v0.0.0-...-6ea431b Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCodeSendTooMany = repository.ErrCodeSendTooMany
View Source
var ErrInvalidUserOrPassword = errors.New("邮箱或者密码不正确")
View Source
var ErrUserDuplicateEmail = repository.ErrUserDuplicate

Functions

This section is empty.

Types

type ArticleService

type ArticleService interface {
	Save(ctx context.Context, art domain.Article) (int64, error)
	Withdraw(ctx context.Context, art domain.Article) error
	Publish(ctx context.Context, art domain.Article) (int64, error)
	PublishV1(ctx context.Context, art domain.Article) (int64, error)
	List(ctx context.Context, uid int64, offset int, limit int) ([]domain.Article, error)
	GetById(ctx context.Context, id int64) (domain.Article, error)
	GetPublishedById(ctx context.Context, id, uid int64) (domain.Article, error)
}

func NewArticleService

func NewArticleService(repo article.ArticleRepository,
	l logger.LoggerV1,
	producer events.Producer) ArticleService

type CodeService

type CodeService interface {
	Send(ctx context.Context, biz string, phone string) error
	Verify(ctx context.Context, biz string, phone string, inputCode string) (bool, error)
}

func NewSMSCodeService

func NewSMSCodeService(svc sms.Service, repo repository.CodeRepository) CodeService

type InteractiveService

type InteractiveService interface {
	IncrReadCnt(ctx context.Context, biz string, bizId int64) error
	// Like 点赞
	Like(ctx context.Context, biz string, bizId int64, uid int64) error
	// CancelLike 取消点赞
	CancelLike(ctx context.Context, biz string, bizId int64, uid int64) error
	// Collect 收藏, cid 是收藏夹的 ID
	// cid 不一定有,或者说 0 对应的是该用户的默认收藏夹
	Collect(ctx context.Context, biz string, bizId, cid, uid int64) error
	Get(ctx context.Context, biz string, bizId, uid int64) (domain.Interactive, error)
}

type SMSCodeService

type SMSCodeService struct {
	// contains filtered or unexported fields
}

SMSCodeService 短信验证码的实现

func (*SMSCodeService) Send

func (c *SMSCodeService) Send(ctx context.Context, biz string, phone string) error

Send 生成一个随机验证码,并发送

func (*SMSCodeService) Verify

func (c *SMSCodeService) Verify(ctx context.Context,
	biz string,
	phone string,
	inputCode string) (bool, error)

Verify 验证验证码

type UserService

type UserService interface {
	Login(ctx context.Context, email, password string) (domain.User, error)
	Signup(ctx context.Context, u domain.User) error
	FindOrCreate(ctx context.Context, phone string) (domain.User, error)
	FindOrCreateByWechat(ctx context.Context, wechatInfo domain.WechatInfo) (domain.User, error)
	Profile(ctx context.Context, id int64) (domain.User, error)
	// UpdateNonSensitiveInfo 更新非敏感数据
	// 你可以在这里进一步补充究竟哪些数据会被更新
	UpdateNonSensitiveInfo(ctx context.Context, user domain.User) error
}

func NewUserServiceV1

func NewUserServiceV1(repo repository.UserRepository, l *zap.Logger) UserService

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.
oauth2
wechat/mocks
Code generated by MockGen.
Code generated by MockGen.
sms
cloopen
Package cloopen 容联云短信的实现 SDK文档:https://doc.yuntongxun.com/pe/5f029a06a80948a1006e7760
Package cloopen 容联云短信的实现 SDK文档:https://doc.yuntongxun.com/pe/5f029a06a80948a1006e7760
mocks
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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