作者 yangfu

扫码登录修改

@@ -115,7 +115,7 @@ func (svr AuthService) AuthLoginQrcode(queryParam *query.QrcodeLoginStatusQuery) @@ -115,7 +115,7 @@ func (svr AuthService) AuthLoginQrcode(queryParam *query.QrcodeLoginStatusQuery)
115 qrcodeMessage, err := cache.Get(queryParam.Key) 115 qrcodeMessage, err := cache.Get(queryParam.Key)
116 if err != nil { 116 if err != nil {
117 log.Logger.Error(err.Error()) 117 log.Logger.Error(err.Error())
118 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "二维码已失效") 118 + return nil, application.ThrowError(application.BUSINESS_ERROR, "二维码已失效")
119 } 119 }
120 if !qrcodeMessage.IsLogin { 120 if !qrcodeMessage.IsLogin {
121 return failLoginData, nil 121 return failLoginData, nil
@@ -132,7 +132,7 @@ func (svr AuthService) AuthLoginQrcode(queryParam *query.QrcodeLoginStatusQuery) @@ -132,7 +132,7 @@ func (svr AuthService) AuthLoginQrcode(queryParam *query.QrcodeLoginStatusQuery)
132 cache.Remove(queryParam.Key) 132 cache.Remove(queryParam.Key)
133 result, err := svr.getToken(loginToken) 133 result, err := svr.getToken(loginToken)
134 if err != nil { 134 if err != nil {
135 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 135 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
136 } 136 }
137 137
138 data := map[string]interface{}{ 138 data := map[string]interface{}{
@@ -147,14 +147,14 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC @@ -147,14 +147,14 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC
147 qrCache := cache.LoginQrcodeCache{} 147 qrCache := cache.LoginQrcodeCache{}
148 qrcodeMessage, err := qrCache.Get(bindingCmd.Key) 148 qrcodeMessage, err := qrCache.Get(bindingCmd.Key)
149 if err != nil { 149 if err != nil {
150 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "您扫描的二维码无效,请确认后重新扫描") 150 + return nil, application.ThrowError(application.BUSINESS_ERROR, "您扫描的二维码无效,请确认后重新扫描")
151 } 151 }
152 if err := qrcodeMessage.BindUser(bindingCmd.Operator); err != nil { 152 if err := qrcodeMessage.BindUser(bindingCmd.Operator); err != nil {
153 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 153 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
154 } 154 }
155 if err := qrCache.Save(*qrcodeMessage); err != nil { 155 if err := qrCache.Save(*qrcodeMessage); err != nil {
156 log.Logger.Error(err.Error()) 156 log.Logger.Error(err.Error())
157 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "登录失败,请重试") 157 + return nil, application.ThrowError(application.BUSINESS_ERROR, "登录失败,请重试")
158 } 158 }
159 return struct{}{}, nil 159 return struct{}{}, nil
160 } 160 }
@@ -170,13 +170,13 @@ func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand @@ -170,13 +170,13 @@ func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand
170 Account: smsCodeCommand.Phone, 170 Account: smsCodeCommand.Phone,
171 }) 171 })
172 if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone { 172 if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone {
173 - return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入") 173 + return application.ThrowError(application.BUSINESS_ERROR, "输入的手机号不是平台用户,请重新输入")
174 } 174 }
175 } 175 }
176 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() 176 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
177 err := smsServeGateway.SendSms(smsCodeCommand.Phone) 177 err := smsServeGateway.SendSms(smsCodeCommand.Phone)
178 if err != nil { 178 if err != nil {
179 - return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 179 + return application.ThrowError(application.BUSINESS_ERROR, err.Error())
180 } 180 }
181 return nil 181 return nil
182 } 182 }
@@ -708,7 +708,7 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs @@ -708,7 +708,7 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs
708 //GetQrcode 获取扫码登录需要的二维码 708 //GetQrcode 获取扫码登录需要的二维码
709 func (svr AuthService) GetQrcode() (interface{}, error) { 709 func (svr AuthService) GetQrcode() (interface{}, error) {
710 qrcodeMessage := domain.QrcodeMessage{} 710 qrcodeMessage := domain.QrcodeMessage{}
711 - _, err := qrcodeMessage.Init() //imgBase64 711 + _, err := qrcodeMessage.Init()
712 if err != nil { 712 if err != nil {
713 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 713 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
714 } 714 }
@@ -182,17 +182,17 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -182,17 +182,17 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
182 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) 182 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
183 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ 183 result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
184 Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize, 184 Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize,
185 - Limit: companyUserListQuery.PageSize,  
186 - CompanyId: companyUserListQuery.Operator.CompanyId,  
187 - OrganizationId: 0,  
188 - DepartmentId: 0,  
189 - UserName: companyUserListQuery.UserName,  
190 - DepName: companyUserListQuery.DepartmentName,  
191 - Phone: "",  
192 - UserType: domain.UserTypeEmployee,  
193 - InOrgIds: companyUserListQuery.Operator.OrgIds,  
194 - PullRealTime: true,  
195 - AdvancedQueries: domain.AdvancedQuerySql(domain.UserModel{}.ModelName(), companyUserListQuery.AdvancedQueries), 185 + Limit: companyUserListQuery.PageSize,
  186 + CompanyId: companyUserListQuery.Operator.CompanyId,
  187 + OrganizationId: 0,
  188 + DepartmentId: 0,
  189 + UserName: companyUserListQuery.UserName,
  190 + DepName: companyUserListQuery.DepartmentName,
  191 + Phone: "",
  192 + UserType: domain.UserTypeEmployee,
  193 + InOrgIds: companyUserListQuery.Operator.OrgIds,
  194 + PullRealTime: true,
  195 + AdvancedQuery: domain.AdvancedQuerySql(domain.UserModel{}.ModelName(), companyUserListQuery.AdvancedQueries),
196 }) 196 })
197 197
198 if err != nil { 198 if err != nil {
@@ -11,13 +11,13 @@ import ( @@ -11,13 +11,13 @@ import (
11 ) 11 )
12 12
13 const ( 13 const (
14 - qrcodeTokenSecret string = "bbe35ad433dd8e67"  
15 -  
16 QrcodeCodeExpire int64 = 60 * 5 //5分钟过期 14 QrcodeCodeExpire int64 = 60 * 5 //5分钟过期
17 ) 15 )
18 16
19 -var aecSecret = []byte("mmm.qrcode.ecb.1")  
20 -var qrcodeLogin = "/v1/auth/login/qrcode?key=" 17 +var (
  18 + aecSecret = []byte("mmm.qrcode.ecb.1")
  19 + qrcodeLogin = "/v1/auth/login/qrcode?key="
  20 +)
21 21
22 type QrcodeMessage struct { 22 type QrcodeMessage struct {
23 Id string `json:"id"` 23 Id string `json:"id"`
@@ -108,7 +108,7 @@ type ( @@ -108,7 +108,7 @@ type (
108 InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"` 108 InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
109 109
110 // 自定义高级查询 110 // 自定义高级查询
111 - AdvancedQueries string `json:"advancedQueries"` 111 + AdvancedQuery string `json:"advancedQuery"`
112 } 112 }
113 113
114 //DataUserSearch 搜索用户列表 114 //DataUserSearch 搜索用户列表