fix version 1
This commit is contained in:
@@ -2,12 +2,15 @@ package basic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"bsm/full/module/social/group/internal/impl"
|
||||
"bsm/full/module/social/group/internal/models"
|
||||
pb "bsm/full/module/social/group/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// 获取群组信息
|
||||
@@ -17,10 +20,17 @@ func Get(ctx context.Context, in *pb.IdentRequest) (reply *pb.GroupItem, err err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = impl.DBService.Where("identity=?", in.Identity).First(&reply).Error
|
||||
if err != nil {
|
||||
if in.GetIdentity() == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
var group models.GroupBasic
|
||||
if err = impl.DBService.Where("identity=?", in.Identity).First(&group).Error; err != nil {
|
||||
printer.Error(err.Error())
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errcode.ErrRecordNotFound
|
||||
}
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
return &pb.GroupItem{}, nil
|
||||
return models.ToGroupItem(&group), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user