...
|
...
|
@@ -255,14 +255,26 @@ func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) |
|
|
var (
|
|
|
templates *models.AuditTemplate
|
|
|
forms []*models.AuditForm
|
|
|
chance *models.Chance
|
|
|
)
|
|
|
rsp = &protocol.TemplateResponse{}
|
|
|
if templates, err = models.GetAuditTemplate(header.CompanyId, request.ChanceTypeId, request.TemplateId); err != nil {
|
|
|
log.Error(fmt.Sprintf("公司:%v chance_type_id:%v id:%v无模板 ", header.CompanyId, request.ChanceTypeId, request.TemplateId), err)
|
|
|
return
|
|
|
}
|
|
|
if request.ChanceId > 0 {
|
|
|
if chance, err = models.GetChanceById(request.ChanceId); err == nil {
|
|
|
if chance.EnableStatus == 0 {
|
|
|
err = protocol.NewErrWithMessage(5101)
|
|
|
return
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose { //只有一个报错码5101 机会删除
|
|
|
err = protocol.NewCustomMessage(5101, "该机会已被关闭或您没有权限查看")
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
item := templates
|
|
|
//TODO:检查模板可见
|
|
|
//
|
|
|
//查询表单
|
|
|
if forms, err = models.GetAuditForms(header.CompanyId, item.Id); err != nil {
|
...
|
...
|
@@ -510,6 +522,14 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate |
|
|
err = protocol.NewErrWithMessage(5101)
|
|
|
return
|
|
|
}
|
|
|
if chance.EnableStatus == 0 {
|
|
|
err = protocol.NewErrWithMessage(5101)
|
|
|
return
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose { //只有一个报错码5101 机会删除
|
|
|
err = protocol.NewCustomMessage(5101, "该机会已被关闭或您没有权限查看")
|
|
|
return
|
|
|
}
|
|
|
//1.模板是否存在
|
|
|
if template, err = models.GetAuditTemplateById(int64(chance.AuditTemplateId)); err != nil {
|
|
|
log.Error("模板不存在:", chance.AuditTemplateId, err)
|
...
|
...
|
|