正在显示
1 个修改的文件
包含
12 行增加
和
15 行删除
@@ -488,6 +488,7 @@ func setChanceAutoPass(header *protocol.RequestHeader, chance *models.Chance, or | @@ -488,6 +488,7 @@ func setChanceAutoPass(header *protocol.RequestHeader, chance *models.Chance, or | ||
488 | chance.ApproveData = common.AssertJson(approveData) | 488 | chance.ApproveData = common.AssertJson(approveData) |
489 | chance.ApproveTime = time.Now() | 489 | chance.ApproveTime = time.Now() |
490 | chance.ReviewStatus = protocol.ReviewStatusPass | 490 | chance.ReviewStatus = protocol.ReviewStatusPass |
491 | + chance.PublishStatus = protocol.PublicToCompany | ||
491 | msgData := protocol.MsgData{Score: &approveData.Score} | 492 | msgData := protocol.MsgData{Score: &approveData.Score} |
492 | //发送给机会提交人 | 493 | //发送给机会提交人 |
493 | if err = agg.SendApproveMsgByFormat(header, chance.UserId, chance.Id, fmt.Sprintf(agg.MessageApproveAutoPass, chanceType.Name), msgData); err != nil { | 494 | if err = agg.SendApproveMsgByFormat(header, chance.UserId, chance.Id, fmt.Sprintf(agg.MessageApproveAutoPass, chanceType.Name), msgData); err != nil { |
@@ -555,11 +556,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -555,11 +556,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
555 | //编辑重新发布 是否可以重新发布 | 556 | //编辑重新发布 是否可以重新发布 |
556 | if request.IsPublish && chance.ReviewStatus == protocol.ReviewStatusReturn && chance.UserId == header.UserId { | 557 | if request.IsPublish && chance.ReviewStatus == protocol.ReviewStatusReturn && chance.UserId == header.UserId { |
557 | request.IsPublish = false | 558 | request.IsPublish = false |
558 | - //当前没有被人审核过 | ||
559 | - //if _, e := models.GetAuditFlowProcessApproved(request.Id, 1); e == orm.ErrNoRows && chance.AuditLevel == 1 { | ||
560 | - // //当前状态是退回-待处理 | ||
561 | - // | ||
562 | - //} | ||
563 | if _, e := models.GetAuditFlowProcessByReview(request.Id, 0, protocol.ReviewStatusWait); e == nil { | 559 | if _, e := models.GetAuditFlowProcessByReview(request.Id, 0, protocol.ReviewStatusWait); e == nil { |
564 | request.IsPublish = true | 560 | request.IsPublish = true |
565 | if request.RelatedDepartment > 0 { | 561 | if request.RelatedDepartment > 0 { |
@@ -573,12 +569,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -573,12 +569,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
573 | request.IsPublish = false | 569 | request.IsPublish = false |
574 | log.Info(fmt.Sprintf("机会编辑 is_publish:%v chance.review_status:%v 是否是本人:%v", request.IsPublish, chance.ReviewStatus, chance.UserId == header.UserId)) | 570 | log.Info(fmt.Sprintf("机会编辑 is_publish:%v chance.review_status:%v 是否是本人:%v", request.IsPublish, chance.ReviewStatus, chance.UserId == header.UserId)) |
575 | } | 571 | } |
576 | - //1.需要验证角色权限 2是否是审核人 3.是否是本人 | ||
577 | - //if chance.ReviewStatus != protocol.ReviewStatusPass && chance.UserId != header.UserId { //chance.UserId != header.UserId | ||
578 | - // err = protocol.NewErrWithMessage(5206) | ||
579 | - // log.Error(fmt.Sprintf("user:%v 无权限操作机会 chance:%v", header.UserId, chance.Id)) | ||
580 | - // return | ||
581 | - //} | ||
582 | //1.模板是否存在 | 572 | //1.模板是否存在 |
583 | if template, err = models.GetAuditTemplateById(chance.AuditTemplateId); err != nil { | 573 | if template, err = models.GetAuditTemplateById(chance.AuditTemplateId); err != nil { |
584 | log.Error("模板不存在:", chance.AuditTemplateId, err) | 574 | log.Error("模板不存在:", chance.AuditTemplateId, err) |
@@ -638,7 +628,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -638,7 +628,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
638 | } | 628 | } |
639 | for i := 0; i < len(auditFlows); i++ { | 629 | for i := 0; i < len(auditFlows); i++ { |
640 | auditFlows[i].ApproveMessage = fmt.Sprintf(protocol.MessageApproving, chanceType.Name) | 630 | auditFlows[i].ApproveMessage = fmt.Sprintf(protocol.MessageApproving, chanceType.Name) |
641 | - //auditFlows[i].TemplateId = int(template.Id) | ||
642 | if _, err = orm.Insert(auditFlows[i]); err != nil { | 631 | if _, err = orm.Insert(auditFlows[i]); err != nil { |
643 | log.Error(err) | 632 | log.Error(err) |
644 | orm.Rollback() | 633 | orm.Rollback() |
@@ -692,14 +681,14 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -692,14 +681,14 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
692 | updateMap["ExtraScore"] = chance.ExtraScore | 681 | updateMap["ExtraScore"] = chance.ExtraScore |
693 | updateMap["ValueScore"] = chance.ValueScore | 682 | updateMap["ValueScore"] = chance.ValueScore |
694 | updateMap["DiscoveryScore"] = chance.DiscoveryScore | 683 | updateMap["DiscoveryScore"] = chance.DiscoveryScore |
695 | - updateMap["PublishStatus"] = chance.PublishStatus | ||
696 | } | 684 | } |
697 | } | 685 | } |
698 | } | 686 | } |
699 | } | 687 | } |
700 | 688 | ||
701 | { | 689 | { |
702 | - if request.IsPublish { | 690 | + //机会发布 并且当前机会不是已经通过的,机会状态审核中(存在更新时自动通过) |
691 | + if request.IsPublish && chance.ReviewStatus != protocol.ReviewStatusPass { | ||
703 | updateMap["ReviewStatus"] = int8(protocol.ReviewStatusAuditging) | 692 | updateMap["ReviewStatus"] = int8(protocol.ReviewStatusAuditging) |
704 | } | 693 | } |
705 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) | 694 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) |
@@ -2010,7 +1999,7 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ | @@ -2010,7 +1999,7 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ | ||
2010 | if user.Id == header.UserId { | 1999 | if user.Id == header.UserId { |
2011 | rsp.Check = 4 | 2000 | rsp.Check = 4 |
2012 | allPermission() | 2001 | allPermission() |
2013 | - return | 2002 | + //return |
2014 | } | 2003 | } |
2015 | //判断机会权限 | 2004 | //判断机会权限 |
2016 | if request.ChanceId > 0 { | 2005 | if request.ChanceId > 0 { |
@@ -2018,6 +2007,14 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ | @@ -2018,6 +2007,14 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ | ||
2018 | err = protocol.NewErrWithMessage(5101) | 2007 | err = protocol.NewErrWithMessage(5101) |
2019 | return | 2008 | return |
2020 | } | 2009 | } |
2010 | + //公司管理员权限二次判断 | ||
2011 | + if user.Id == header.UserId { | ||
2012 | + //退回 即使是管理员也是没有权限 | ||
2013 | + if chance.UserId != header.UserId && chance.ReviewStatus == protocol.ReviewStatusReturn { | ||
2014 | + noPermission() | ||
2015 | + } | ||
2016 | + return | ||
2017 | + } | ||
2021 | //机会关闭 / 删除 | 2018 | //机会关闭 / 删除 |
2022 | if chance.Status == models.ChanceStatusClose || chance.EnableStatus == 0 { | 2019 | if chance.Status == models.ChanceStatusClose || chance.EnableStatus == 0 { |
2023 | noPermission() | 2020 | noPermission() |
-
请 注册 或 登录 后发表评论