作者 唐旭辉

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/oppmg into dev

... ... @@ -113,10 +113,11 @@ func GetAuditTemplateByCode(companyId int64, code string) (v *ChanceType, err er
return
}
func GetAuditTemplateByName(companyId int64, name string) (v *ChanceType, err error) {
//同一分类下面 模板名称不能重复
func GetAuditTemplateByName(companyId int64, name string, chanceTypeId int) (v *ChanceType, err error) {
o := orm.NewOrm()
sql := "select * from audit_template where binary name=? and company_id=?"
if err = o.Raw(sql, name, companyId).QueryRow(&v); err == nil {
sql := "select * from audit_template where binary name=? and company_id=? and chance_type_id=?"
if err = o.Raw(sql, name, companyId, chanceTypeId).QueryRow(&v); err == nil {
return
}
return
... ...
... ... @@ -34,7 +34,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs
err = protocol.NewErrWithMessage("10064")
return
}
if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil {
if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil {
err = protocol.NewErrWithMessage("10279")
return
}
... ... @@ -163,7 +163,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques
return
}
if template.Name != request.Template.Name {
if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil {
if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil {
err = protocol.NewErrWithMessage("10279")
return
}
... ...
... ... @@ -124,9 +124,9 @@ func checkScoreRange(scoreRange *protocol.ScoreRange) (result bool) {
if scoreRange.Step < 0.1 {
return
}
if scoreRange.Step < scoreRange.Min || scoreRange.Step > scoreRange.Max {
return
}
//if scoreRange.Step < scoreRange.Min || scoreRange.Step > scoreRange.Max {
// return
//}
result = true
//err =nil
return
... ...