作者 yangfu

扫码登录修改

... ... @@ -115,7 +115,7 @@ func (svr AuthService) AuthLoginQrcode(queryParam *query.QrcodeLoginStatusQuery)
qrcodeMessage, err := cache.Get(queryParam.Key)
if err != nil {
log.Logger.Error(err.Error())
return nil, application.ThrowError(application.TRANSACTION_ERROR, "二维码已失效")
return nil, application.ThrowError(application.BUSINESS_ERROR, "二维码已失效")
}
if !qrcodeMessage.IsLogin {
return failLoginData, nil
... ... @@ -132,7 +132,7 @@ func (svr AuthService) AuthLoginQrcode(queryParam *query.QrcodeLoginStatusQuery)
cache.Remove(queryParam.Key)
result, err := svr.getToken(loginToken)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
data := map[string]interface{}{
... ... @@ -147,14 +147,14 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC
qrCache := cache.LoginQrcodeCache{}
qrcodeMessage, err := qrCache.Get(bindingCmd.Key)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "您扫描的二维码无效,请确认后重新扫描")
return nil, application.ThrowError(application.BUSINESS_ERROR, "您扫描的二维码无效,请确认后重新扫描")
}
if err := qrcodeMessage.BindUser(bindingCmd.Operator); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if err := qrCache.Save(*qrcodeMessage); err != nil {
log.Logger.Error(err.Error())
return nil, application.ThrowError(application.TRANSACTION_ERROR, "登录失败,请重试")
return nil, application.ThrowError(application.BUSINESS_ERROR, "登录失败,请重试")
}
return struct{}{}, nil
}
... ... @@ -170,13 +170,13 @@ func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand
Account: smsCodeCommand.Phone,
})
if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone {
return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入")
return application.ThrowError(application.BUSINESS_ERROR, "输入的手机号不是平台用户,请重新输入")
}
}
smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
err := smsServeGateway.SendSms(smsCodeCommand.Phone)
if err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return nil
}
... ... @@ -708,7 +708,7 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs
//GetQrcode 获取扫码登录需要的二维码
func (svr AuthService) GetQrcode() (interface{}, error) {
qrcodeMessage := domain.QrcodeMessage{}
_, err := qrcodeMessage.Init() //imgBase64
_, err := qrcodeMessage.Init()
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ...
... ... @@ -182,17 +182,17 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize,
Limit: companyUserListQuery.PageSize,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
DepName: companyUserListQuery.DepartmentName,
Phone: "",
UserType: domain.UserTypeEmployee,
InOrgIds: companyUserListQuery.Operator.OrgIds,
PullRealTime: true,
AdvancedQueries: domain.AdvancedQuerySql(domain.UserModel{}.ModelName(), companyUserListQuery.AdvancedQueries),
Limit: companyUserListQuery.PageSize,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
DepName: companyUserListQuery.DepartmentName,
Phone: "",
UserType: domain.UserTypeEmployee,
InOrgIds: companyUserListQuery.Operator.OrgIds,
PullRealTime: true,
AdvancedQuery: domain.AdvancedQuerySql(domain.UserModel{}.ModelName(), companyUserListQuery.AdvancedQueries),
})
if err != nil {
... ...
... ... @@ -11,13 +11,13 @@ import (
)
const (
qrcodeTokenSecret string = "bbe35ad433dd8e67"
QrcodeCodeExpire int64 = 60 * 5 //5分钟过期
)
var aecSecret = []byte("mmm.qrcode.ecb.1")
var qrcodeLogin = "/v1/auth/login/qrcode?key="
var (
aecSecret = []byte("mmm.qrcode.ecb.1")
qrcodeLogin = "/v1/auth/login/qrcode?key="
)
type QrcodeMessage struct {
Id string `json:"id"`
... ...
... ... @@ -108,7 +108,7 @@ type (
InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
// 自定义高级查询
AdvancedQueries string `json:"advancedQueries"`
AdvancedQuery string `json:"advancedQuery"`
}
//DataUserSearch 搜索用户列表
... ...