正在显示
4 个修改的文件
包含
16 行增加
和
2 行删除
| @@ -31,6 +31,11 @@ func (service UsersService) UserLoginBySecretKey(cmd command.LoginBySecretKeyCom | @@ -31,6 +31,11 @@ func (service UsersService) UserLoginBySecretKey(cmd command.LoginBySecretKeyCom | ||
| 31 | e := fmt.Sprintf("通过密钥(code=%s)从统一用户中心获取数据失败:%s", cmd.Code, err.Error()) | 31 | e := fmt.Sprintf("通过密钥(code=%s)从统一用户中心获取数据失败:%s", cmd.Code, err.Error()) |
| 32 | return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e) | 32 | return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e) |
| 33 | } | 33 | } |
| 34 | + err = loginResp.IsOK() | ||
| 35 | + if err != nil { | ||
| 36 | + e := fmt.Sprintf("登录失败:%s", err) | ||
| 37 | + return nil, lib.ThrowError(lib.BUSINESS_ERROR, e) | ||
| 38 | + } | ||
| 34 | var ( | 39 | var ( |
| 35 | transactionContext, _ = factory.CreateTransactionContext(nil) | 40 | transactionContext, _ = factory.CreateTransactionContext(nil) |
| 36 | ) | 41 | ) |
| 1 | package repository | 1 | package repository |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "errors" | ||
| 4 | "fmt" | 5 | "fmt" |
| 5 | 6 | ||
| 6 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" |
| @@ -89,12 +90,21 @@ func (reponsitory CompanyRepository) FindOne(queryOptions domain.CompanyFindOneO | @@ -89,12 +90,21 @@ func (reponsitory CompanyRepository) FindOne(queryOptions domain.CompanyFindOneO | ||
| 89 | err error | 90 | err error |
| 90 | tx = reponsitory.transactionContext.PgTx | 91 | tx = reponsitory.transactionContext.PgTx |
| 91 | m models.Company | 92 | m models.Company |
| 93 | + hasCondition bool | ||
| 92 | ) | 94 | ) |
| 93 | 95 | ||
| 94 | query := tx.Model(&m) | 96 | query := tx.Model(&m) |
| 95 | if queryOptions.Id > 0 { | 97 | if queryOptions.Id > 0 { |
| 98 | + hasCondition = true | ||
| 96 | query = query.Where("id=?", queryOptions.Id) | 99 | query = query.Where("id=?", queryOptions.Id) |
| 97 | } | 100 | } |
| 101 | + if queryOptions.AdminCompanyId > 0 { | ||
| 102 | + hasCondition = true | ||
| 103 | + query = query.Where("admin_company_id=?", queryOptions.Id) | ||
| 104 | + } | ||
| 105 | + if !hasCondition { | ||
| 106 | + return domain.Company{}, errors.New("findOne 必须要有查询条件") | ||
| 107 | + } | ||
| 98 | err = query.First() | 108 | err = query.First() |
| 99 | if err != nil { | 109 | if err != nil { |
| 100 | return domain.Company{}, err | 110 | return domain.Company{}, err |
| @@ -102,7 +102,6 @@ func (gateway MmmUserCenterServiceGateway) RequestUCenterLoginBySecret(secret st | @@ -102,7 +102,6 @@ func (gateway MmmUserCenterServiceGateway) RequestUCenterLoginBySecret(secret st | ||
| 102 | if err != nil { | 102 | if err != nil { |
| 103 | return nil, err | 103 | return nil, err |
| 104 | } | 104 | } |
| 105 | - | ||
| 106 | respData := &ResponseLogin{} | 105 | respData := &ResponseLogin{} |
| 107 | err = json.Unmarshal(byteData, respData) | 106 | err = json.Unmarshal(byteData, respData) |
| 108 | if err != nil { | 107 | if err != nil { |
-
请 注册 或 登录 后发表评论