正在显示
3 个修改的文件
包含
9 行增加
和
8 行删除
@@ -113,10 +113,11 @@ func GetAuditTemplateByCode(companyId int64, code string) (v *ChanceType, err er | @@ -113,10 +113,11 @@ func GetAuditTemplateByCode(companyId int64, code string) (v *ChanceType, err er | ||
113 | return | 113 | return |
114 | } | 114 | } |
115 | 115 | ||
116 | -func GetAuditTemplateByName(companyId int64, name string) (v *ChanceType, err error) { | 116 | +//同一分类下面 模板名称不能重复 |
117 | +func GetAuditTemplateByName(companyId int64, name string, chanceTypeId int) (v *ChanceType, err error) { | ||
117 | o := orm.NewOrm() | 118 | o := orm.NewOrm() |
118 | - sql := "select * from audit_template where binary name=? and company_id=?" | ||
119 | - if err = o.Raw(sql, name, companyId).QueryRow(&v); err == nil { | 119 | + sql := "select * from audit_template where binary name=? and company_id=? and chance_type_id=?" |
120 | + if err = o.Raw(sql, name, companyId, chanceTypeId).QueryRow(&v); err == nil { | ||
120 | return | 121 | return |
121 | } | 122 | } |
122 | return | 123 | return |
@@ -34,7 +34,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | @@ -34,7 +34,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | ||
34 | err = protocol.NewErrWithMessage("10064") | 34 | err = protocol.NewErrWithMessage("10064") |
35 | return | 35 | return |
36 | } | 36 | } |
37 | - if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil { | 37 | + if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil { |
38 | err = protocol.NewErrWithMessage("10279") | 38 | err = protocol.NewErrWithMessage("10279") |
39 | return | 39 | return |
40 | } | 40 | } |
@@ -163,7 +163,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques | @@ -163,7 +163,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques | ||
163 | return | 163 | return |
164 | } | 164 | } |
165 | if template.Name != request.Template.Name { | 165 | if template.Name != request.Template.Name { |
166 | - if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil { | 166 | + if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil { |
167 | err = protocol.NewErrWithMessage("10279") | 167 | err = protocol.NewErrWithMessage("10279") |
168 | return | 168 | return |
169 | } | 169 | } |
@@ -124,9 +124,9 @@ func checkScoreRange(scoreRange *protocol.ScoreRange) (result bool) { | @@ -124,9 +124,9 @@ func checkScoreRange(scoreRange *protocol.ScoreRange) (result bool) { | ||
124 | if scoreRange.Step < 0.1 { | 124 | if scoreRange.Step < 0.1 { |
125 | return | 125 | return |
126 | } | 126 | } |
127 | - if scoreRange.Step < scoreRange.Min || scoreRange.Step > scoreRange.Max { | ||
128 | - return | ||
129 | - } | 127 | + //if scoreRange.Step < scoreRange.Min || scoreRange.Step > scoreRange.Max { |
128 | + // return | ||
129 | + //} | ||
130 | result = true | 130 | result = true |
131 | //err =nil | 131 | //err =nil |
132 | return | 132 | return |
-
请 注册 或 登录 后发表评论