|  | @@ -26,11 +26,12 @@ const (
 | 
	
		
			
				|  |  |  	CurrentUserName = "userName"
 | 
	
		
			
				|  |  |  	CurrentFarmId   = "FarmId"
 | 
	
		
			
				|  |  |  	LanguageContent = "languageContent"
 | 
	
		
			
				|  |  | +	Language        = "language"
 | 
	
		
			
				|  |  |  )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // Login 用户登录
 | 
	
		
			
				|  |  |  func (s *StoreEntry) Login(ctx context.Context, req *pasturePb.SearchUserRequest) (*pasturePb.SystemUserResponse, error) {
 | 
	
		
			
				|  |  | -	language, err := s.GetCurrentUserLanguage(ctx)
 | 
	
		
			
				|  |  | +	i18nTemplate, err := s.GetI18nTemplate(ctx)
 | 
	
		
			
				|  |  |  	if err != nil {
 | 
	
		
			
				|  |  |  		return nil, xerr.WithStack(err)
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -39,7 +40,7 @@ func (s *StoreEntry) Login(ctx context.Context, req *pasturePb.SearchUserRequest
 | 
	
		
			
				|  |  |  		Where("name = ?", req.Name).
 | 
	
		
			
				|  |  |  		First(systemUser).Error; err != nil {
 | 
	
		
			
				|  |  |  		if errors.Is(err, gorm.ErrRecordNotFound) {
 | 
	
		
			
				|  |  | -			messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +			messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  				MessageID: "auth.noUser",
 | 
	
		
			
				|  |  |  			})
 | 
	
		
			
				|  |  |  			return nil, xerr.Customf(messageId)
 | 
	
	
		
			
				|  | @@ -49,28 +50,28 @@ func (s *StoreEntry) Login(ctx context.Context, req *pasturePb.SearchUserRequest
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if systemUser.Password != req.Password {
 | 
	
		
			
				|  |  | -		messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +		messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  			MessageID: "auth.wrongPassword",
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		return nil, xerr.Customf(messageId)
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if systemUser.IsShow == pasturePb.IsShow_No {
 | 
	
		
			
				|  |  | -		messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +		messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  			MessageID: "auth.userDisable",
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		return nil, xerr.Customf(messageId)
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if systemUser.IsDelete == pasturePb.IsShow_No {
 | 
	
		
			
				|  |  | -		messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +		messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  			MessageID: "auth.userDelete",
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		return nil, xerr.Customf(messageId)
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if len(systemUser.PastureIds) <= 0 {
 | 
	
		
			
				|  |  | -		messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +		messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  			MessageID: "auth.unPasture",
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		return nil, xerr.Custom(messageId)
 | 
	
	
		
			
				|  | @@ -82,7 +83,7 @@ func (s *StoreEntry) Login(ctx context.Context, req *pasturePb.SearchUserRequest
 | 
	
		
			
				|  |  |  		return nil, xerr.WithStack(err)
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	if token == "" {
 | 
	
		
			
				|  |  | -		messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +		messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  			MessageID: "auth.errorToken",
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		return nil, xerr.Custom(messageId)
 | 
	
	
		
			
				|  | @@ -91,7 +92,7 @@ func (s *StoreEntry) Login(ctx context.Context, req *pasturePb.SearchUserRequest
 | 
	
		
			
				|  |  |  	expires := time.Now().Local().Add(time.Duration(s.Cfg.JwtExpireTime) * time.Second).Format(util.LayoutTime)
 | 
	
		
			
				|  |  |  	farmList, err := s.FindPastureListByIds(ctx, systemUser.GetPastureIds())
 | 
	
		
			
				|  |  |  	if err != nil || len(farmList) == 0 {
 | 
	
		
			
				|  |  | -		messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +		messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  			MessageID: "auth.errorPasture",
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		return nil, xerr.Custom(messageId)
 | 
	
	
		
			
				|  | @@ -449,7 +450,7 @@ func (s *StoreEntry) GetSystemUserMenu(ctx context.Context) (*pasturePb.SystemUs
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // ResetPasswordSystemUser 重置系统用户密码
 | 
	
		
			
				|  |  |  func (s *StoreEntry) ResetPasswordSystemUser(ctx context.Context, req *pasturePb.ResetUserPasswordRequest) error {
 | 
	
		
			
				|  |  | -	language, err := s.GetCurrentUserLanguage(ctx)
 | 
	
		
			
				|  |  | +	i18nTemplate, err := s.GetI18nTemplate(ctx)
 | 
	
		
			
				|  |  |  	if err != nil {
 | 
	
		
			
				|  |  |  		return xerr.WithStack(err)
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -458,7 +459,7 @@ func (s *StoreEntry) ResetPasswordSystemUser(ctx context.Context, req *pasturePb
 | 
	
		
			
				|  |  |  		Where("id = ?", req.Id).
 | 
	
		
			
				|  |  |  		First(systemUser).Error; err != nil {
 | 
	
		
			
				|  |  |  		if errors.Is(err, gorm.ErrRecordNotFound) {
 | 
	
		
			
				|  |  | -			messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +			messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  				MessageID: "auth.noUser",
 | 
	
		
			
				|  |  |  			})
 | 
	
		
			
				|  |  |  			return xerr.Custom(messageId)
 | 
	
	
		
			
				|  | @@ -466,7 +467,7 @@ func (s *StoreEntry) ResetPasswordSystemUser(ctx context.Context, req *pasturePb
 | 
	
		
			
				|  |  |  		return xerr.WithStack(err)
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	if err := s.DB.Model(systemUser).
 | 
	
		
			
				|  |  | +	if err = s.DB.Model(systemUser).
 | 
	
		
			
				|  |  |  		Update("password", req.Password).Error; err != nil {
 | 
	
		
			
				|  |  |  		return xerr.WithStack(err)
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -614,11 +615,11 @@ func (s *StoreEntry) SystemUserRoleSave(ctx context.Context, req *pasturePb.Syst
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func (s *StoreEntry) GetMenusWithParents(ctx context.Context, pastureId int64, menuIds []int64) ([]*model.SystemMenu, error) {
 | 
	
		
			
				|  |  |  	if len(menuIds) <= 0 {
 | 
	
		
			
				|  |  | -		language, err := s.GetCurrentUserLanguage(ctx)
 | 
	
		
			
				|  |  | +		i18nTemplate, err := s.GetI18nTemplate(ctx)
 | 
	
		
			
				|  |  |  		if err != nil {
 | 
	
		
			
				|  |  |  			return nil, xerr.Customf("菜单id不能为空")
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		messageId, _ := language.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  | +		messageId, _ := i18nTemplate.Localize(&i18n.LocalizeConfig{
 | 
	
		
			
				|  |  |  			MessageID: "auth.menuIdNotEmpty",
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		return nil, xerr.Customf(messageId)
 |