作者 陈志颖

feat:增加修改密码时多密码判断

# Config file for [Air](https://github.com/cosmtrek/air) in TOML format
# Working directory
# . or absolute path, please note that the directories following must be under root.
root = "."
tmp_dir = "tmp"
[build]
# Just plain old shell command. You could use `make` as well.
cmd = "go build -o ./tmp/main ."
# Binary file yields from `cmd`.
bin = "tmp/main"
# Customize binary.
full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html"]
# Ignore these filename extensions or directories.
exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"]
# Watch these directories if you specified.
include_dir = []
# Exclude files.
exclude_file = []
# Exclude unchanged files.
exclude_unchanged = true
# This log file places in your tmp_dir.
log = "air.log"
# It's not necessary to trigger build each time file changes if it's too frequent.
delay = 1000 # ms
# Stop running old binary when build errors occur.
stop_on_error = true
# Send Interrupt signal before killing process (windows does not support this feature)
send_interrupt = false
# Delay after sending Interrupt signal
kill_delay = 500 # ms
[log]
# Show log time
time = false
[color]
# Customize each part's color. If no color found, use the raw app log.
main = "magenta"
watcher = "cyan"
build = "yellow"
runner = "green"
[misc]
# Delete tmp directory on exit
clean_on_exit = true
\ No newline at end of file
... ...
... ... @@ -302,7 +302,13 @@ func UCenterRevoke(header *protocol.RequestHeader, userId int64) (rsp *protocol.
return
}
// 企业平台-密码校验
/**
* @Author SteveChan
* @Description 企业平台-密码登录校验
* @Date 11:06 2021/2/5
* @Param
* @return
**/
func PasswordLogin(header *protocol.RequestHeader, request *protocol.LoginRequest) (v interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
... ... @@ -346,7 +352,7 @@ func PasswordLogin(header *protocol.RequestHeader, request *protocol.LoginReques
/**
* @Author SteveChan
* @Description // 企业平台-多公司登录,判断是否高管
* @Description //TODO 企业平台-多公司登录,判断是否高管,优化游客登录
* @Date 15:01 2021/1/12
* @Param
* @return
... ... @@ -369,14 +375,13 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom
rsp := &protocolx.CenterCompanysResponse{}
// 启动事务
if err = transactionContext.StartTransaction(); err != nil {
log.Error(err)
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
// 通过密码或校验码登录的普通用户或通过校验码登录的游客,注册一个账号到配置的公司去
... ... @@ -490,7 +495,7 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom
/**
* @Author SteveChan
* @Description // 企业平台-多公司登录 - 通过凭证,判断是否高管
* @Description //TODO 企业平台-多公司登录 - 通过凭证,判断是否高管
* @Date 15:00 2021/1/12
* @Param
* @return
... ... @@ -555,7 +560,7 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco
/**
* @Author SteveChan
* @Description //TODO 登录
* @Description 登录
* @Date 15:05 2021/1/15
* @Param
* @return
... ... @@ -575,7 +580,7 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) (
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
if claim, err = utils.ParseJWTToken(request.Credentials); err != nil {
err = protocol.NewErrWithMessage(4140, err)
... ...
... ... @@ -66,6 +66,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis
//if request.EndTime > last.Unix()*1000 {
// request.EndTime = last.Unix() * 1000
//}
fmt.Print("StartTime: ", request.StartTime, "\n")
fmt.Print("EndTime: ", request.EndTime, "\n")
... ...
... ... @@ -44,20 +44,53 @@ func (s *PgPartnerAuthService) ChangeUserPhone(userId int64, newPhone, oldPhone
}
return
}
/**
* @Author SteveChan
* @Description 密码校验增加多公司
* @Date 11:52 2021/2/7
* @Param
* @return
**/
func (s *PgPartnerAuthService) ChangeUserPassword(userId int64, newPwd, oldPwd, phone string) (err error) {
var (
partnerInfo *domain.PartnerInfo
//partnerInfo *domain.PartnerInfo
partnerInfos []*domain.PartnerInfo
PartnerInfoDao, _ = dao.NewPartnerInfoDao(s.transactionContext)
PartnerInfoService, _ = repository.NewPartnerInfoRepository(s.transactionContext)
)
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"account": phone}); err != nil {
// 查询账号信息
if _, partnerInfos, err = PartnerInfoService.Find(map[string]interface{}{"account": phone}); err != nil {
err = errUserNotFound //账号不存在
return
}
if !strings.EqualFold(partnerInfo.Password, oldPwd) {
//多公司密码校验
var misMatch bool
for _, partnerInfo := range partnerInfos {
if !strings.EqualFold(partnerInfo.Password, oldPwd) {
misMatch = true
} else {
misMatch = false
break
}
}
if misMatch {
err = fmt.Errorf("旧密码不正确") //账号不存在
return
}
//if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"account": phone}); err != nil {
// err = errUserNotFound //账号不存在
// return
//}
//if !strings.EqualFold(partnerInfo.Password, oldPwd) {
// err = fmt.Errorf("旧密码不正确") //账号不存在
// return
//}
if err = PartnerInfoDao.Update(map[string]interface{}{
"oldAccount": phone,
"Password": newPwd,
... ...
不能预览此文件类型