作者 tangxuhui
... ... @@ -8,15 +8,22 @@ import (
type SendSmsCodeCommand struct {
Phone string `json:"phone" valid:"Required"`
// 0:无 1:需要账号存在于账号系统内,才能发送验证码
Flag int `json:"flag"`
// [1:登录][2:修改密码][3:找回密码][4:注册][5:修改手机号]
Action int `json:"action"`
}
func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) {
func (cmd *SendSmsCodeCommand) Valid(validation *validation.Validation) {
}
func (orgAddCommand *SendSmsCodeCommand) ValidateCommand() error {
func (cmd *SendSmsCodeCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(orgAddCommand)
b, err := valid.Valid(cmd)
if cmd.Action == 1 || cmd.Action == 2 || cmd.Action == 3 {
cmd.Flag = 1
}
if err != nil {
return err
}
... ...
... ... @@ -171,6 +171,18 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC
//SendSmsCaptcha 发送验证码短信
func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error {
if err := smsCodeCommand.ValidateCommand(); err != nil {
return application.ThrowError(application.ARG_ERROR, err.Error())
}
if smsCodeCommand.Flag == 1 {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
Account: smsCodeCommand.Phone,
})
if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone {
return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入")
}
}
smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
err := smsServeGateway.SendSms(smsCodeCommand.Phone)
if err != nil {
... ...
... ... @@ -11,7 +11,7 @@ type SearchDividendContractsCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageIndex" valid:"Required"`
PageNumber int `json:"pageNumber" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//审核状态
... ...
... ... @@ -14,8 +14,10 @@ type SearchDividendsEstimatesCommand struct {
PageNumber int `json:"pageIndex" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//审核状态
//状态
Status int `json:"status"`
// 组织Id
OrgId int64 `json:"orgId" valid:"Required"`
}
func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -26,7 +26,11 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD
cmd.OrgId = cmd.Operator.OrgId
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, cmd)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, map[string]interface{}{
"offset": cmd.PageNumber * cmd.PageSize,
"limit": cmd.PageSize,
"orgId": cmd.Operator.OrgId,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ...
... ... @@ -58,8 +58,8 @@ func (srv PersonDividendsService) SearchDividendsEstimates(cmd *command.SearchDi
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
//"orgId":cmd.Operator.OrgId,
//"companyId": cmd.Operator.CompanyId,
"orgId": cmd.OrgId,
"userBaseId": cmd.Operator.UserBaseId,
"dividendsAccountStatus": cmd.Status,
"offset": (cmd.PageNumber - 1) * cmd.PageSize,
... ...
... ... @@ -8,6 +8,8 @@ import (
type SendSmsCodeCommand struct {
Phone string `json:"phone" valid:"Required"`
// 0:无 1:需要账号存在于账号系统内,才能发送验证码
Flag int `json:"flag"`
}
func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -19,6 +19,15 @@ type UserService struct {
//SendSmsCaptcha 发送验证码短信
func (srv UserService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error {
if smsCodeCommand.Flag == 1 {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
Account: smsCodeCommand.Phone,
})
if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone {
return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入")
}
}
smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
err := smsServeGateway.SendSms(smsCodeCommand.Phone)
if err != nil {
... ...
... ... @@ -34,7 +34,9 @@ func init() {
filters.SecureKeyMap["token"] = "x-mmm-accesstoken"
web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors())
web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger))
web.InsertFilter("/*", web.BeforeExec, middleware.CheckAccessToken2())
web.InsertFilter("/v1/web/*", web.BeforeExec, middleware.CheckAccessToken2())
web.InsertFilter("/v1/app/*", web.BeforeExec, middleware.CheckAccessToken2())
web.InsertFilter("/v1/user/*", web.BeforeExec, middleware.CheckAccessToken2())
web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false))
web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler(
filters.WithEnableCheckTimestamp(false),
... ...