refactor all service dependency injection
This commit is contained in:
@@ -5,8 +5,10 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"bsm/full/module/ec/market/internal/impl"
|
||||
"bsm/full/module/ec/market/internal/models"
|
||||
pb "bsm/full/module/ec/market/pb"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/crypto/encipher"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/utils"
|
||||
@@ -21,7 +23,7 @@ func Login(ctx context.Context, in *pb.LoginRequest) (reply *pb.LoginReply, err
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
err = models.DBService.Where("account=? and id<>0", in.Account).First(&marketData).Error
|
||||
err = impl.DBService.Where("account=? and id<>0", in.Account).First(&marketData).Error
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errcode.ErrAccountNotFound
|
||||
@@ -55,7 +57,7 @@ func Login(ctx context.Context, in *pb.LoginRequest) (reply *pb.LoginReply, err
|
||||
|
||||
// 更新登录时间
|
||||
marketData.LastLoginAt = time.Now()
|
||||
err = models.DBService.Debug().Where("id = ?", marketData.ID).Select("last_login_at").Updates(marketData).Error
|
||||
err = impl.DBService.Debug().Where("id = ?", marketData.ID).Select("last_login_at").Updates(marketData).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user