feat: import services and standardize Go 1.26.5
This commit is contained in:
34
apps/ec/mall/internal/logic/store/get_email.go
Normal file
34
apps/ec/mall/internal/logic/store/get_email.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.apinb.com/bsm-ec/mall/internal/impl"
|
||||
"git.apinb.com/bsm-ec/mall/internal/models"
|
||||
pb "git.apinb.com/bsm-ec/mall/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
)
|
||||
|
||||
// 获取邮件服务器配置
|
||||
func GetEmail(ctx context.Context, in *pb.IdentRequest) (reply *pb.ConfigsReply, err error) {
|
||||
_, err = service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if in.Id == 0 && in.Identity == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
sotre := models.MallStore{}
|
||||
if err := impl.DBService.Model(&models.MallStore{}).Select("mail_configs").Where("id=? or identity=?", in.GetId(), in.GetIdentity()).Find(&sotre).Error; err != nil {
|
||||
print(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.ConfigsReply{
|
||||
Configs: sotre.MailConfigs,
|
||||
}, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user